Pushing more registers

This commit is contained in:
Adrien Bourmault 2019-05-18 00:03:35 +02:00
parent 7a663b224f
commit 1213055aff
4 changed files with 36 additions and 14 deletions

View File

@ -111,7 +111,7 @@ struct CpuInfo_t
struct ISRFrame_t {
/* The register file */
ulong regs[15];
ulong regs[20];
/* The error code and interrupt id */
ulong intNo;

View File

@ -24,5 +24,14 @@
[BITS 64]
global divideByZero
%include "kaleid/kernel/ke/cpuf.inc"
;;
;; Bug test
;;
divideByZero:
ret

View File

@ -283,7 +283,9 @@ static void EarlyExceptionHandler(ISRFrame_t *regs)
" RDI: %#016lx RBP: %#016lx R8: %#016lx\n"
" R9: %#016lx R10: %#016lx R11: %#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,
ExceptionsChar[regs->intNo],
regs->ErrorCode,
@ -292,11 +294,6 @@ static void EarlyExceptionHandler(ISRFrame_t *regs)
regs->cs,
regs->rsp,
regs->ss,
regs->regs[0],
regs->regs[1],
regs->regs[2],
regs->regs[3],
regs->regs[4],
regs->regs[5],
regs->regs[6],
regs->regs[7],
@ -307,6 +304,16 @@ static void EarlyExceptionHandler(ISRFrame_t *regs)
regs->regs[12],
regs->regs[13],
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
);

View File

@ -27,7 +27,6 @@
%include "kaleid/kernel/ke/cpuf.inc"
global KeLoadIDT
global divideByZero
extern _KeIdtPtr
extern _KeHandleISR
@ -39,17 +38,21 @@ KeLoadIDT:
lidt [_KeIdtPtr]
ret
;;
;; Bug test
;;
divideByZero:
ret
;;
;; ISR Exception pre-handler
;;
isrPreHandler:
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
mov rax, [rsp + 152]
@ -80,7 +83,10 @@ isrPreHandler:
swapgs ; XXX need TSS
.SExit:
; pop the control registers
add rsp, 40
popAll
; pop the error code and interrupt id
add rsp, 16