Subversion Repositories Kolibri OS

Rev

Rev 1952 | Rev 2350 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1952 Rev 2047
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
 
7
 
8
$Revision: 1952 $
8
$Revision: 2047 $
9
 
9
 
10
 
10
 
11
MEM_WB	   equ 6	       ;write-back memory
11
MEM_WB	   equ 6	       ;write-back memory
12
MEM_WC	   equ 1	       ;write combined memory
12
MEM_WC	   equ 1	       ;write combined memory
13
MEM_UC	   equ 0	       ;uncached memory
13
MEM_UC	   equ 0	       ;uncached memory
14
 
14
 
15
; ======================================================================
15
; ======================================================================
16
align 4
16
align 4
17
preinit_mem:
17
preinit_mem:
18
 
18
 
19
; clear [CLEAN_ZONE..HEAP_BASE]
19
; clear [CLEAN_ZONE..HEAP_BASE]
20
	   xor	 eax,eax
20
	   xor	 eax,eax
21
	   mov	 edi,CLEAN_ZONE			; 0x280000 = ramdisk FAT ?
21
	   mov	 edi,CLEAN_ZONE 		; 0x280000 = ramdisk FAT ?
22
	   mov	 ecx,(HEAP_BASE-OS_BASE-CLEAN_ZONE) / 4
22
	   mov	 ecx,(HEAP_BASE-OS_BASE-CLEAN_ZONE) / 4
23
	   cld
23
	   cld
24
	   rep	 stosd
24
	   rep	 stosd
25
 
25
 
26
; clear [0x40000..0x90000]
26
; clear [0x40000..0x90000]
27
	   mov	 edi,0x50000			; 0x50000 is somewhere inside kernel code?
27
	   mov	 edi,0x50000			; 0x50000 is somewhere inside kernel code?
28
	   mov	 ecx,(0x90000-0x50000)/4
28
	   mov	 ecx,(0x90000-0x50000)/4
29
	   rep	 stosd
29
	   rep	 stosd
30
 
30
 
31
; clear undefined kernel globals
31
; clear undefined kernel globals
32
	   mov	 edi, endofcode-OS_BASE
32
	   mov	 edi, endofcode-OS_BASE
33
	   mov	 ecx, (uglobals_size/4)+4
33
	   mov	 ecx, (uglobals_size/4)+4
34
	   rep	 stosd
34
	   rep	 stosd
35
 
35
 
36
; save [0..0xffff]
36
; save [0..0xffff]
37
	   xor	 esi, esi
37
	   xor	 esi, esi
38
	   mov	 edi, (BOOT_VAR	- OS_BASE)		; low mem storage area
38
	   mov	 edi, (BOOT_VAR - OS_BASE)		; low mem storage area
39
	   mov	 ecx, 0x10000 / 4
39
	   mov	 ecx, 0x10000 / 4
40
	   rep	 movsd
40
	   rep	 movsd
41
; clear [0x1000..0x0ffff]
41
; clear [0x1000..0x0ffff]
42
	   mov	 edi,0x1000
42
	   mov	 edi,0x1000
43
	   mov	 ecx,0xf000 / 4
43
	   mov	 ecx,0xf000 / 4
44
	   rep	 stosd
44
	   rep	 stosd
45
 
45
 
46
; clear  table
46
; clear  table
47
	   mov edi, sys_pgdir-OS_BASE
47
	   mov edi, sys_pgdir-OS_BASE
48
	   mov ecx, 4096/4
48
	   mov ecx, 4096/4
49
	   rep stosd
49
	   rep stosd
50
	ret
50
	ret
51
 
51
 
52
; ======================================================================
52
; ======================================================================
53
align 4
53
align 4
54
proc init_mem
54
proc init_mem
-
 
55
 
-
 
56
	   mov	ecx, 0xC001001A 			; Top of Memory MSR
-
 
57
	   xor	edi, edi
55
 
58
	   rdmsr
-
 
59
	   mov	esi, eax				; esi = total amount of memory
-
 
60
	   mov	ecx, 0x0200
-
 
61
.read_mtrr:
-
 
62
	   rdmsr
-
 
63
	   and	eax, 0xFFF00000 			; not just bitcleaning
-
 
