Skip to content

Commit 7c3d3f1

Browse files
xvancAndy-Python-Programmer
authored andcommitted
implement test for sysenter
1 parent 7d936e3 commit 7c3d3f1

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

userland/apps/utest/src/main.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ pub struct Test<'a> {
3434
static TEST_FUNCTIONS: &[&'static Test<'static>] = &[
3535
// TODO: Why does clone process fail?
3636
// &clone_process,
37+
&sysenter_test,
3738
&rpc_test,
3839
&forked_pipe,
3940
&signal_handler,
@@ -313,3 +314,29 @@ fn rpc_test() -> Result<(), AeroSyscallError> {
313314

314315
Ok(())
315316
}
317+
318+
#[utest_proc::test]
319+
fn sysenter_test() -> Result<(), AeroSyscallError> {
320+
let msg = "sysenter works!\n";
321+
let ptr = msg.as_ptr();
322+
let len = msg.len();
323+
324+
unsafe {
325+
core::arch::asm! {
326+
"
327+
mov r11, rsp
328+
lea rcx, [rip + 1f]
329+
sysenter
330+
1:
331+
",
332+
in("rax") consts::SYS_WRITE,
333+
in("rdi") 1,
334+
in("rsi") ptr,
335+
inout("rdx") len => _,
336+
out("r11") _,
337+
out("rcx") _,
338+
}
339+
}
340+
341+
Ok(())
342+
}

0 commit comments

Comments
 (0)