interrupts, timer, keyboard, segments, lots of kernel code
[bootcensus] / src / vbioshack.s
1         .text
2
3         .align 4
4         .short 0
5 saved_idtr:
6 idtlim: .short 0
7 idtaddr:.long 0
8
9         .short 0
10 saved_gdtr:
11 gdtlim: .short 0
12 gdtaddr:.long 0
13
14         .short 0
15 rmidt:  .short 0x3ff
16         .long 0
17
18         # drop back to real mode to set video mode hack
19         .global set_mode13h
20 set_mode13h:
21         cli
22         #sgdt (saved_gdtr)
23         sidt (saved_idtr)
24         lidt (rmidt)
25
26         mov %cr0, %eax
27         and $0xfffe, %ax
28         mov %eax, %cr0
29         jmp 0f
30
31 0:      xor %ax, %ax
32         mov %ax, %ds
33         mov %ax, %es
34         mov %ax, %ss
35
36         #mov $0x13, %ax
37         #int $0x10
38
39         mov %cr0, %eax
40         or $1, %ax
41         mov %eax, %cr0
42         jmp 0f
43
44 0:      mov $0x10, %ax
45         mov %ax, %ds
46         mov %ax, %es
47         mov %ax, %ss
48
49         sidt (saved_idtr)
50         sti
51         ret