64
	   jz	.next_mtrr				; ignore the main memory and free MTRRs
-
 
65
	   cmp	esi, eax
-
 
66
	   jb	.next_mtrr				; ignore MMIO blocks
-
 
67
	   mov	esi, eax
-
 
68
.next_mtrr:
-
 
69
	   add	cl, 2
-
 
70
	   cmp	cl, 0x10
-
 
71
	   jb	.read_mtrr
-
 
72
 
56
	   mov esi, (PCIe_CONFIG_SPACE-OS_BASE) 	; esi will hold total amount of memory
73
	   mov	eax, USER_DMA_SIZE
-
 
74
	   sub	esi, eax				; exclude the Global DMA block...
-
 
75
	   and	esi, 0xFF800000 			; ...and the hole above it
-
 
76
	   mov	eax, esi
-
 
77
	   mov	[MEM_AMOUNT-OS_BASE], eax
-
 
78
	   mov	[pg_data.mem_amount-OS_BASE], eax	; the true MEMTOP
57
	   mov edx, esi 				; edx will hold maximum allocatable address
-
 
58
 
79
	   mov	[UserDMAaddr-OS_BASE], eax
59
	   mov [MEM_AMOUNT-OS_BASE], esi
80
 
60
	   mov [pg_data.mem_amount-OS_BASE], esi
81
	   mov edx, esi 				; edx will hold maximum allocatable address
61
	   shr esi, 12
82
	   shr esi, 12
62
	   mov [pg_data.pages_count-OS_BASE], esi	; max number of PTEs   ?
83
	   mov [pg_data.pages_count-OS_BASE], esi	; max number of PTEs   ?
63
 
84
 
64
	   shr edx, 12
85
	   shr edx, 12
65
	   add edx, 31
86
	   add edx, 31
66
	   and edx, not 31
87
	   and edx, not 31
67
	   shr edx, 3
88
	   shr edx, 3
68
	   mov [pg_data.pagemap_size-OS_BASE], edx	; size of sys_pgmap structure
89
	   mov [pg_data.pagemap_size-OS_BASE], edx	; size of sys_pgmap structure
69
 
90
 
70
	   add edx, (sys_pgmap-OS_BASE)+4095
91
	   add edx, (sys_pgmap-OS_BASE)+4095
71
	   and edx, not 4095
92
	   and edx, not 4095
72
	   mov [tmp_page_tabs], edx			; free zone to build PTEs
93
	   mov [tmp_page_tabs], edx			; free zone to build PTEs
73
 
94
 
74
	   mov edx, (HEAP_BASE-OS_BASE+HEAP_MIN_SIZE)/4096
95
	   mov edx, (HEAP_BASE-OS_BASE+HEAP_MIN_SIZE)/4096
75
	   mov [pg_data.kernel_pages -OS_BASE], edx
96
	   mov [pg_data.kernel_pages -OS_BASE], edx
76
	   shr edx, 10
97
	   shr edx, 10
77
	   mov [pg_data.kernel_tables-OS_BASE], edx
98
	   mov [pg_data.kernel_tables-OS_BASE], edx
78
 
99
 
79
	   mov edx, (sys_pgdir-OS_BASE)+ 0x800		; (0x800 = OS_BASE shr 20)
100
	   mov edx, (sys_pgdir-OS_BASE)+ 0x800		; (0x800 = OS_BASE shr 20)
80
 
101
 
81
	   mov ebx, cr4
102
	   mov ebx, cr4
82
	   or  ebx, CR4_PSE
103
	   or  ebx, CR4_PSE
83
	   mov eax, PG_LARGE+PG_SW
104
	   mov eax, PG_LARGE+PG_SW
84
	   mov cr4, ebx
105
	   mov cr4, ebx
85
	   dec [pg_data.kernel_tables-OS_BASE]
106
	   dec [pg_data.kernel_tables-OS_BASE]
86
 
107
 
87
	   mov [edx], eax				; map first (physical) 4M bytes
108
	   mov [edx], eax				; map first (physical) 4M bytes
88
	   add edx, 4
109
	   add edx, 4
89
 
110
 
90
	   mov edi, [tmp_page_tabs]
111
	   mov edi, [tmp_page_tabs]
