diff --git a/Kernel/Kernel.c b/Kernel/Kernel.c index 5f70283..5b74768 100644 --- a/Kernel/Kernel.c +++ b/Kernel/Kernel.c @@ -99,6 +99,7 @@ void PrintKernelInt(int num) { } void PrintKernelAt(const char *str, int line, int col) { + if (CurrentLine >= 25) CurrentLine = 24; char *vidptr = (char*)0xb8000; int offset = (line * 80 + col) * 2; for (int k = 0; str[k] != '\0'; k++) { diff --git a/Kernel/Syscall.c b/Kernel/Syscall.c index 70d887a..5a5756e 100644 --- a/Kernel/Syscall.c +++ b/Kernel/Syscall.c @@ -44,5 +44,5 @@ uint64_t SyscallHandler(uint64_t syscall_num, uint64_t arg1, uint64_t arg2, uint void SyscallInit(void) { // Install syscall interrupt (0x80) - IdtSetGate(0x80, (uint64_t)SyscallEntry, SYSCALL_INTERRUPT_VECTOR, IDT_INTERRUPT_GATE_KERNEL); + IdtSetGate(0x80, (uint64_t)SyscallEntry, SYSCALL_SEGMENT_SELECTOR, IDT_INTERRUPT_GATE_KERNEL); } \ No newline at end of file diff --git a/Kernel/Syscall.h b/Kernel/Syscall.h index e6a2552..9af12b5 100644 --- a/Kernel/Syscall.h +++ b/Kernel/Syscall.h @@ -8,8 +8,10 @@ #define SYS_WRITE 2 #define SYS_READ 3 #define SYS_GETPID 4 -#define SYSCALL_INTERRUPT_VECTOR 0x08 +#define SYSCALL_INTERRUPT_VECTOR 0x80 #define IDT_INTERRUPT_GATE_KERNEL 0x8E +#define SYSCALL_SEGMENT_SELECTOR 0x08 +#define MAX_SYSCALL_BUFFER_SIZE 4096 // System call handler void SyscallInit(void); uint64_t SyscallHandler(uint64_t syscall_num, uint64_t arg1, uint64_t arg2, uint64_t arg3);