mirror of
https://github.com/tailix/kernel.git
synced 2024-11-20 11:16:10 -05:00
Start implementing syscalls
This commit is contained in:
parent
1afdbaa6fe
commit
5b3974c93f
3 changed files with 34 additions and 4 deletions
|
@ -1,9 +1,22 @@
|
|||
#include "interrupt.h"
|
||||
#include "kprintf.h"
|
||||
|
||||
void syscall_handler(struct IsrRegisters regs)
|
||||
#include <kernelmq/syscall.h>
|
||||
|
||||
static void syscall_do_exit(struct IsrRegisters regs);
|
||||
|
||||
void syscall_handler(const struct IsrRegisters regs)
|
||||
{
|
||||
const unsigned int id = regs.eax & 0xFFFF;
|
||||
|
||||
switch (id) {
|
||||
case KERNELMQ_SYSCALL_EXIT: return syscall_do_exit(regs);
|
||||
}
|
||||
|
||||
kprintf("syscall %u\n", id);
|
||||
}
|
||||
|
||||
void syscall_do_exit(const struct IsrRegisters regs)
|
||||
{
|
||||
kprintf("process try to exit with error code %u, haha\n", regs.ebx & 0xFFFF);
|
||||
}
|
||||
|
|
16
include/kernelmq/syscall.h
Normal file
16
include/kernelmq/syscall.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
#ifndef KERNELMQ_INCLUDED_SYSCALL
|
||||
#define KERNELMQ_INCLUDED_SYSCALL 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum KernelMQ_Syscall_Number {
|
||||
KERNELMQ_SYSCALL_EXIT = 0,
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,11 +1,12 @@
|
|||
main:
|
||||
mov eax, 0
|
||||
int 0x80
|
||||
|
||||
mov eax, 512
|
||||
int 0x80
|
||||
|
||||
mov eax, 35000
|
||||
int 0x80
|
||||
|
||||
mov eax, 0 ; exit
|
||||
mov ebx, 0 ; error code
|
||||
int 0x80
|
||||
|
||||
ret
|
||||
|
|
Loading…
Reference in a new issue