91
	   mov ecx, [pg_data.kernel_pages -OS_BASE]	; safety cleaning of already-zeroed space
112
	   mov ecx, [pg_data.kernel_pages -OS_BASE]	; safety cleaning of already-zeroed space
92
	   xor eax, eax
113
	   xor eax, eax
93
	   rep stosd
114
	   rep stosd
94
 
115
 
95
	   mov ecx, [pg_data.kernel_tables-OS_BASE]	; build some PDEs to hold empty PTEs
116
	   mov ecx, [pg_data.kernel_tables-OS_BASE]	; build some PDEs to hold empty PTEs
96
	   mov eax, [tmp_page_tabs]
117
	   mov eax, [tmp_page_tabs]
97
	   or  eax, PG_SW
118
	   or  eax, PG_SW
98
	   mov edi, edx 		; edi = sys_pgdir+0x804
119
	   mov edi, edx 		; edi = sys_pgdir+0x804
99
 
120
 
100
.map_kernel_tabs:
121
.map_kernel_tabs:
101
	   stosd
122
	   stosd
102
	   add eax, 0x1000
123
	   add eax, 0x1000
103
	   dec ecx
124
	   dec ecx
104
	   jnz .map_kernel_tabs
125
	   jnz .map_kernel_tabs
105
 
126
 
106
; map pagetables to linear space
127
; map pagetables to linear space
107
	   mov dword [sys_pgdir-OS_BASE+(page_tabs shr 20)], sys_pgdir+PG_SW-OS_BASE
128
	   mov dword [sys_pgdir-OS_BASE+(page_tabs shr 20)], sys_pgdir+PG_SW-OS_BASE
108
 
129
 
109
	   mov edi, (sys_pgdir-OS_BASE)
130
	   mov edi, (sys_pgdir-OS_BASE)
110
	   lea esi, [edi+(OS_BASE shr 20)]
131
	   lea esi, [edi+(OS_BASE shr 20)]
111
	   movsd
132
	   movsd
112
	   movsd
133
	   movsd
113
	   ret
134
	   ret
114
endp
135
endp
115
 
136
 
116
align 4
137
align 4
117
proc init_page_map
138
proc init_page_map
118
; mark all memory as unavailable
139
; mark all memory as unavailable
119
	   mov edi, sys_pgmap-OS_BASE
140
	   mov edi, sys_pgmap-OS_BASE
120
	   mov ecx, [pg_data.pagemap_size-OS_BASE]
141
	   mov ecx, [pg_data.pagemap_size-OS_BASE]
121
	   shr ecx, 2
142
	   shr ecx, 2
122
	   xor eax, eax
143
	   xor eax, eax
123
	   cld
144
	   cld
124
	   rep stosd
145
	   rep stosd
125
 
146
 
126
; scan through memory map and mark free areas as available
147
; scan through memory map and mark free areas as available
127
	   mov ebx, BOOT_VAR-OS_BASE + 0x9104
148
	   mov ebx, BOOT_VAR-OS_BASE + 0x9104
128
	   mov edx, [ebx-4]
149
	   mov edx, [ebx-4]
129
.scanmap:
150
.scanmap:
130
	   mov ecx, [ebx+8]
151
	   mov ecx, [ebx+8]
131
	   shr ecx, 12 ; ecx = number of pages
152
	   shr ecx, 12 ; ecx = number of pages
132
	   jz .next
153
	   jz .next
133
	   mov edi, [ebx]
154
	   mov edi, [ebx]
134
	   shr edi, 12 ; edi = first page
155
	   shr edi, 12 ; edi = first page
135
	   mov eax, edi
156
	   mov eax, edi
136
	   shr edi, 5
157
	   shr edi, 5
137
	   shl edi, 2
158
	   shl edi, 2
138
	   add edi, sys_pgmap-OS_BASE
159
	   add edi, sys_pgmap-OS_BASE
139
	   and eax, 31
160
	   and eax, 31
140
	   jz .startok
161
	   jz .startok
141
	   add ecx, eax
162
	   add ecx, eax
142
	   sub ecx, 32
163
	   sub ecx, 32
143
	   jbe .onedword
164
	   jbe .onedword
144
	   push ecx
165
	   push ecx
145
	   mov ecx, eax
166
	   mov ecx, eax
