Extract OS-specific part from UserContextApi

This commit is contained in:
YanWQ-monad
2024-05-20 03:14:13 +08:00
committed by Tate, Hongliang Tian
parent 657d6719c7
commit a5707b4ddc
16 changed files with 128 additions and 74 deletions

View File

@ -471,29 +471,6 @@ impl UserContextApi for UserContext {
self.user_context.error_code
}
fn syscall_num(&self) -> usize {
self.rax()
}
fn syscall_ret(&self) -> usize {
self.rax()
}
fn set_syscall_ret(&mut self, ret: usize) {
self.set_rax(ret);
}
fn syscall_args(&self) -> [usize; 6] {
[
self.rdi(),
self.rsi(),
self.rdx(),
self.r10(),
self.r8(),
self.r9(),
]
}
fn set_instruction_pointer(&mut self, ip: usize) {
self.set_rip(ip);
}

View File

@ -65,18 +65,6 @@ pub trait UserContextApi {
/// Get the trap error code of this interrupt.
fn trap_error_code(&self) -> usize;
/// Get number of syscall
fn syscall_num(&self) -> usize;
/// Get return value of syscall
fn syscall_ret(&self) -> usize;
/// Set return value of syscall
fn set_syscall_ret(&mut self, ret: usize);
/// Get syscall args
fn syscall_args(&self) -> [usize; 6];
/// Set instruction pointer
fn set_instruction_pointer(&mut self, ip: usize);