From 68c4eda1c24d56f3108648c5b1855664d7f0e8cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Str=C3=B6mb=C3=A4ck?= Date: Wed, 18 Mar 2020 12:28:10 +0100 Subject: Added new tests for the validating the syscall number. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filip Strömbäck --- src/tests/filst/sc-bad-nr-3.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/tests/filst/sc-bad-nr-3.c (limited to 'src/tests/filst/sc-bad-nr-3.c') diff --git a/src/tests/filst/sc-bad-nr-3.c b/src/tests/filst/sc-bad-nr-3.c new file mode 100644 index 0000000..6cde22b --- /dev/null +++ b/src/tests/filst/sc-bad-nr-3.c @@ -0,0 +1,24 @@ +#include +#include "tests/lib.h" +#include "tests/main.h" + +// From "lib/user/syscall.c", but modified to push some zeros on the stack +// first, to get a better output for the tests if the stack error message +// remains. +#define syscall0(NUMBER) \ + ({ \ + int retval; \ + asm volatile \ + ("pushl $0; pushl $0; pushl %[number]; int $0x30; addl $4, %%esp" \ + : "=a" (retval) \ + : [number] "i" (NUMBER) \ + : "memory"); \ + retval; \ + }) + +void test_main(void) +{ + // Call a negative syscall. + syscall0(-1); + fail("Should have failed."); +} -- cgit v1.2.1