Skip to content

Commit ca5dce7

Browse files
committed
cross-checks: rust-checks: Update assembly in Rust runtime
1 parent ea83950 commit ca5dce7

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

cross-checks/rust-checks/runtime/src/hash/mod.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -214,17 +214,19 @@ fn try_pointer<'a, T: ?Sized>(p: *const T) -> Option<&'a T> {
214214
let mut invalid: u8 = 0;
215215
unsafe {
216216
// Same implementation as clang-plugin/runtime/hash.c
217-
asm!(" jmp 1f
218-
.word 2f - 1f
219-
.ascii \"C2RUST_INVPTR\\0\"
220-
1: movb ($2), $0
221-
jmp 3f
222-
2: incb $1
223-
3:"
224-
: "=r" (_pv), "+r" (invalid)
225-
: "r" (p)
226-
: "cc"
227-
: "volatile");
217+
core::arch::asm!(
218+
"jmp 1f",
219+
".word 2f - 1f",
220+
".ascii \"C2RUST_INVPTR\\0\"",
221+
"1: movb ({0}), {1}",
222+
"jmp 3f",
223+
"2: incb {2}",
224+
"3:",
225+
in(reg) p.cast::<u8>(),
226+
out(reg_byte) _pv,
227+
inout(reg_byte) invalid,
228+
options(att_syntax),
229+
);
228230
if invalid == 0 {
229231
Some(&*p)
230232
} else {

cross-checks/rust-checks/runtime/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![feature(never_type)]
2-
#![feature(asm)]
32
#![cfg_attr(feature = "xcheck-with-dlsym", feature(const_fn))]
43
#![cfg_attr(feature = "xcheck-with-dlsym", feature(const_ptr_null_mut))]
54
#![cfg_attr(feature = "xcheck-with-dlsym", feature(libc))]

0 commit comments

Comments
 (0)