Skip to content

Commit

Permalink
Changes some llvm_asm to asm macro
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineRR committed Jan 15, 2021
1 parent dc53135 commit f385de6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
18 changes: 8 additions & 10 deletions mythril/src/registers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ impl IdtrBase {
limit: 0,
base_addr: 0,
};
llvm_asm!("sidt ($0)"
:
: "r"(&mut info)
: "memory"
: "volatile");
asm!(
"sidt fword ptr [{0}]",
in(reg) &mut info
);
info.base_addr
}
}
Expand All @@ -35,11 +34,10 @@ impl GdtrBase {
pub fn read() -> u64 {
unsafe {
let mut info = GdtInfo { size: 0, offset: 0 };
llvm_asm!("sgdtq ($0)"
:
: "r"(&mut info)
: "memory"
: "volatile");
asm!(
"sgdt fword ptr [{0}]",
in(reg) &mut info
);
info.offset
}
}
Expand Down
3 changes: 2 additions & 1 deletion mythril/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,8 @@ pub fn busy_wait(duration: core::time::Duration) {
while now() < start + duration {
unsafe {
// Relax the cpu
llvm_asm!("rep; nop" ::: "memory");
//llvm_asm!("rep; nop" ::: "memory");
asm!("rep", "nop");
}
}
}
Expand Down

0 comments on commit f385de6

Please sign in to comment.