Add missed clobbered registers in asm block

Fixes mis-compilation described in rust-lang/rust#68812.
This commit is contained in:
Berkus Decker 2020-10-13 21:35:14 +03:00
parent 589696a500
commit 44ef31ff77
1 changed files with 4 additions and 3 deletions

View File

@ -11,11 +11,12 @@ pub mod semihosting {
#[cfg(test)] #[cfg(test)]
pub fn sys_write0_call(text: &str) { pub fn sys_write0_call(text: &str) {
// SAFETY: text must be \0-terminated! // SAFETY: text must be \0-terminated!
let cmd = 0x04;
unsafe { unsafe {
asm!( asm!(
"mov w0, #0x04 "hlt #0xF000"
hlt #0xF000" , in("w0") cmd
, in("x1") text.as_ptr() as u64 , in("x1") text.as_ptr() as u64
); );
} }
} }