chore: allow making remoteWrite with remote ptr
This commit is contained in:
parent
45d3f8d734
commit
4a20ddbbda
1 changed files with 10 additions and 5 deletions
|
@ -72,19 +72,24 @@ impl RemoteSyscall for RemoteOpen {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct RemoteWrite {
|
pub struct RemoteWrite {
|
||||||
fd: u64,
|
fd: i64,
|
||||||
buf: RemoteString,
|
ptr: u64,
|
||||||
|
len: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RemoteWrite {
|
impl RemoteWrite {
|
||||||
pub fn args(fd: u64, buf: RemoteString) -> Self {
|
pub fn args(fd: i64, ptr: u64, len: u64) -> Self {
|
||||||
RemoteWrite { fd, buf }
|
RemoteWrite { fd, ptr, len }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn string(fd: i64, txt: RemoteString) -> Self {
|
||||||
|
RemoteWrite { fd, ptr: txt.ptr.expect("remote write with uninjected remote str") as u64, len: txt.txt.len() as u64 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RemoteSyscall for RemoteWrite {
|
impl RemoteSyscall for RemoteWrite {
|
||||||
fn registers(&self, regs: &mut user_regs_struct) {
|
fn registers(&self, regs: &mut user_regs_struct) {
|
||||||
Self::prepare_registers(regs, 1, self.fd, self.buf.ptr.unwrap() as u64, self.buf.txt.len() as u64, 0, 0, 0);
|
Self::prepare_registers(regs, 1, self.fd as u64, self.ptr, self.len, 0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue