File tree Expand file tree Collapse file tree 2 files changed +16
-20
lines changed
tee/kernel/src/user/syscall Expand file tree Collapse file tree 2 files changed +16
-20
lines changed Original file line number Diff line number Diff line change @@ -323,6 +323,21 @@ impl SyscallArg for i64 {
323323 }
324324}
325325
326+ impl SyscallArg for u32 {
327+ fn parse ( value : u64 , _abi : Abi ) -> Result < Self > {
328+ Ok ( value as u32 )
329+ }
330+
331+ fn display (
332+ f : & mut dyn fmt:: Write ,
333+ value : u64 ,
334+ abi : Abi ,
335+ _thread : & ThreadGuard < ' _ > ,
336+ ) -> fmt:: Result {
337+ write ! ( f, "{}" , Self :: parse( value, abi) . unwrap( ) )
338+ }
339+ }
340+
326341impl SyscallArg for i32 {
327342 fn parse ( value : u64 , _abi : Abi ) -> Result < Self > {
328343 Ok ( value as u32 as i32 )
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ use crate::{
1717 error:: { Result , err} ,
1818 per_cpu:: PerCpu ,
1919 user:: {
20- syscall:: { SYSCALL_HANDLERS , args :: SyscallArg } ,
20+ syscall:: SYSCALL_HANDLERS ,
2121 thread:: { Thread , ThreadGuard } ,
2222 } ,
2323} ;
@@ -40,25 +40,6 @@ pub enum Abi {
4040
4141pub type SyscallResult = Result < u64 > ;
4242
43- impl SyscallArg for u32 {
44- fn parse ( value : u64 , _abi : Abi ) -> Result < Self > {
45- Ok ( u32:: try_from ( value) ?)
46- }
47-
48- fn display (
49- f : & mut dyn fmt:: Write ,
50- value : u64 ,
51- _abi : Abi ,
52- _thread : & ThreadGuard < ' _ > ,
53- ) -> fmt:: Result {
54- if let Ok ( value) = u32:: try_from ( value) {
55- write ! ( f, "{value}" )
56- } else {
57- write ! ( f, "{value} (out of bounds)" )
58- }
59- }
60- }
61-
6243pub trait Syscall {
6344 const NO_I386 : Option < usize > ;
6445 const NO_AMD64 : Option < usize > ;
You can’t perform that action at this time.
0 commit comments