mirror of
https://gitlab.os-k.eu/os-k-team/os-k.git
synced 2023-08-25 14:03:10 +02:00
Kernel shell as a syscall
This commit is contained in:
parent
c6e568990f
commit
bb5a743ed4
@ -31,7 +31,7 @@
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#define LATEST_SYSCALL_CODE 0
|
||||
#define LATEST_SYSCALL_CODE 3
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <ke/idt.h>
|
||||
#include <ke/syscall.h>
|
||||
#include <io/vga.h>
|
||||
#include <sh/shell.h>
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ global UserTest
|
||||
global EndOfUser
|
||||
|
||||
UserTest:
|
||||
mov rdi, 45
|
||||
mov rdi, 4
|
||||
int 0x80
|
||||
|
||||
.clone:
|
||||
|
Loading…
Reference in New Issue
Block a user