Skip to content

Commit f385de6

Browse files
committed
Changes some llvm_asm to asm macro
1 parent dc53135 commit f385de6

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

mythril/src/registers.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ impl IdtrBase {
1313
limit: 0,
1414
base_addr: 0,
1515
};
16-
llvm_asm!("sidt ($0)"
17-
:
18-
: "r"(&mut info)
19-
: "memory"
20-
: "volatile");
16+
asm!(
17+
"sidt fword ptr [{0}]",
18+
in(reg) &mut info
19+
);
2120
info.base_addr
2221
}
2322
}
@@ -35,11 +34,10 @@ impl GdtrBase {
3534
pub fn read() -> u64 {
3635
unsafe {
3736
let mut info = GdtInfo { size: 0, offset: 0 };
38-
llvm_asm!("sgdtq ($0)"
39-
:
40-
: "r"(&mut info)
41-
: "memory"
42-
: "volatile");
37+
asm!(
38+
"sgdt fword ptr [{0}]",
39+
in(reg) &mut info
40+
);
4341
info.offset
4442
}
4543
}

mythril/src/time.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,8 @@ pub fn busy_wait(duration: core::time::Duration) {
384384
while now() < start + duration {
385385
unsafe {
386386
// Relax the cpu
387-
llvm_asm!("rep; nop" ::: "memory");
387+
//llvm_asm!("rep; nop" ::: "memory");
388+
asm!("rep", "nop");
388389
}
389390
}
390391
}

0 commit comments

Comments
 (0)