From 44ef31ff77094a989e7c3e666d22750970d0002a Mon Sep 17 00:00:00 2001 From: Berkus Decker Date: Tue, 13 Oct 2020 21:35:14 +0300 Subject: [PATCH] Add missed clobbered registers in asm block Fixes mis-compilation described in rust-lang/rust#68812. --- nucleus/src/qemu.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nucleus/src/qemu.rs b/nucleus/src/qemu.rs index d8ff082..c527e24 100644 --- a/nucleus/src/qemu.rs +++ b/nucleus/src/qemu.rs @@ -11,11 +11,12 @@ pub mod semihosting { #[cfg(test)] pub fn sys_write0_call(text: &str) { // SAFETY: text must be \0-terminated! + let cmd = 0x04; unsafe { asm!( - "mov w0, #0x04 - hlt #0xF000" - , in("x1") text.as_ptr() as u64 + "hlt #0xF000" + , in("w0") cmd + , in("x1") text.as_ptr() as u64 ); } }