summaryrefslogtreecommitdiffstats
path: root/src/tests/userprog/sc-boundary.c
diff options
context:
space:
mode:
authorFelipe Boeira <felipe.boeira@liu.se>2019-01-08 18:39:03 +0100
committerFelipe Boeira <felipe.boeira@liu.se>2019-01-08 18:39:03 +0100
commitd4522b8e9854178473adcea0fbb84f23f6e744bd (patch)
treefbcf620617c5023154eba3f965b3a982daa64a47 /src/tests/userprog/sc-boundary.c
downloadpintos-d4522b8e9854178473adcea0fbb84f23f6e744bd.tar.gz
Initial commit
Diffstat (limited to 'src/tests/userprog/sc-boundary.c')
-rw-r--r--src/tests/userprog/sc-boundary.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/tests/userprog/sc-boundary.c b/src/tests/userprog/sc-boundary.c
new file mode 100644
index 0000000..d889535
--- /dev/null
+++ b/src/tests/userprog/sc-boundary.c
@@ -0,0 +1,22 @@
+/* Invokes a system call with the system call number and its
+ argument on separate pages. This must work. */
+
+#include <syscall-nr.h>
+#include "tests/userprog/boundary.h"
+#include "tests/lib.h"
+#include "tests/main.h"
+
+void
+test_main (void)
+{
+ /* Put a syscall number at the end of one page
+ and its argument at the beginning of another. */
+ int *p = get_boundary_area ();
+ p--;
+ p[0] = SYS_EXIT;
+ p[1] = 42;
+
+ /* Invoke the system call. */
+ asm volatile ("movl %0, %%esp; int $0x30" : : "g" (p));
+ fail ("should have called exit(42)");
+}