diff options
Diffstat (limited to 'pintos-progos/tests/userprog/sc-bad-arg.c')
| -rw-r--r-- | pintos-progos/tests/userprog/sc-bad-arg.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/pintos-progos/tests/userprog/sc-bad-arg.c b/pintos-progos/tests/userprog/sc-bad-arg.c new file mode 100644 index 0000000..0b512a0 --- /dev/null +++ b/pintos-progos/tests/userprog/sc-bad-arg.c | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | /* Sticks a system call number (SYS_EXIT) at the very top of the | ||
| 2 | stack, then invokes a system call with the stack pointer | ||
| 3 | (%esp) set to its address. The process must be terminated | ||
| 4 | with -1 exit code because the argument to the system call | ||
| 5 | would be above the top of the user address space. */ | ||
| 6 | |||
| 7 | #include <syscall-nr.h> | ||
| 8 | #include "tests/lib.h" | ||
| 9 | #include "tests/main.h" | ||
| 10 | |||
| 11 | void | ||
| 12 | test_main (void) | ||
| 13 | { | ||
| 14 | asm volatile ("movl $0xbffffffc, %%esp; movl %0, (%%esp); int $0x30" | ||
| 15 | : : "i" (SYS_EXIT)); | ||
| 16 | fail ("should have called exit(-1)"); | ||
| 17 | } | ||
