From a30fa69e382f3562fe2f59e39049af8f70f513aa Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Wed, 28 Apr 2021 19:57:20 -0600 Subject: [PATCH] Use correct syscall return register on aarch64 --- src/arch/aarch64.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/arch/aarch64.rs b/src/arch/aarch64.rs index 60e2238..d8f9471 100644 --- a/src/arch/aarch64.rs +++ b/src/arch/aarch64.rs @@ -7,11 +7,13 @@ macro_rules! syscall { ($($name:ident($a:ident, $($b:ident, $($c:ident, $($d:ident, $($e:ident, $($f:ident, )?)?)?)?)?);)+) => { $( pub unsafe fn $name(mut $a: usize, $(mut $b: usize, $($c: usize, $($d: usize, $($e: usize, $($f: usize)?)?)?)?)?) -> Result { + let ret: usize; + asm!( "svc 0", in("x8") $a, $( - inout("x0") $b, + in("x0") $b, $( in("x1") $c, $( @@ -25,10 +27,11 @@ macro_rules! syscall { )? )? )? + lateout("x0") ret, options(nostack), ); - Error::demux($a) + Error::demux(ret) } )+ }; @@ -52,7 +55,7 @@ pub struct IntRegisters { pub spsr_el1: usize, pub esr_el1: usize, pub sp_el0: usize, // Shouldn't be used if interrupt occurred at EL1 - pub padding: usize, // To keep the struct even number aligned + pub padding: usize, // To keep the struct even number aligned pub x30: usize, pub x29: usize, pub x28: usize,