compiled newlib, need to hook up the system calls

This commit is contained in:
2026-06-28 17:58:58 -05:00
parent 43bc0df81a
commit 97357f3170
337 changed files with 47955 additions and 114 deletions

View File

@@ -1,6 +1,6 @@
#include <stdint.h>
#include "lib/print.h"
#include "scheduler.h"
typedef struct registers {
uint32_t gs, fs, es, ds; // Pushed manually
@@ -9,19 +9,35 @@ typedef struct registers {
uint32_t eip, cs, eflags, useresp, ss; // Pushed automatically by CPU
} registers_t;
int32_t sys_vga_text_write(char* buf);
int32_t sys_exit();
int32_t sys_read();
int32_t sys_write();
int32_t sys_open();
int32_t sys_close();
int32_t sys_brk();
int32_t syscall(registers_t* regs) {
switch(regs->eax) {
case 1: {
return sys_vga_text_write((char*)regs->ebx);
}
case 1: return sys_exit();
case 3: return sys_read();
case 4: return sys_write();
case 5: return sys_open();
case 6: return sys_close();
case 12: return sys_brk();
default:
return -1;
}
}
int32_t sys_vga_text_write(char* buf) {
kprintf(buf);
int32_t sys_exit() {
exit();
return 0;
}
int32_t sys_read() {
return 0;
}
int32_t sys_write() {
return 0;
}