more userlaand stuff
This commit is contained in:
27
kernel/syscall.c
Normal file
27
kernel/syscall.c
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "lib/print.h"
|
||||
|
||||
typedef struct registers {
|
||||
uint32_t gs, fs, es, ds; // Pushed manually
|
||||
uint32_t edi, esi, ebp, esp, ebx, edx, ecx, eax; // Pushed by pusha
|
||||
uint32_t int_no, err_code; // Pushed manually
|
||||
uint32_t eip, cs, eflags, useresp, ss; // Pushed automatically by CPU
|
||||
} registers_t;
|
||||
|
||||
int32_t sys_vga_text_write(char* buf);
|
||||
|
||||
int32_t syscall(registers_t* regs) {
|
||||
switch(regs->eax) {
|
||||
case 1: {
|
||||
return sys_vga_text_write((char*)regs->ebx);
|
||||
}
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t sys_vga_text_write(char* buf) {
|
||||
kprintf(buf);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user