Add syscall sources
This commit is contained in:
parent
242fe4a575
commit
3212145e94
2 changed files with 26 additions and 0 deletions
20
src/utils/syscall.c
Normal file
20
src/utils/syscall.c
Normal file
|
@ -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");
|
||||
}
|
||||
}
|
6
src/utils/syscall.h
Normal file
6
src/utils/syscall.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
#ifndef SYSCALL_H
|
||||
#define SYSCALL_H
|
||||
|
||||
void syscall();
|
||||
|
||||
#endif
|
Loading…
Add table
Reference in a new issue