Pushing more registers
This commit is contained in:
parent
7a663b224f
commit
1213055aff
|
@ -111,7 +111,7 @@ struct CpuInfo_t
|
||||||
|
|
||||||
struct ISRFrame_t {
|
struct ISRFrame_t {
|
||||||
/* The register file */
|
/* The register file */
|
||||||
ulong regs[15];
|
ulong regs[20];
|
||||||
|
|
||||||
/* The error code and interrupt id */
|
/* The error code and interrupt id */
|
||||||
ulong intNo;
|
ulong intNo;
|
||||||
|
|
|
@ -24,5 +24,14 @@
|
||||||
|
|
||||||
[BITS 64]
|
[BITS 64]
|
||||||
|
|
||||||
|
global divideByZero
|
||||||
|
|
||||||
%include "kaleid/kernel/ke/cpuf.inc"
|
%include "kaleid/kernel/ke/cpuf.inc"
|
||||||
|
|
||||||
|
;;
|
||||||
|
;; Bug test
|
||||||
|
;;
|
||||||
|
divideByZero:
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -283,7 +283,9 @@ static void EarlyExceptionHandler(ISRFrame_t *regs)
|
||||||
" RDI: %#016lx RBP: %#016lx R8: %#016lx\n"
|
" RDI: %#016lx RBP: %#016lx R8: %#016lx\n"
|
||||||
" R9: %#016lx R10: %#016lx R11: %#016lx\n"
|
" R9: %#016lx R10: %#016lx R11: %#016lx\n"
|
||||||
" R12: %#016lx R13: %#016lx R14: %#016lx\n"
|
" R12: %#016lx R13: %#016lx R14: %#016lx\n"
|
||||||
" R15: %#016lx RFLAGS: %#022b (%#06x)",
|
" R15: %#016lx CR0: %#016lx CR2: %#016lx\n"
|
||||||
|
" CR3: %#016lx CR4: %#016lx CR8: %#016lx\n"
|
||||||
|
" RFLAGS: %#022b (%#06x)",
|
||||||
regs->intNo,
|
regs->intNo,
|
||||||
ExceptionsChar[regs->intNo],
|
ExceptionsChar[regs->intNo],
|
||||||
regs->ErrorCode,
|
regs->ErrorCode,
|
||||||
|
@ -292,11 +294,6 @@ static void EarlyExceptionHandler(ISRFrame_t *regs)
|
||||||
regs->cs,
|
regs->cs,
|
||||||
regs->rsp,
|
regs->rsp,
|
||||||
regs->ss,
|
regs->ss,
|
||||||
regs->regs[0],
|
|
||||||
regs->regs[1],
|
|
||||||
regs->regs[2],
|
|
||||||
regs->regs[3],
|
|
||||||
regs->regs[4],
|
|
||||||
regs->regs[5],
|
regs->regs[5],
|
||||||
regs->regs[6],
|
regs->regs[6],
|
||||||
regs->regs[7],
|
regs->regs[7],
|
||||||
|
@ -307,6 +304,16 @@ static void EarlyExceptionHandler(ISRFrame_t *regs)
|
||||||
regs->regs[12],
|
regs->regs[12],
|
||||||
regs->regs[13],
|
regs->regs[13],
|
||||||
regs->regs[14],
|
regs->regs[14],
|
||||||
|
regs->regs[15],
|
||||||
|
regs->regs[16],
|
||||||
|
regs->regs[17],
|
||||||
|
regs->regs[18],
|
||||||
|
regs->regs[19],
|
||||||
|
regs->regs[0],
|
||||||
|
regs->regs[1],
|
||||||
|
regs->regs[2],
|
||||||
|
regs->regs[3],
|
||||||
|
regs->regs[4],
|
||||||
regs->rflags,
|
regs->rflags,
|
||||||
regs->rflags
|
regs->rflags
|
||||||
);
|
);
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
%include "kaleid/kernel/ke/cpuf.inc"
|
%include "kaleid/kernel/ke/cpuf.inc"
|
||||||
|
|
||||||
global KeLoadIDT
|
global KeLoadIDT
|
||||||
global divideByZero
|
|
||||||
|
|
||||||
extern _KeIdtPtr
|
extern _KeIdtPtr
|
||||||
extern _KeHandleISR
|
extern _KeHandleISR
|
||||||
|
@ -39,17 +38,21 @@ KeLoadIDT:
|
||||||
lidt [_KeIdtPtr]
|
lidt [_KeIdtPtr]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;;
|
|
||||||
;; Bug test
|
|
||||||
;;
|
|
||||||
divideByZero:
|
|
||||||
ret
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; ISR Exception pre-handler
|
;; ISR Exception pre-handler
|
||||||
;;
|
;;
|
||||||
isrPreHandler:
|
isrPreHandler:
|
||||||
pushAll
|
pushAll
|
||||||
|
mov rax, cr8
|
||||||
|
push rax
|
||||||
|
mov rax, cr4
|
||||||
|
push rax
|
||||||
|
mov rax, cr3
|
||||||
|
push rax
|
||||||
|
mov rax, cr2
|
||||||
|
push rax
|
||||||
|
mov rax, cr0
|
||||||
|
push rax
|
||||||
|
|
||||||
; Check if we are switching from user mode to supervisor mode
|
; Check if we are switching from user mode to supervisor mode
|
||||||
mov rax, [rsp + 152]
|
mov rax, [rsp + 152]
|
||||||
|
@ -80,7 +83,10 @@ isrPreHandler:
|
||||||
swapgs ; XXX need TSS
|
swapgs ; XXX need TSS
|
||||||
|
|
||||||
.SExit:
|
.SExit:
|
||||||
|
; pop the control registers
|
||||||
|
add rsp, 40
|
||||||
popAll
|
popAll
|
||||||
|
|
||||||
; pop the error code and interrupt id
|
; pop the error code and interrupt id
|
||||||
add rsp, 16
|
add rsp, 16
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue