mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-02 07:28:21 +00:00
Unify the arch_regs structs
I was doing something stupid and keeping a separate version for the cpu registers. oh well, I fixed it now
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
typedef struct{
|
typedef struct{
|
||||||
gdt_t gdt;
|
gdt_t gdt;
|
||||||
ist_t ist;
|
ist_t ist;
|
||||||
arch_regserror *laststate;
|
arch_regs *laststate;
|
||||||
vmm_context *context;
|
vmm_context *context;
|
||||||
} cls_t;
|
} cls_t;
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
#include <arch/regs.h>
|
#include <arch/regs.h>
|
||||||
|
|
||||||
extern void asmisr_general(arch_regsnoerror*);
|
extern void asmisr_general(arch_regs*);
|
||||||
extern void asmisr_except(arch_regserror*);
|
extern void asmisr_except(arch_regs*);
|
||||||
extern void asmisr_pagefault(arch_regserror*);
|
extern void asmisr_pagefault(arch_regs*);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
|
|
||||||
#include <arch/regs.h>
|
#include <arch/regs.h>
|
||||||
|
|
||||||
__attribute__((noreturn)) void _panic(char *reason, arch_regserror *reg);
|
__attribute__((noreturn)) void _panic(char *reason, arch_regs *reg);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -5,11 +5,7 @@
|
|||||||
|
|
||||||
typedef struct{
|
typedef struct{
|
||||||
uint64_t cr2,gs,fs,es,ds,rax,rbx,rcx,rdx,r8,r9,r10,r11,r12,r13,r14,r15,rdi,rsi,rbp,error,rip,cs,rflags,rsp,ss;
|
uint64_t cr2,gs,fs,es,ds,rax,rbx,rcx,rdx,r8,r9,r10,r11,r12,r13,r14,r15,rdi,rsi,rbp,error,rip,cs,rflags,rsp,ss;
|
||||||
} arch_regserror;
|
} arch_regs;
|
||||||
|
|
||||||
typedef struct{
|
|
||||||
uint64_t cr2,gs,fs,es,ds,rax,rbx,rcx,rdx,r8,r9,r10,r11,r12,r13,r14,r15,rdi,rsi,rbp,rip,cs,rflags,rsp,ss;
|
|
||||||
} arch_regsnoerror;
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -84,6 +84,8 @@ section .text
|
|||||||
global %1
|
global %1
|
||||||
%1:
|
%1:
|
||||||
|
|
||||||
|
push qword 0 ; error code for regs struct
|
||||||
|
|
||||||
pushregs
|
pushregs
|
||||||
|
|
||||||
mov rdi,rsp
|
mov rdi,rsp
|
||||||
@@ -94,6 +96,8 @@ section .text
|
|||||||
|
|
||||||
popregs
|
popregs
|
||||||
|
|
||||||
|
add rsp,8 ; remove error code
|
||||||
|
|
||||||
iretq
|
iretq
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,17 +2,17 @@
|
|||||||
#include <arch/panic.h>
|
#include <arch/panic.h>
|
||||||
#include <kernel/vmm.h>
|
#include <kernel/vmm.h>
|
||||||
|
|
||||||
void isr_general(arch_regsnoerror *reg){
|
void isr_general(arch_regs *reg){
|
||||||
_panic("Unhandled interrupt", 0);
|
_panic("Unhandled interrupt", 0);
|
||||||
asm("hlt");
|
asm("hlt");
|
||||||
}
|
}
|
||||||
|
|
||||||
void isr_except(arch_regserror *reg){
|
void isr_except(arch_regs *reg){
|
||||||
_panic("CPU Exception", reg);
|
_panic("CPU Exception", reg);
|
||||||
asm("hlt;");
|
asm("hlt;");
|
||||||
}
|
}
|
||||||
|
|
||||||
void isr_pagefault(arch_regserror *reg){
|
void isr_pagefault(arch_regs *reg){
|
||||||
|
|
||||||
if(!vmm_dealwithrequest(reg->cr2))
|
if(!vmm_dealwithrequest(reg->cr2))
|
||||||
_panic("Page fault!\n", 0);
|
_panic("Page fault!\n", 0);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ static void tracestack(uint64_t** addr){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute((noreturn)) void _panic(char* reason, arch_regserror *reg){
|
__attribute((noreturn)) void _panic(char* reason, arch_regs *reg){
|
||||||
|
|
||||||
printf("PANIC: %s.\n", reason);
|
printf("PANIC: %s.\n", reason);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user