27 lines
704 B
C
27 lines
704 B
C
|
|
#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;
|
||
|
|
}
|