Rev 7129 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
7129 | dunkaist | 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
||
3 | ;; 16 BIT ENTRY FROM BOOTSECTOR ;; |
||
4 | ;; ;; |
||
5 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
6 | |||
7 | include 'macros.inc' |
||
8 | include 'struct.inc' |
||
7140 | clevermous | 9 | include 'lang.inc' |
7129 | dunkaist | 10 | include 'encoding.inc' |
11 | include 'const.inc' |
||
12 | |||
13 | os_code = code_l - tmp_gdt |
||
14 | |||
15 | use16 |
||
16 | org 0x0 |
||
17 | jmp start_of_code |
||
18 | |||
19 | if lang eq sp |
||
20 | include "kernelsp.inc" ; spanish kernel messages |
||
21 | else if lang eq et |
||
22 | version db 'Kolibri OS versioon 0.7.7.0+ ',13,10,13,10,0 |
||
23 | else |
||
24 | version db 'Kolibri OS version 0.7.7.0+ ',13,10,13,10,0 |
||
25 | end if |
||
26 | |||
27 | include "boot/bootstr.inc" ; language-independent boot messages |
||
28 | include "boot/preboot.inc" |
||
29 | |||
30 | if lang eq ge |
||
31 | include "boot/bootge.inc" ; german system boot messages |
||
32 | else if lang eq sp |
||
33 | include "boot/bootsp.inc" ; spanish system boot messages |
||
34 | else if lang eq ru |
||
35 | include "boot/bootru.inc" ; russian system boot messages |
||
36 | include "boot/ru.inc" ; Russian font |
||
37 | else if lang eq et |
||
38 | include "boot/bootet.inc" ; estonian system boot messages |
||
39 | include "boot/et.inc" ; Estonian font |
||
40 | else |
||
41 | include "boot/booten.inc" ; english system boot messages |
||
42 | end if |
||
43 | |||
44 | include "boot/bootcode.inc" ; 16 bit system boot code |
||
45 | include "bus/pci/pci16.inc" |
||
46 | include "detect/biosdisk.inc" |
||
47 | |||
48 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
49 | ;; ;; |
||
50 | ;; SWITCH TO 32 BIT PROTECTED MODE ;; |
||
51 | ;; ;; |
||
52 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
53 | |||
54 | |||
55 | ; CR0 Flags - Protected mode and Paging |
||
56 | |||
57 | mov ecx, CR0_PE+CR0_AM |
||
58 | |||
59 | ; Enabling 32 bit protected mode |
||
60 | |||
61 | sidt [cs:old_ints_h] |
||
62 | |||
63 | cli ; disable all irqs |
||
64 | cld |
||
65 | mov al, 255 ; mask all irqs |
||
66 | out 0xa1, al |
||
67 | out 0x21, al |
||
68 | l.5: |
||
69 | in al, 0x64 ; Enable A20 |
||
70 | test al, 2 |
||
71 | jnz l.5 |
||
72 | mov al, 0xD1 |
||
73 | out 0x64, al |
||
74 | l.6: |
||
75 | in al, 0x64 |
||
76 | test al, 2 |
||
77 | jnz l.6 |
||
78 | mov al, 0xDF |
||
79 | out 0x60, al |
||
80 | l.7: |
||
81 | in al, 0x64 |
||
82 | test al, 2 |
||
83 | jnz l.7 |
||
84 | mov al, 0xFF |
||
85 | out 0x64, al |
||
86 | |||
87 | lgdt [cs:tmp_gdt] ; Load GDT |
||
88 | mov eax, cr0 ; protected mode |
||
89 | or eax, ecx |
||
90 | and eax, 10011111b *65536*256 + 0xffffff ; caching enabled |
||
91 | mov cr0, eax |
||
92 | jmp pword os_code:B32 ; jmp to enable 32 bit mode |
||
93 | |||
94 | align 8 |
||
95 | tmp_gdt: |
||
96 | |||
97 | dw 23 |
||
98 | dd tmp_gdt+0x10000 |
||
99 | dw 0 |
||
100 | code_l: |
||
101 | dw 0xffff |
||
102 | dw 0x0000 |
||
103 | db 0x00 |
||
104 | dw 11011111b *256 +10011010b |
||
105 | db 0x00 |
||
106 | |||
107 | dw 0xffff |
||
108 | dw 0x0000 |
||
109 | db 0x00 |
||
110 | dw 11011111b *256 +10010010b |
||
111 | db 0x00 |
||
112 | |||
113 | include "data16.inc" |
||
114 | |||
115 | if ~ lang eq sp |
||
116 | diff16 "end of bootcode",0,$+0x10000 |
||
117 | end if |
||
118 | |||
119 | use32 |
||
120 | org $+0x10000 |
||
121 | |||
122 | align 4 |
||
123 | B32: |