summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Lutomirski <luto@amacapital.net>2014-07-03 12:31:50 -0700
committerAndy Lutomirski <luto@amacapital.net>2014-07-03 12:31:50 -0700
commit30d35d95f576fb266fc7537fa8c59c04755f7fa0 (patch)
tree3665b0e2c03a9b1dff11682d021def1dde324b55
parentaff7a91f46cfb8d30e70f2cfc52bb9f951ea4db1 (diff)
downloadmisc-tests-30d35d95f576fb266fc7537fa8c59c04755f7fa0.tar.gz
Add syscall_exit_regs
-rw-r--r--.gitignore8
-rw-r--r--Makefile2
-rw-r--r--syscall_exit_regs.c19
3 files changed, 22 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
index 2dde783..13a1dfb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,13 +1,9 @@
-dump-vdso
-dump-vvar
dump-vsyscall
-timing_test_32
-timing_test_64
time-warp-test
evil-clock-test
-test_vsyscall_32
-test_vsyscall_64
context_switch_latency
kernel_pf
user_visible_state
*~
+*_32
+*_64
diff --git a/Makefile b/Makefile
index 70cd876..cf97ede 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@ SIMPLE_C_TARGETS := dump-vdso dump-vvar dump-vsyscall context_switch_latency ker
SIMPLE_CC_TARGETS := evil-clock-test
-SPLIT_C_TARGETS := dump-vdso dump-vvar
+SPLIT_C_TARGETS := dump-vdso dump-vvar syscall_exit_regs
SPLIT_CC_TARGETS := timing_test test_vsyscall
ALL_TARGETS := $(SIMPLE_C_TARGETS) $(SIMPLE_CC_TARGETS) $(SPLIT_C_TARGETS:%=%_64) $(SPLIT_CC_TARGETS:%=%_64) $(SPLIT_C_TARGETS:%=%_32) $(SPLIT_CC_TARGETS:%=%_32)
diff --git a/syscall_exit_regs.c b/syscall_exit_regs.c
new file mode 100644
index 0000000..4c7f97e
--- /dev/null
+++ b/syscall_exit_regs.c
@@ -0,0 +1,19 @@
+#include <stdio.h>
+
+int main()
+{
+ extern const char syscall_rip[];
+ unsigned long rcx = 1;
+ unsigned long orig_rcx = rcx;
+ asm ("mov $-1, %%eax\n\t"
+ "syscall\n\t"
+ "syscall_rip:"
+ : "+c" (rcx) : :
+#ifdef __x86_64__
+ "r11"
+#endif
+ );
+ printf("syscall: RCX = %lX RIP = %lX orig RCX = %lx\n",
+ rcx, (unsigned long)syscall_rip, orig_rcx);
+ return 0;
+}