diff --git a/src/utils/syscall.c b/src/utils/syscall.c new file mode 100644 index 0000000..f3b14c4 --- /dev/null +++ b/src/utils/syscall.c @@ -0,0 +1,20 @@ +#include "syscall.h" +#include "gdt.h" +#include "libc/stdio.h" + +void syscall(){ + int call_number; + asm("movl %%eax, %0":"=m"(call_number)); + int user_ds=gdt_user_ds_base(); + if(call_number==1){ + int msg_addr; + asm("movl %%ebx, %0":"=m"(msg_addr)); + char *msg=(char*)user_ds+msg_addr; + print(msg); + } + else{ + print("Syscall "); + printi(call_number); + print(" unknown"); + } +} \ No newline at end of file diff --git a/src/utils/syscall.h b/src/utils/syscall.h new file mode 100644 index 0000000..26f3682 --- /dev/null +++ b/src/utils/syscall.h @@ -0,0 +1,6 @@ +#ifndef SYSCALL_H +#define SYSCALL_H + +void syscall(); + +#endif \ No newline at end of file