146
	   or eax, -1
167
	   or eax, -1
147
	   shl eax, cl
168
	   shl eax, cl
148
	   or [edi], eax
169
	   or [edi], eax
149
	   add edi, 4
170
	   add edi, 4
150
	   pop ecx
171
	   pop ecx
151
.startok:
172
.startok:
152
	   push ecx
173
	   push ecx
153
	   shr ecx, 5
174
	   shr ecx, 5
154
	   or eax, -1
175
	   or eax, -1
155
	   rep stosd
176
	   rep stosd
156
	   pop ecx
177
	   pop ecx
157
	   and ecx, 31
178
	   and ecx, 31
158
	   neg eax
179
	   neg eax
159
	   shl eax, cl
180
	   shl eax, cl
160
	   dec eax
181
	   dec eax
161
	   or [edi], eax
182
	   or [edi], eax
162
	   jmp .next
183
	   jmp .next
163
.onedword:
184
.onedword:
164
	   add ecx, 32
185
	   add ecx, 32
165
	   sub ecx, eax
186
	   sub ecx, eax
166
@@:
187
@@:
167
	   bts [edi], eax
188
	   bts [edi], eax
168
	   inc eax
189
	   inc eax
169
	   loop @b
190
	   loop @b
170
.next:
191
.next:
171
	   add ebx, 20
192
	   add ebx, 20
172
	   dec edx
193
	   dec edx
173
	   jnz .scanmap
194
	   jnz .scanmap
174
 
195
 
175
; mark kernel memory as allocated (unavailable)
196
; mark kernel memory as allocated (unavailable)
176
	   mov ecx, [tmp_page_tabs]
197
	   mov ecx, [tmp_page_tabs]
177
	   mov edx, [pg_data.pages_count-OS_BASE]
198
	   mov edx, [pg_data.pages_count-OS_BASE]
178
	   shr ecx, 12
199
	   shr ecx, 12
179
	   add ecx, [pg_data.kernel_tables-OS_BASE]
200
	   add ecx, [pg_data.kernel_tables-OS_BASE]
180
	   sub edx, ecx
201
	   sub edx, ecx
181
	   mov [pg_data.pages_free-OS_BASE], edx
202
	   mov [pg_data.pages_free-OS_BASE], edx
182
 
203
 
183
	   mov edi, sys_pgmap-OS_BASE
204
	   mov edi, sys_pgmap-OS_BASE
184
	   mov ebx, ecx
205
	   mov ebx, ecx
185
	   shr ecx, 5
206
	   shr ecx, 5
186
	   xor eax, eax
207
	   xor eax, eax
187
	   rep stosd
208
	   rep stosd
188
 
209
 
189
	   not eax
210
	   not eax
190
	   mov ecx, ebx
211
	   mov ecx, ebx
191
	   and ecx, 31
212
	   and ecx, 31
192
	   shl eax, cl
213
	   shl eax, cl
193
	   and [edi], eax
214
	   and [edi], eax
194
	   add edi, OS_BASE
215
	   add edi, OS_BASE
195
	   mov [page_start-OS_BASE], edi;
216
	   mov [page_start-OS_BASE], edi;
196
 
217
 
197
	   mov ebx, sys_pgmap
218
	   mov ebx, sys_pgmap
198
	   add ebx, [pg_data.pagemap_size-OS_BASE]
219
	   add ebx, [pg_data.pagemap_size-OS_BASE]
199
	   mov [page_end-OS_BASE], ebx
220
	   mov [page_end-OS_BASE], ebx
200
 
221
 
201
	   mov [pg_data.pg_mutex-OS_BASE], 0
222
	   mov [pg_data.pg_mutex-OS_BASE], 0
202
	   ret
223
	   ret
203
endp
224
endp
204
 
225
 
205
align 4
226
align 4
206
 
227
 
207
init_BIOS32:
228
init_BIOS32:
208
	   mov edi, 0xE0000
229
	   mov edi, 0xE0000
209
.pcibios_nxt:
230
.pcibios_nxt:
210
	   cmp dword[edi], '_32_' ; "magic" word
231
	   cmp dword[edi], '_32_' ; "magic" word
211
	   je .BIOS32_found
232
	   je .BIOS32_found
