From 1530a85d5aefcf6497ff2129023e9a0b002603dd Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Tue, 4 May 2021 15:30:24 +0200 Subject: Solving many issues: Aligning kernel stack, improve syscall mechanism, DISABLING RED-ZONE !!!! --- src/core/int.S | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'src/core/int.S') diff --git a/src/core/int.S b/src/core/int.S index c8612dc..c552212 100644 --- a/src/core/int.S +++ b/src/core/int.S @@ -26,18 +26,29 @@ push %rbp push %rsi push %rdi - mov %ds, %rax + xor %rax,%rax # Because I am picky + mov %gs, %rax + push %rax + mov %es, %rax push %rax - mov 56(%rsp), %rax # Restore %rax + mov %fs, %rax + push %rax + mov %ds, %rax push %rax mov $0x10, %ax mov %ax, %ds - pop %rax + mov 80(%rsp), %rax .endm .macro RESTORE_REGS pop %rax - mov %rax,%ds + mov %ax, %ds + pop %rax + mov %ax, %fs + pop %rax + mov %ax, %es + pop %rax + mov %ax, %gs pop %rdi pop %rsi pop %rbp @@ -77,6 +88,7 @@ INT_10: .globl INT_14 INT_14: + pop %rsi CALL_PRINTK $MSG_INT_14 INT_14_INFINITE: jmp INT_14_INFINITE @@ -113,7 +125,7 @@ MSG_INT_0: MSG_INT_10: .asciz "Invalid TSS!" MSG_INT_14: -.asciz "Page fault!" +.asciz "Page fault: error %x !" MSG_INT_KBD: .asciz "Key press!" MSG: -- cgit v1.2.3