-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathold_long.asm
59 lines (46 loc) · 965 Bytes
/
old_long.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
55
56
57
58
59
global long_mode_start
; STAGE3 equ 0x60000
extern start_forth
section .text
bits 64
long_mode_start:
mov ax, 0
mov ss, ax
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
; gdt64
; call forth_start
call setup_interrupt_table
; call do_test
jmp start_forth
int 49
hlt
setup_interrupt_table:
lidt [idtr]
ret
section .bss
global idt
idt:
resb 50*16
section .data
idtr:
dw 4095
dq idt
section .text
int_handler:
mov rax, 0x2F4B2F4F2F4f2F4F
mov qword [0xB8000], rax
hlt
do_test:
mov rax, int_handler
mov [idt+49*16], ax
mov word [idt+49*16+2], 0x08 ; replace 0x20 with your code section selector
mov word [idt+49*16+4], 0x8e00
shr rax, 16
mov [idt+49*16+6], ax
shr rax, 16
mov [idt+49*16+8], rax
;sti
ret