1 ; =============================================================================
2 ; Pure64 -- a 64-bit OS loader written in Assembly for x86-64 systems
3 ; Copyright (C) 2008-2011 Return Infinity -- see LICENSE.TXT
6 ; =============================================================================
9 ; -----------------------------------------------------------------------------
10 ; Default exception handler
17 ; -----------------------------------------------------------------------------
20 ; -----------------------------------------------------------------------------
21 ; Default interrupt handler
22 interrupt_gate: ; handler for all other interrupts
24 ; -----------------------------------------------------------------------------
27 ; -----------------------------------------------------------------------------
28 ; Real-time clock interrupt. IRQ 0x00, INT 0x20
31 add qword [os_Counter
], 1 ; 64-bit counter started at bootup
32 mov al, 0x20 ; Acknowledge the IRQ
35 ; -----------------------------------------------------------------------------
38 ; -----------------------------------------------------------------------------
42 jmp exception_gate_main
46 jmp exception_gate_main
50 jmp exception_gate_main
54 jmp exception_gate_main
58 jmp exception_gate_main
62 jmp exception_gate_main
66 jmp exception_gate_main
70 jmp exception_gate_main
74 jmp exception_gate_main
78 jmp exception_gate_main
82 jmp exception_gate_main
86 jmp exception_gate_main
90 jmp exception_gate_main
94 jmp exception_gate_main
98 jmp exception_gate_main
102 jmp exception_gate_main
106 jmp exception_gate_main
110 jmp exception_gate_main
114 jmp exception_gate_main
118 jmp exception_gate_main
121 call os_print_newline
124 mov rsi
, exc_string00
125 and rax
, 0xFF ; Clear out everything in RAX except for AL
127 mul bl ; AX = AL x BL
128 add rsi
, rax
; Use the value in RAX as an offset to get to the right message
130 call os_print_newline
133 exception_gate_main_hang:
135 jmp exception_gate_main_hang
; Hang. User must reset machine at this point
137 ; Strings for the error messages
138 int_string
db 'Pure64 - Interrupt ', 0
139 exc_string
db '?? - Unknown Fatal Exception!', 0
141 exc_string00
db '00 - DE', 0
142 exc_string01
db '01 - DB', 0
143 exc_string02
db '02 ', 0
144 exc_string03
db '03 - BP', 0
145 exc_string04
db '04 - OF', 0
146 exc_string05
db '05 - BR', 0
147 exc_string06
db '06 - UD', 0
148 exc_string07
db '07 - NM', 0
149 exc_string08
db '08 - DF', 0
150 exc_string09
db '09 ', 0 ; No longer generated on new CPU's
151 exc_string10
db '10 - TS', 0
152 exc_string11
db '11 - NP', 0
153 exc_string12
db '12 - SS', 0
154 exc_string13
db '13 - GP', 0
155 exc_string14
db '14 - PF', 0
156 exc_string15
db '15 ', 0
157 exc_string16
db '16 - MF', 0
158 exc_string17
db '17 - AC', 0
159 exc_string18
db '18 - MC', 0
160 exc_string19
db '19 - XM', 0
163 ; =============================================================================