1
0
mirror of https://gitlab.os-k.eu/os-k-team/os-k.git synced 2023-08-25 14:03:10 +02:00

Syscalls : print & flush

This commit is contained in:
Adrien Bourmault 2021-03-09 11:50:16 +01:00
parent f1231af040
commit a013855e73
Signed by: neox
GPG Key ID: 6EB408FE0ACEC664

View File

@ -60,36 +60,24 @@ static error_t syscallStub(void *rdi, void *rsi, void *rdx, void *rcx, ISRFrame_
return ENOSYS;
}
static error_t syscallRead(void *descriptor, void *address, void *flags, void *rcx, ISRFrame_t *regs)
static error_t syscallPrint(void *id, void *string, void *rdx, void *rcx, ISRFrame_t *regs)
{
return ENOSYS;
Buffer_t *buf = NULL;
if (*(ulong*)id == 0) {
buf = BStdOut;
}
return BPrintOnBuf(buf, (char*)string);
}
static error_t syscallWrite(void *descriptor, void *address, void *flags, void *rcx, ISRFrame_t *regs)
static error_t syscallFlush(void *id, void *rdi, void *rdx, void *rcx, ISRFrame_t *regs)
{
return ENOSYS;
}
static error_t syscallOpen(void *descriptor, void *address, void *size, void *rcx, ISRFrame_t *regs)
{
/* TODO
- lock the zone
- check if permitted
- modify descriptor according to what has been done
- return */
return ENOSYS;
}
static error_t syscallClose(void *descriptor, void *address, void *flags, void *rcx, ISRFrame_t *regs)
{
/* TODO
- lock the zone
- check if permitted using descriptor
- use flags to know what to do
- return */
return ENOSYS;
Buffer_t *buf = NULL;
if (*(ulong*)id == 0) {
buf = BStdOut;
}
return BFlushBuf(buf);
}
static error_t syscallKernelShell(void *rdi, void *rsi, void *rdx, void *rcx, ISRFrame_t *regs)
@ -105,10 +93,10 @@ static error_t syscallKernelShell(void *rdi, void *rsi, void *rdx, void *rcx, IS
//
void KeEnableSyscalls()
{
syscallTable[0] = syscallRead;
syscallTable[1] = syscallWrite;
syscallTable[2] = syscallOpen;
syscallTable[3] = syscallClose;
syscallTable[0] = syscallPrint;
syscallTable[1] = syscallFlush;
syscallTable[2] = syscallStub;
syscallTable[3] = syscallStub;
syscallTable[4] = syscallKernelShell;
syscallTable[5] = syscallStub;
}