]> wirehaze git hosting - BOS.git/blob - kernel/16bit/init16bit.asm

wirehaze git hosting

Now bootable
[BOS.git] / kernel / 16bit / init16bit.asm
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 init16bit:
13 call getmem ; realmode/mem.inc
14 mov [ram_amount], eax
15
16 xor eax, eax ; clear mem for IDT and GDT
17 mov edi, [idtr.address] ; 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 + 2], ax ; Prepare GDT by
24 mov [gdt.BOS_16data + 2], ax ; setting 16-bit base.
25 shr eax, 16
26 mov [gdt.BOS_16code + 4], al
27 mov [gdt.BOS_16data + 4], al
28 mov [gdt.BOS_16code + 7], ah
29 mov [gdt.BOS_16data + 7], ah
30
31 lea esi, [gdt]
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