-
Notifications
You must be signed in to change notification settings - Fork 1
/
panic.asm
54 lines (47 loc) · 765 Bytes
/
panic.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
use32
global panic
global symtable
global get_symtable_addr
extern kprintf
extern panic_backtrace_step
section .text
panic:
push ss
push ds
push cs
push ebx
push edx
push ecx
push eax
push dword [esp+(8*4)]
push .msg
call kprintf
add esp, 9*4
push ebp
mov ebp, esp
.lp:
mov esp, ebp
pop ebp
pop ebx
mov [.tmp], ebx
push ebx
call panic_backtrace_step
add esp, 4
mov eax, [.tmp]
cmp eax, 0
jne .lp
cli
hlt
.tmp dd 0
.msg db 10, "Kernel Panic - %s", 10, "EAX: %x ECX: %x EDX: %x EBX: %x CS: %x DS: %x SS: %x", 10, 0
get_symtable_addr:
mov eax, symtable
ret
section .data
symtable:
; magic markers
dd 0xffffffff
dd 0xdeadbeef
dd 0xbadf00de
dd 0xffffffff
times 65536 db 0 ; reserve 64KiB for the symbol table