]> wirehaze git hosting - BOS.git/blob - kernel/realmode/do_all_16bit.inc

wirehaze git hosting

Merge commit 'dba047e616f303ce818ba9ac7fb9f8a18a3717d3'
[BOS.git] / kernel / realmode / do_all_16bit.inc
1 ;----------------------------------------------------------;
2 ; BOS kernel Christoffer Bubach, 2005. ;
3 ;----------------------------------------------------------;
4 ; ;
5 ; Do everything related to 16-bit here... :) ;
6 ; ;
7 ;----------------------------------------------------------;
8
9 ;---------------------;
10 ; save info ;
11 ;---------------------;
12 do_all_16bit:
13 call getmem ; realmode/mem.inc
14 mov [ram_amount - 0x10000], eax
15
16 xor eax, eax ; clear mem for IDT and GDT
17 mov edi, 0x6c00 ; IDT address
18 mov ecx, (0x800 + 0x800)/4
19 rep stosd
20
21 mov eax, cs
22 shl eax, 4
23 mov [gdt.BOS_16code - 0x10000 + 2], ax ; Prepare GDT by
24 mov [gdt.BOS_16data - 0x10000 + 2], ax ; setting 16-bit base.
25 shr eax, 16
26 mov [gdt.BOS_16code - 0x10000 + 4], al
27 mov [gdt.BOS_16data - 0x10000 + 4], al
28 mov [gdt.BOS_16code - 0x10000 + 7], ah
29 mov [gdt.BOS_16data - 0x10000 + 7], ah
30
31 lea esi, [gdt - 0x10000]
32 mov edi, 0x7400 ; GDT address
33 mov ecx, (gdt_end - gdt)/4
34 rep movsd ; Move it to final pos.
35
36 push dword 0 ; clear NT bit
37 popfd
38 ret