diff --git a/include/kernel/ke/syscall.h b/include/kernel/ke/syscall.h index 2cfc0b5..3b3b42d 100644 --- a/include/kernel/ke/syscall.h +++ b/include/kernel/ke/syscall.h @@ -31,7 +31,7 @@ //----------------------------------------------------------------------------// -#define LATEST_SYSCALL_CODE 0 +#define LATEST_SYSCALL_CODE 3 //----------------------------------------------------------------------------// diff --git a/kaleid/kernel/ke/syscall.c b/kaleid/kernel/ke/syscall.c index ebb2ef0..6dcc7cd 100644 --- a/kaleid/kernel/ke/syscall.c +++ b/kaleid/kernel/ke/syscall.c @@ -27,6 +27,7 @@ #include #include #include +#include static error_t (*syscallTable[255])(void*, void*, void*, ISRFrame_t*) = {NULL}; @@ -46,23 +47,37 @@ error_t _KeSyscallHandler( ulong code, void *rdi, void *rsi, void *rdx, } if (code > LATEST_SYSCALL_CODE) { - return EINVAL; + return ENOSYS; } - return syscallTable[(uchar)code](rdi, rsi, rdx, regs); - - return EOK; + return syscallTable[(uchar)code](rdi, rsi, rdx, regs); } // // Syscalls // -static error_t syscallRead(void *rdi, void *rsi, void *rdx, ISRFrame_t *regs) +static error_t syscallStub(void *rdi, void *rsi, void *rdx, ISRFrame_t *regs) { - DebugLog("syscallRead attempted\n"); - return EOK; + return ENOSYS; } +static error_t syscallRead(void *rdi, void *rsi, void *rdx, ISRFrame_t *regs) +{ + return ENOSYS; +} + +static error_t syscallWrite(void *rdi, void *rsi, void *rdx, ISRFrame_t *regs) +{ + return ENOSYS; +} + +static error_t syscallKernelShell(void *rdi, void *rsi, void *rdx, ISRFrame_t *regs) +{ + KeEnableIRQs(); + ShStartShell(); //TODO : return from Shell + KePauseIRQs(); + return EOK; +} // // Initializes the syscall table @@ -70,4 +85,8 @@ static error_t syscallRead(void *rdi, void *rsi, void *rdx, ISRFrame_t *regs) void KeEnableSyscalls() { syscallTable[0] = syscallRead; + syscallTable[1] = syscallWrite; + syscallTable[2] = syscallStub; + syscallTable[3] = syscallStub; + syscallTable[4] = syscallKernelShell; } diff --git a/kaleid/user/test/test.asm b/kaleid/user/test/test.asm index 7a72c5f..d90572e 100644 --- a/kaleid/user/test/test.asm +++ b/kaleid/user/test/test.asm @@ -28,7 +28,7 @@ global UserTest global EndOfUser UserTest: - mov rdi, 45 + mov rdi, 4 int 0x80 .clone: