Rev 855 | Rev 864 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 855 | Rev 863 | ||
---|---|---|---|
1 | format MS COFF |
1 | format MS COFF |
2 | 2 | ||
3 | 3 | ||
4 | include '../macros.inc' |
4 | include '../macros.inc' |
5 | 5 | ||
6 | $Revision: 849 $ |
6 | $Revision: 849 $ |
7 | 7 | ||
8 | __REV__ = __REV |
8 | __REV__ = __REV |
9 | 9 | ||
10 | include "../proc32.inc" |
10 | include "../proc32.inc" |
11 | include "../kglobals.inc" |
11 | include "../kglobals.inc" |
12 | include "../lang.inc" |
12 | include "../lang.inc" |
13 | 13 | ||
14 | CR0_PE equ 0x00000001 ;protected mode |
14 | CR0_PE equ 0x00000001 ;protected mode |
15 | CR0_WP equ 0x00010000 ;write protect |
15 | CR0_WP equ 0x00010000 ;write protect |
16 | CR0_PG equ 0x80000000 ;paging |
16 | CR0_PG equ 0x80000000 ;paging |
17 | 17 | ||
18 | public _16bit_start |
18 | public _16bit_start |
19 | public _16bit_end |
19 | public _16bit_end |
20 | 20 | ||
21 | public _enter_bootscreen |
21 | public _enter_bootscreen |
22 | 22 | public _poweroff |
|
- | 23 | ||
23 | public _bx_from_load |
24 | public _bx_from_load |
24 | 25 | ||
25 | extrn __setvars |
26 | extrn __setvars |
26 | 27 | ||
27 | section '.boot' code readable align 16 |
28 | section '.boot' code readable align 16 |
28 | 29 | ||
29 | _16bit_start: |
30 | _16bit_start: |
30 | 31 | ||
31 | org 0 |
32 | org 0 |
32 | 33 | ||
33 | use16 |
34 | use16 |
34 | 35 | ||
35 | _enter_bootscreen: |
36 | _enter_bootscreen: |
36 | 37 | ||
37 | mov eax, cr0 |
38 | mov eax, cr0 |
38 | and eax, not 0x80000001 |
39 | and eax, not 0x80000001 |
39 | mov cr0, eax |
40 | mov cr0, eax |
40 | jmp far 0x1000:start_of_code |
41 | jmp far 0x1000:start_of_code |
41 | 42 | ||
42 | version db 'Kolibri OS version 0.7.1.0 ',13,10,13,10,0 |
43 | version db 'Kolibri OS version 0.7.1.0 ',13,10,13,10,0 |
43 | 44 | ||
44 | include "bootstr.inc" ; language-independent boot messages |
45 | include "bootstr.inc" ; language-independent boot messages |
45 | include "preboot.inc" |
46 | include "preboot.inc" |
46 | 47 | ||
47 | if lang eq en |
48 | if lang eq en |
48 | include "booteng.inc" ; english system boot messages |
49 | include "booteng.inc" ; english system boot messages |
49 | else if lang eq ru |
50 | else if lang eq ru |
50 | include "bootru.inc" ; russian system boot messages |
51 | include "bootru.inc" ; russian system boot messages |
51 | include "ru.inc" ; Russian font |
52 | include "ru.inc" ; Russian font |
52 | else if lang eq et |
53 | else if lang eq et |
53 | include "bootet.inc" ; estonian system boot messages |
54 | include "bootet.inc" ; estonian system boot messages |
54 | include "et.inc" ; Estonian font |
55 | include "et.inc" ; Estonian font |
55 | else |
56 | else |
56 | include "bootge.inc" ; german system boot messages |
57 | include "bootge.inc" ; german system boot messages |
57 | end if |
58 | end if |
58 | 59 | ||
59 | include "../data16.inc" |
60 | include "../data16.inc" |
60 | 61 | ||
61 | include "bootcode.inc" ; 16 bit system boot code |
62 | include "bootcode.inc" ; 16 bit system boot code |
62 | include "../bus/pci/pci16.inc" |
63 | include "../bus/pci/pci16.inc" |
63 | include "../detect/biosdisk.inc" |
64 | include "../detect/biosdisk.inc" |
64 | 65 | ||
65 | ;include "boot/shutdown.inc" ; shutdown or restart |
- | |
66 | 66 | ||
67 | cli |
67 | cli |
68 | 68 | ||
69 | mov eax, cr0 |
69 | mov eax, cr0 |
70 | or eax, CR0_PG+CR0_WP+CR0_PE |
70 | or eax, CR0_PG+CR0_WP+CR0_PE |
71 | mov cr0, eax |
71 | mov cr0, eax |
72 | 72 | ||
73 | jmp pword 0x08:__setvars |
73 | jmp pword 0x08:__setvars |
74 | 74 | ||
- | 75 | ||
75 | align 4 |
76 | ;align 4 |
76 | _enter_16bit: |
77 | ;_leave_16bit: |
- | 78 | ; |
|
- | 79 | ; cli |
|
77 | mov eax, cr0 |
80 | ; mov eax, cr0 |
78 | and eax, not 0x80000001 |
81 | ; or eax, CR0_PG+CR0_WP+CR0_PE |
79 | mov cr0, eax |
82 | ; mov cr0, eax |
80 | jmp far 0x1000:@F |
83 | ; hlt |
81 | 84 | ||
82 | align 4 |
85 | align 4 |
- | 86 | rmode_idt: |
|
- | 87 | dw 0x400 |
|
- | 88 | dd 0 |
|
- | 89 | dw 0 |
|
83 | _leave_16bit: |
90 | |
84 | 91 | align 4 |
|
85 | cli |
92 | _poweroff: |
86 | mov eax, cr0 |
93 | mov eax, cr0 |
87 | or eax, CR0_PG+CR0_WP+CR0_PE |
94 | and eax, not 0x80000001 |
88 | mov cr0, eax |
- | |
89 | hlt |
- | |
90 | 95 | mov cr0, eax |
|
91 | align 4 |
96 | jmp far 0x1000:@F |
92 | @@: |
97 | @@: |
93 | mov eax, 0x3000 |
98 | mov eax, 0x3000 |
94 | mov ss, ax |
99 | mov ss, ax |
95 | mov esp, 0xEC00 |
100 | mov esp, 0xEC00 |
96 | 101 | ||
97 | mov ebx, 0x1000 |
102 | mov ebx, 0x1000 |
98 | mov ds, bx |
103 | mov ds, bx |
99 | mov es, bx |
104 | mov es, bx |
100 | cli |
105 | |
- | 106 | lidt [rmode_idt] |
|
- | 107 | ||
- | 108 | APM_PowerOff: |
|
- | 109 | mov ax, 5304h |
|
- | 110 | xor bx, bx |
|
- | 111 | int 15h |
|
- | 112 | ;!!!!!!!!!!!!!!!!!!!!!!!! |
|
- | 113 | mov ax,0x5300 |
|
- | 114 | xor bx,bx |
|
- | 115 | int 0x15 |
|
- | 116 | push ax |
|
- | 117 | ||
- | 118 | mov ax,0x5301 |
|
- | 119 | xor bx,bx |
|
- | 120 | int 0x15 |
|
- | 121 | ||
- | 122 | mov ax,0x5308 |
|
- | 123 | mov bx,1 |
|
- | 124 | mov cx,bx |
|
- | 125 | int 0x15 |
|
- | 126 | ||
- | 127 | mov ax,0x530E |
|
- | 128 | xor bx,bx |
|
- | 129 | pop cx |
|
101 | hlt |
130 | int 0x15 |
- | 131 | ||
- | 132 | mov ax,0x530D |
|
- | 133 | mov bx,1 |
|
- | 134 | mov cx,bx |
|
- | 135 | int 0x15 |
|
- | 136 | ||
- | 137 | mov ax,0x530F |
|
- | 138 | mov bx,1 |
|
- | 139 | mov cx,bx |
|
- | 140 | int 0x15 |
|
- | 141 | ||
- | 142 | mov ax,0x5307 |
|
- | 143 | mov bx,1 |
|
- | 144 | mov cx,3 |
|
- | 145 | int 0x15 |
|
- | 146 | ;!!!!!!!!!!!!!!!!!!!!!!!! |
|
- | 147 | ||
- | 148 | jmp $ |
|
102 | 149 | ||
- | 150 | ||
103 | align 4 |
151 | align 4 |
104 | _16bit_end: |
152 | _16bit_end: |