Added more userprog tests, mostly relating to boundary conditions
[pintos-anon] / src / tests / userprog / sc-boundary-3.c
diff --git a/src/tests/userprog/sc-boundary-3.c b/src/tests/userprog/sc-boundary-3.c
new file mode 100644 (file)
index 0000000..b2e24ca
--- /dev/null
@@ -0,0 +1,20 @@
+/* Invokes a system call with the system call number positioned
+   such that its first byte is valid but the remaining bytes of
+   the number are in invalid memory. Must kill process. */
+
+#include <syscall-nr.h>
+#include "tests/userprog/boundary.h"
+#include "tests/lib.h"
+#include "tests/main.h"
+
+void
+test_main (void) 
+{
+  char *p = get_bad_boundary ();
+  p--;
+  *p = 100;
+
+  /* Invoke the system call. */
+  asm volatile ("movl %0, %%esp; int $0x30" : : "g" (p));
+  fail ("should have killed process");
+}