]> Joshua Wise's Git repositories - netwatch.git/blame_incremental - aseg/aseg.asm
Add Makefile
[netwatch.git] / aseg / aseg.asm
... / ...
CommitLineData
1 org 0x0
2[bits 16]
3entry:
4; mov al, 0x01 ; Say where we are.
5; out 0x80, al
6 mov ax, 0xA800
7 mov ds, ax ; Take us out of flat unreal mode, and
8 mov es, ax ; put us in true real mode.
9 mov fs, ax
10 mov gs, ax
11 mov ss, ax
12 jmp 0xA800:entry2 ; Long jump to a correct cs.
13entry2:
14; mov al, 0x02
15; out 0x80, al
16 lgdt [gdtr] ; Set up a new GDT.
17 mov eax, 0x1
18 mov cr0, eax ; ... and enter pmode!
19 mov al, 0x03 ; Say we got here.
20 out 0x80, al
21 jmp long 0x10:(continue+0xA8000) ; Now longjmp into the new code.
22[bits 32]
23continue:
24; mov al, 0x04 ; Now we're in protected mode.
25; out 0x80, al
26
27 mov ax, 0x08 ; Set up segment selectors.
28 mov ds, ax
29 mov es, ax
30 mov fs, ax
31 mov gs, ax
32 mov ss, ax
33 mov esp, 0x1fffffff
34
35; mov al, 0x05
36; out 0x80, al
37
38 mov al, [(cstat + 0xA8000)]
39 add al, 1
40 out 0x80, al
41 mov [(cstat + 0xA8000)], al
42
43 mov eax, 0x11223344
44 mov dword [(status + 0xA8000)], eax
45
46 mov dx, 0xCF8 ; save off the old config value
47 in dword eax, dx
48 mov [esp-4], eax
49
50 mov eax, 0x80000070 ; load in smramc
51 out dx, eax
52 mov dx, 0xCFC
53 in byte al, dx
54 mov [esp-5], al
55 and al, 0xF3 ; Allow graphics access
56 or al, 0x08
57 out dx, al
58
59 xor eax, eax
60 mov dx, 0x3D4
61 in byte al, dx
62 mov [esp-6], al ; save off the old VGA command
63 mov al, 0xC
64 out dx, al
65 inc dx
66 in al, dx
67 mov ah, al
68 dec dx
69 mov al, 0xD
70 out dx, al
71 inc dx
72 in al, dx
73 shl eax, 1
74 add eax, 0xB8000 ; yay
75 mov byte [eax+0], '1'
76 mov byte [eax+1], 0xA0
77 mov byte [eax+2], '5'
78 mov byte [eax+3], 0xA0
79 mov byte [eax+4], '-'
80 mov byte [eax+5], 0xA0
81 mov byte [eax+6], '4'
82 mov byte [eax+7], 0xA0
83 mov byte [eax+8], '1'
84 mov byte [eax+9], 0xA0
85 mov byte [eax+10], '2'
86 mov byte [eax+11], 0xA0
87
88 mov dx, 0x3D4
89 mov al, [esp-6]
90 out dx, al
91
92
93 mov dx, 0xCFC ; restore smramc
94 mov al, [esp-5]
95 out dx, al
96
97 mov dx, 0xCF8 ; restore the old config value
98 mov eax, [esp-4]
99 out dx, eax
100
101 mov al, 0x40 ; ack the periodic IRQ
102 mov dx, 0x834
103 out dx, al
104
105 mov dx, 0x830
106 in al, dx
107 or al, 0x02 ; now ack the SMI itself
108 and al, 0xBF
109 out dx, al
110 or al, 0x40
111 out dx, al
112
113 rsm ; and leave SMM
114
115 align 0x4
116gdtr:
117 db 0x27, 0x00
118 dd (gdt + 0xA8000)
119 align 0x4
120gdt:
121 db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
122 db 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x93, 0xCF, 0x00 ; data segment
123 db 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x9B, 0xCF, 0x00 ; code segment
124 db 0xFF, 0xFF, 0x00, 0x80, 0x0A, 0x9B, 0xCF, 0x00 ; code segment for trampoline
125
126TIMES 512-($-$$) DB 0
127status:
128 dd 0xAA55AA55
129cstat:
130 db 0x00
This page took 0.023157 seconds and 4 git commands to generate.