2017-11-05 07:44:57 -05:00
|
|
|
#include "interrupt.h"
|
2017-11-05 04:50:04 -05:00
|
|
|
|
2017-11-09 11:00:36 -05:00
|
|
|
#include "syscall.h"
|
2017-11-05 12:15:34 -05:00
|
|
|
|
2020-12-05 22:04:34 -05:00
|
|
|
#include <kernaux/console.h>
|
|
|
|
|
2017-11-05 12:15:34 -05:00
|
|
|
static void syscall_do_exit(struct IsrRegisters regs);
|
|
|
|
|
|
|
|
void syscall_handler(const struct IsrRegisters regs)
|
2017-11-05 04:50:04 -05:00
|
|
|
{
|
2020-11-25 03:14:21 -05:00
|
|
|
const unsigned int id = regs.eax << 16 >> 16;
|
|
|
|
|
2020-12-05 22:04:34 -05:00
|
|
|
kernaux_console_printf("[INFO] syscall: number %u\n", id);
|
2017-11-05 04:50:04 -05:00
|
|
|
|
2017-11-05 12:15:34 -05:00
|
|
|
switch (id) {
|
|
|
|
case KERNELMQ_SYSCALL_EXIT: return syscall_do_exit(regs);
|
|
|
|
}
|
2017-11-05 04:50:04 -05:00
|
|
|
}
|
2017-11-05 12:15:34 -05:00
|
|
|
|
|
|
|
void syscall_do_exit(const struct IsrRegisters regs)
|
|
|
|
{
|
2020-11-25 03:14:21 -05:00
|
|
|
const unsigned int exit_code = regs.ebx << 16 >> 16;
|
|
|
|
|
2020-12-05 22:04:34 -05:00
|
|
|
kernaux_console_printf("[WARN] syscall: process try to exit with error code %u, haha\n", exit_code);
|
2017-11-05 12:15:34 -05:00
|
|
|
}
|