212
.pcibios_nxt2:
233
.pcibios_nxt2:
213
	   add edi, 0x10
234
	   add edi, 0x10
214
	   cmp edi, 0xFFFF0
235
	   cmp edi, 0xFFFF0
215
	   je .BIOS32_not_found
236
	   je .BIOS32_not_found
216
	   jmp .pcibios_nxt
237
	   jmp .pcibios_nxt
217
.BIOS32_found:			; magic word found, check control summ
238
.BIOS32_found:			; magic word found, check control summ
218
 
239
 
219
	   movzx ecx, byte[edi + 9]
240
	   movzx ecx, byte[edi + 9]
220
	   shl ecx, 4
241
	   shl ecx, 4
221
	   mov esi, edi
242
	   mov esi, edi
222
	   xor eax, eax
243
	   xor eax, eax
223
	   cld	 ; paranoia
244
	   cld	 ; paranoia
224
@@:	lodsb
245
@@:	lodsb
225
	   add ah, al
246
	   add ah, al
226
	   loop @b
247
	   loop @b
227
	   jnz .pcibios_nxt2 ; control summ must be zero
248
	   jnz .pcibios_nxt2 ; control summ must be zero
228
    ; BIOS32 service found !
249
    ; BIOS32 service found !
229
	   mov ebp, [edi + 4]
250
	   mov ebp, [edi + 4]
230
	   mov [bios32_entry], ebp
251
	   mov [bios32_entry], ebp
231
    ; check PCI BIOS present
252
    ; check PCI BIOS present
232
	   mov eax, '$PCI'
253
	   mov eax, '$PCI'
233
	   xor ebx, ebx
254
	   xor ebx, ebx
234
	   push cs  ; special for 'ret far' from  BIOS
255
	   push cs  ; special for 'ret far' from  BIOS
235
	   call ebp
256
	   call ebp
236
	   test al, al
257
	   test al, al
237
	   jnz .PCI_BIOS32_not_found
258
	   jnz .PCI_BIOS32_not_found
238
 
259
 
239
 ; çäåñü ñîçäàþòñÿ äèñêðèïòîðû äëÿ PCI BIOS
260
 ; çäåñü ñîçäàþòñÿ äèñêðèïòîðû äëÿ PCI BIOS
240
 
261
 
241
	   add ebx, OS_BASE
262
	   add ebx, OS_BASE
242
	   dec ecx
263
	   dec ecx
243
	   mov [(pci_code_32-OS_BASE)], cx    ;limit 0-15
264
	   mov [(pci_code_32-OS_BASE)], cx    ;limit 0-15
244
	   mov [(pci_data_32-OS_BASE)], cx    ;limit 0-15
265
	   mov [(pci_data_32-OS_BASE)], cx    ;limit 0-15
245
 
266
 
246
	   mov [(pci_code_32-OS_BASE)+2], bx  ;base  0-15
267
	   mov [(pci_code_32-OS_BASE)+2], bx  ;base  0-15
247
	   mov [(pci_data_32-OS_BASE)+2], bx  ;base  0-15
268
	   mov [(pci_data_32-OS_BASE)+2], bx  ;base  0-15
248
 
269
 
249
	   shr ebx, 16
270
	   shr ebx, 16
250
	   mov [(pci_code_32-OS_BASE)+4], bl  ;base  16-23
271
	   mov [(pci_code_32-OS_BASE)+4], bl  ;base  16-23
251
	   mov [(pci_data_32-OS_BASE)+4], bl  ;base  16-23
272
	   mov [(pci_data_32-OS_BASE)+4], bl  ;base  16-23
252
 
273
 
253
	   shr ecx, 16
274
	   shr ecx, 16
254
	   and cl, 0x0F
275
	   and cl, 0x0F
255
	   mov ch, bh
276
	   mov ch, bh
256
	   add cx, D32
277
	   add cx, D32
257
	   mov [(pci_code_32-OS_BASE)+6], cx  ;lim   16-19 &
278
	   mov [(pci_code_32-OS_BASE)+6], cx  ;lim   16-19 &
258
	   mov [(pci_data_32-OS_BASE)+6], cx  ;base  24-31
279
	   mov [(pci_data_32-OS_BASE)+6], cx  ;base  24-31
259
 
280
 
