Browse Source

minor changes in handlers

master
Mathieu Serandour 5 months ago
parent
commit
577110f6b5
  1. 6
      kernel/int/irq.s
  2. 11
      kernel/int/isr.c

6
kernel/int/irq.s

@ -18,7 +18,7 @@ _irq_handler%1:
; save stack pointer
; save frame pointer and enter stack frame
; mov rbp, rsp
mov rbp, rsp
; save rax
push rax
@ -78,8 +78,6 @@ common_stub:
; load kernel data segment
mov di, 0x10
mov ss, di
mov ds, di
mov es, di
; put the irq handler number in dil: the
@ -87,7 +85,7 @@ common_stub:
mov dil, al
; beginning of the interrupt stack = beginning of
; the context structure
; the context structure
mov rsi, rsp

11
kernel/int/isr.c

@ -120,12 +120,17 @@ DECLARE_IRQ_HANDLER(_irq_handler46)
DECLARE_IRQ_HANDLER(_irq_handler47)
DECLARE_IRQ_HANDLER(_irq_handler48)
#include "../lib/logging.h"
static __attribute__((interrupt))
void ISR_page_fault_handler(struct IFrame* interrupt_frame,
uint64_t error_code) {
uint64_t _error_code
) {
// trick to fix the stack
volatile register uint64_t error_code = _error_code;
//*(volatile uint64_t*)(__builtin_frame_address(0) + 8) = interrupt_frame->RIP;
char buff[128];
//for(;;);
// the content of cr2 is the illegal address
sprintf(buff, "PAGE FAULT. illegal address: %16lx, error code %x\n", _cr2(), error_code);
panic_handler(buff, interrupt_frame);

Loading…
Cancel
Save