LibC: syscalls have now proper argument order

This commit is contained in:
Bananymous 2023-04-22 15:29:15 +03:00
parent d9068eebb5
commit 1b4c744974
1 changed files with 22 additions and 9 deletions

View File

@ -19,15 +19,28 @@ long syscall(long syscall, ...)
switch (syscall) switch (syscall)
{ {
case SYS_EXIT: case SYS_EXIT:
ret = Kernel::syscall(SYS_EXIT, va_arg(args, int)); {
break; int exit_code = va_arg(args, int);
case SYS_READ: ret = Kernel::syscall(SYS_EXIT, exit_code);
ret = Kernel::syscall(SYS_READ, va_arg(args, int), va_arg(args, void*), va_arg(args, size_t)); break;
break; }
case SYS_WRITE: case SYS_READ:
ret = Kernel::syscall(SYS_WRITE, va_arg(args, int), va_arg(args, const void*), va_arg(args, size_t)); {
break; int fd = va_arg(args, int);
void* buffer = va_arg(args, void*);
size_t bytes = va_arg(args, size_t);
ret = Kernel::syscall(SYS_READ, fd, buffer, bytes);
break;
}
case SYS_WRITE:
{
int fd = va_arg(args, int);
const char* string = va_arg(args, const char*);
size_t bytes = va_arg(args, size_t);
ret = Kernel::syscall(SYS_WRITE, fd, string, bytes);
break;
}
} }
va_end(args); va_end(args);