260
	   mov [(pci_bios_entry-OS_BASE)], edx
281
	   mov [(pci_bios_entry-OS_BASE)], edx
261
	 ; jmp .end
282
	 ; jmp .end
262
.PCI_BIOS32_not_found:
283
.PCI_BIOS32_not_found:
263
	; çäåñü äîëæíà çàïîëíÿòñÿ pci_emu_dat
284
	; çäåñü äîëæíà çàïîëíÿòñÿ pci_emu_dat
264
.BIOS32_not_found:
285
.BIOS32_not_found:
265
.end:
286
.end:
266
	   ret
287
	   ret
267
 
288
 
268
align 4
289
align 4
269
test_cpu:	; only AMD machines supported
290
test_cpu:	; only AMD machines supported
270
 
291
 
271
	   xor eax, eax
292
	   xor eax, eax
272
	   mov [cpu_caps-OS_BASE], eax
293
	   mov [cpu_caps-OS_BASE], eax
273
	   mov [cpu_caps+4-OS_BASE], eax
294
	   mov [cpu_caps+4-OS_BASE], eax
274
 
295
 
275
	   pushfd
296
	   pushfd
276
	   pop eax
297
	   pop eax
277
	   mov ecx, eax
298
	   mov ecx, eax
278
	   xor eax, 0x40000
299
	   xor eax, 0x40000
279
	   push eax
300
	   push eax
280
	   popfd
301
	   popfd
281
	   pushfd
302
	   pushfd
282
	   pop eax
303
	   pop eax
283
	   xor eax, ecx
304
	   xor eax, ecx
284
	   jz $ 		; 386
305
	   jz $ 		; 386
285
	   push ecx
306
	   push ecx
286
	   popfd
307
	   popfd
287
 
308
 
288
	   mov eax, ecx
309
	   mov eax, ecx
289
	   xor eax, 0x200000
310
	   xor eax, 0x200000
290
	   push eax
311
	   push eax
291
	   popfd
312
	   popfd
292
	   pushfd
313
	   pushfd
293
	   pop eax
314
	   pop eax
294
	   xor eax, ecx
315
	   xor eax, ecx
295
	   je $ 		; 486
316
	   je $ 		; 486
296
 
317
 
297
	   xor eax, eax
318
	   xor eax, eax
298
	   cpuid
319
	   cpuid
299
 
320
 
300
	   mov [cpu_vendor-OS_BASE],   ebx
321
	   mov [cpu_vendor-OS_BASE],   ebx
301
	   mov [cpu_vendor+4-OS_BASE], edx
322
	   mov [cpu_vendor+4-OS_BASE], edx
302
	   mov [cpu_vendor+8-OS_BASE], ecx
323
	   mov [cpu_vendor+8-OS_BASE], ecx
303
 
324
 
304
	   cmp ebx, dword [AMD_str-OS_BASE]
325
	   cmp ebx, dword [AMD_str-OS_BASE]
305
	   jne $
326
	   jne $
306
	   cmp edx, dword [AMD_str+4-OS_BASE]
327
	   cmp edx, dword [AMD_str+4-OS_BASE]
307
	   jne $
328
	   jne $
308
	   cmp ecx, dword [AMD_str+8-OS_BASE]
329
	   cmp ecx, dword [AMD_str+8-OS_BASE]
309
	   jne $
330
	   jne $
310
	   cmp eax, 1
331
	   cmp eax, 1
311
	   jl $
332
	   jl $
312
	   mov eax, 1
333
	   mov eax, 1
313
	   cpuid
334
	   cpuid
314
	   mov [cpu_sign-OS_BASE],  eax
335
	   mov [cpu_sign-OS_BASE],  eax
315
	   mov [cpu_info-OS_BASE],  ebx
336
	   mov [cpu_info-OS_BASE],  ebx
316
	   mov [cpu_caps-OS_BASE],  edx
337
	   mov [cpu_caps-OS_BASE],  edx
317
	   mov [cpu_caps+4-OS_BASE],ecx
338
	   mov [cpu_caps+4-OS_BASE],ecx
318
	   shr eax, 8
339
	   shr eax, 8
319
	   and eax, 0x0f
340
	   and eax, 0x0f
320
	   ret
341
	   ret