Espresso 0.0.0e
This commit is contained in:
97
isr.old.asm
Normal file
97
isr.old.asm
Normal file
@ -0,0 +1,97 @@
|
||||
|
||||
[BITS 32]
|
||||
[GLOBAL isr_stub_table]
|
||||
|
||||
section .text
|
||||
|
||||
; Common exception handler entry point
|
||||
isr_common_handler:
|
||||
pusha ; Push general-purpose registers
|
||||
push ds
|
||||
push es
|
||||
push fs
|
||||
push gs
|
||||
|
||||
; Load known-good segment selectors
|
||||
mov ax, 0x10
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
mov fs, ax
|
||||
mov gs, ax
|
||||
|
||||
; Print exception number and error code
|
||||
; You can insert direct port writes or call kernel logging function here
|
||||
; For now, just hang
|
||||
.halt:
|
||||
cli
|
||||
hlt
|
||||
jmp .halt
|
||||
|
||||
; If you want to later restore:
|
||||
pop gs
|
||||
pop fs
|
||||
pop es
|
||||
pop ds
|
||||
popa
|
||||
add esp, 8 ; clean up int_no + err_code
|
||||
iret
|
||||
|
||||
; Macro: for exceptions with error code
|
||||
%macro isr_err_stub 1
|
||||
isr_stub_%+%1:
|
||||
cli
|
||||
push dword %1 ; interrupt number
|
||||
jmp isr_common_handler
|
||||
%endmacro
|
||||
|
||||
; Macro: for exceptions without error code
|
||||
%macro isr_no_err_stub 1
|
||||
isr_stub_%+%1:
|
||||
cli
|
||||
push dword 0 ; fake error code
|
||||
push dword %1 ; interrupt number
|
||||
jmp isr_common_handler
|
||||
%endmacro
|
||||
|
||||
; Define all 32 exception stubs
|
||||
isr_no_err_stub 0
|
||||
isr_no_err_stub 1
|
||||
isr_no_err_stub 2
|
||||
isr_no_err_stub 3
|
||||
isr_no_err_stub 4
|
||||
isr_no_err_stub 5
|
||||
isr_no_err_stub 6
|
||||
isr_no_err_stub 7
|
||||
isr_err_stub 8
|
||||
isr_no_err_stub 9
|
||||
isr_err_stub 10
|
||||
isr_err_stub 11
|
||||
isr_err_stub 12
|
||||
isr_err_stub 13
|
||||
isr_err_stub 14
|
||||
isr_no_err_stub 15
|
||||
isr_no_err_stub 16
|
||||
isr_err_stub 17
|
||||
isr_no_err_stub 18
|
||||
isr_no_err_stub 19
|
||||
isr_no_err_stub 20
|
||||
isr_no_err_stub 21
|
||||
isr_no_err_stub 22
|
||||
isr_no_err_stub 23
|
||||
isr_no_err_stub 24
|
||||
isr_no_err_stub 25
|
||||
isr_no_err_stub 26
|
||||
isr_no_err_stub 27
|
||||
isr_no_err_stub 28
|
||||
isr_no_err_stub 29
|
||||
isr_err_stub 30
|
||||
isr_no_err_stub 31
|
||||
|
||||
; Create jump table
|
||||
isr_stub_table:
|
||||
%assign i 0
|
||||
%rep 32
|
||||
dd isr_stub_%+i
|
||||
%assign i i+1
|
||||
%endrep
|
||||
|
Reference in New Issue
Block a user