fix elf stack issues and interrupt gsbase stuff

This commit is contained in:
Matheus
2022-08-16 19:12:16 -03:00
parent 432e85b837
commit 7a540ca1e1
9 changed files with 37 additions and 13 deletions
+14 -5
View File
@@ -20,7 +20,15 @@ section .text
push rbx
push rax
mov rax, ds
cmp rax,0x43
je .noswapgs
swapgs
.noswapgs:
push rax
mov rax, es
push rax
@@ -28,12 +36,13 @@ section .text
push rax
mov rax, gs
push rax
; now use kernel segments for data
cmp rax,0x43
jmp .noswapgs
swapgs
.noswapgs:
mov rax, 0x30
mov ds, rax
mov es, rax
mov ss, rax
mov rdi,cr2
push rdi
+1 -1
View File
@@ -34,7 +34,7 @@ __attribute((noreturn)) void _panic(char* reason, arch_regs *reg){
printf("Panic location: %p\n", reg->rip);
if(reg->rbp != 0){
if(reg->rbp != 0 && reg->cs == 0x28){
printf("Stack trace:\n");
tracestack((uint64_t**)reg->rbp);
}