File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,6 @@ impl crate::ArchExtras for crate::CPU {
80
80
81
81
match idx {
82
82
0 ..=1 => {
83
- let val: GuestReg = val. into ( ) ;
84
83
let stack_ptr: GuestAddr = self . read_reg ( Regs :: Sp ) ?;
85
84
/*
86
85
* Stack is full and descending. SP points to return address, arguments
@@ -89,10 +88,11 @@ impl crate::ArchExtras for crate::CPU {
89
88
let size: GuestAddr = size_of :: < GuestReg > ( ) as GuestAddr ;
90
89
let offset = size * ( idx as GuestAddr + 1 ) ;
91
90
92
- let val = unsafe {
93
- self . read_mem ( stack_ptr + offset, size_of :: < GuestReg > ( ) ) ;
94
- } ;
95
- Ok ( GuestReg :: from_le_bytes ( val) )
91
+ let mut val = [ 0u8 ; size_of :: < GuestReg > ( ) ] ;
92
+ unsafe {
93
+ self . read_mem ( stack_ptr + offset, & mut val) ;
94
+ }
95
+ Ok ( GuestReg :: from_le_bytes ( val) . into ( ) )
96
96
}
97
97
_ => Err ( format ! ( "Unsupported argument: {idx:}" ) ) ,
98
98
}
You can’t perform that action at this time.
0 commit comments