From eca57656bfb384583c1c4b34de46cde6b36d6694 Mon Sep 17 00:00:00 2001 From: Michal Idziorek Date: Sat, 22 Nov 2014 17:57:57 +0100 Subject: added call_unhandled for unhandled syscalls --- asm/int_syscall_handler.asm | 10 ++++++++++ kernel/config.h | 2 +- kernel/syscalls.c | 5 +++++ kernel/syscalls.h | 4 +++- userspace/Makefile | 4 ---- userspace/sys/sys.c | 2 +- 6 files changed, 20 insertions(+), 7 deletions(-) diff --git a/asm/int_syscall_handler.asm b/asm/int_syscall_handler.asm index a2236fe..3ffdd25 100644 --- a/asm/int_syscall_handler.asm +++ b/asm/int_syscall_handler.asm @@ -11,6 +11,7 @@ global int_syscall_handler [extern syscall_isatty] [extern syscall_lseek] [extern syscall_sbrk] +[extern syscall_unhandled] [bits 32] int_syscall_handler: @@ -54,6 +55,10 @@ int_syscall_handler: cmp eax, 70 je call_sbrk + push eax + jmp call_unhandled + + done: mov ebx,eax @@ -112,6 +117,11 @@ call_exit: call syscall_exit jmp done +call_unhandled: + call syscall_unhandled + jmp done ;this should never be called, since unhandled causes kernel panic + + ;;; THIS CALLS NEED REENABLE INTERRUPTS BEFORE calling workers call_read: diff --git a/kernel/config.h b/kernel/config.h index e48c63c..ef0fa71 100644 --- a/kernel/config.h +++ b/kernel/config.h @@ -6,7 +6,7 @@ //#define FOOLOS_COMPILE_FLOPPY // compile floppy drivers #define FOOLOS_CONSOLE_AUTOBREAK // add newline automatically at end of line -#define FOOLOS_LOG_OFF // do not log anything +//#define FOOLOS_LOG_OFF // do not log anything #define FOOLOS_CONSOLE // otherwise VESA will be used! #define MEM_PRINT_MEMORYMAP #define LOG_BUF_SIZE 4069 diff --git a/kernel/syscalls.c b/kernel/syscalls.c index 1be1053..f85cfce 100644 --- a/kernel/syscalls.c +++ b/kernel/syscalls.c @@ -74,6 +74,11 @@ Elf32_Phdr; static uint32_t alloc=0x900000; +int syscall_unhandled(int nr) +{ + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"syscall: %d", nr); + panic(FOOLOS_MODULE_NAME,"unhandled syscall"); +} int syscall_write(int file, char *buf, int len) { diff --git a/kernel/syscalls.h b/kernel/syscalls.h index 6868033..00df0fa 100644 --- a/kernel/syscalls.h +++ b/kernel/syscalls.h @@ -43,7 +43,7 @@ int syscall_fstat(int file, struct stat *st,int none); int syscall_isatty(int file,int none1,int none2); int syscall_lseek(int file,int ptr,int dir); int syscall_sbrk(int incr, int none1, int none2); - +// int syscall_gettimeofday(struct timeval *tv, struct timezone *tz); int syscall_fork(void); int syscall_getpid(void); @@ -53,6 +53,8 @@ int syscall_stat(char *file, struct stat *st); int syscall_times(struct tms *buf); int syscall_unlink(char *name); int syscall_wait(int *status); +// +int syscall_unhandled(int nr); diff --git a/userspace/Makefile b/userspace/Makefile index 09486c0..7e35096 100644 --- a/userspace/Makefile +++ b/userspace/Makefile @@ -19,10 +19,6 @@ ext2.img: $(PROGS) sudo umount mnt rm mnt -rf -#shell.bin: shell.c -# ${CC} -T sys/oldlinker.ld -shell.c o shell.bin -# objcopy -O binary shell shell.bin - brainfuck: brainfuck.o shell: shell.o simple: simple.o diff --git a/userspace/sys/sys.c b/userspace/sys/sys.c index 7dcfaee..ecdf556 100644 --- a/userspace/sys/sys.c +++ b/userspace/sys/sys.c @@ -4,12 +4,12 @@ // building binutils required this stubs! + long sysconf(int name) { return 0; } - mode_t umask(mode_t mask) { return mask; -- cgit v1.2.3