Subversion Repositories Kolibri OS

Rev

Rev 3176 | Rev 3487 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3176 Rev 3194
Line 56... Line 56...
56
;;
56
;;
57
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
57
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 58... Line 58...
58
 
58
 
Line 59... Line 59...
59
include 'macros.inc'
59
include 'macros.inc'
Line 60... Line 60...
60
 
60
 
Line 61... Line 61...
61
$Revision: 3176 $
61
$Revision: 3194 $
Line 246... Line 246...
246
 
246
 
247
align 4
247
align 4
248
bios32_entry	dd ?
248
bios32_entry	dd ?
Line 249... Line -...
249
tmp_page_tabs	dd ?
-
 
250
 
-
 
251
;use16
-
 
252
;org $-0x10000
-
 
253
;include "boot/shutdown.inc" ; shutdown or restart
-
 
254
;org $+0x10000
-
 
Line 255... Line 249...
255
 
249
tmp_page_tabs	dd ?
256
use32
250
 
257
 
251
 
Line 289... Line 283...
289
 
283
 
290
	   mov eax, cr3
284
	   mov eax, cr3
Line 291... Line 285...
291
	   mov cr3, eax 	  ; flush TLB
285
	   mov cr3, eax 	  ; flush TLB
292
 
286
 
293
; SAVE REAL MODE VARIABLES
287
; SAVE REAL MODE VARIABLES
294
	mov	ax, [BOOT_VAR + 0x9031]
-
 
295
	mov	[IDEContrRegsBaseAddr], ax
-
 
296
; --------------- APM ---------------------
-
 
297
 
-
 
298
; init selectors
-
 
299
    mov ebx,[BOOT_VAR+0x9040]			; offset of APM entry point
-
 
300
    movzx eax,word [BOOT_VAR+0x9050]	; real-mode segment base address of
-
 
301
						; protected-mode 32-bit code segment
-
 
302
    movzx ecx,word [BOOT_VAR+0x9052]	; real-mode segment base address of
-
 
303
						; protected-mode 16-bit code segment
-
 
304
    movzx edx,word [BOOT_VAR+0x9054]	; real-mode segment base address of
-
 
305
						; protected-mode 16-bit data segment
-
 
306
 
-
 
307
    shl    eax, 4
-
 
308
    mov    [dword apm_code_32 + 2], ax
-
 
309
    shr    eax, 16
-
 
310
    mov    [dword apm_code_32 + 4], al
-
 
311
 
-
 
312
    shl    ecx, 4
-
 
313
    mov    [dword apm_code_16 + 2], cx
-
 
314
    shr    ecx, 16
-
 
315
    mov    [dword apm_code_16 + 4], cl
-
 
316
 
-
 
317
    shl    edx, 4
-
 
318
    mov    [dword apm_data_16 + 2], dx
-
 
319
    shr    edx, 16
-
 
320
    mov    [dword apm_data_16 + 4], dl
-
 
321
 
-
 
322
    mov    dword[apm_entry], ebx
-
 
323
    mov    word [apm_entry + 4], apm_code_32 - gdts
-
 
324
 
-
 
325
    mov    eax, [BOOT_VAR + 0x9044]    ; version & flags
288
	xor	eax, eax
-
 
289
	mov	[IDEContrRegsBaseAddr], ax
326
    mov    [apm_vf], eax
290
; -----------------------------------------
327
; -----------------------------------------
291
	inc	eax
328
	mov	al, [BOOT_VAR+0x901F]		; DMA access
292
;        mov     al, [BOOT_VAR+0x901F]           ; DMA access
329
	mov	[allow_dma_access], al
293
	mov	[allow_dma_access], al
330
	mov	eax, 32 			; << bpp
294
	mov	eax, 32 			; << bpp
Line 4377... Line 4341...
4377
 
4341
 
4378
.epic_fail:
4342
.epic_fail:
Line 4379... Line 4343...
4379
	hlt			; Houston, we've had a problem
4343
	hlt			; Houston, we've had a problem
4380
 
-
 
4381
; --------------- APM ---------------------
-
 
4382
uglobal
-
 
4383
apm_entry	dp	0
-
 
Line 4384... Line 4344...
4384
apm_vf		dd	0
4344
 
4385
endg
4345
; --------------- APM ---------------------
4386
 
4346
 
4387
align 4
-
 
4388
sys_apm:
-
 
4389
	xor	eax,eax
4347
align 4
4390
	cmp	word [apm_vf], ax	; Check APM BIOS enable
4348
sys_apm:
4391
	jne	@f
4349
	xor	eax,eax
4392
	inc	eax
4350
	inc	eax
4393
	or	dword [esp + 44], eax	; error
4351
	or	dword [esp + 44], eax	; error
Line 4394... Line -...
4394
	add	eax,7
-
 
4395
	mov	dword [esp + 32], eax	; 32-bit protected-mode interface not supported
-
 
4396
	ret
-
 
4397
 
-
 
4398
@@:
-
 
4399
;       xchg    eax, ecx
-
 
4400
;       xchg    ebx, ecx
-
 
4401
 
-
 
4402
	cmp	dx, 3
-
 
4403
	ja	@f
-
 
4404
	and	[esp + 44], byte 0xfe	 ; emulate func 0..3 as func 0
-
 
4405
	mov	eax,[apm_vf]
-
 
4406
	mov	[esp + 32], eax
-
 
4407
	shr	eax, 16
-
 
4408
	mov	[esp + 28], eax
-
 
4409
	ret
-
 
4410
 
-
 
4411
@@:
-
 
4412
 
-
 
4413
	mov	esi,[master_tab+(OS_BASE shr 20)]
-
 
4414
	xchg	[master_tab], esi
-
 
4415
	push	esi
-
 
4416
	mov	edi, cr3
-
 
4417
	mov	cr3, edi		;flush TLB
-
 
4418
 
-
 
4419
	call	pword [apm_entry]	;call APM BIOS
-
 
4420
 
-
 
4421
	xchg	eax, [esp]
-
 
4422
	mov	[master_tab], eax
-
 
4423
	mov	eax, cr3
-
 
4424
	mov	cr3, eax
-
 
4425
	pop eax
-
 
4426
 
-
 
4427
	mov	[esp + 4 ], edi
-
 
4428
	mov	[esp + 8], esi
-
 
4429
	mov	[esp + 20], ebx
-
 
4430
	mov	[esp + 24], edx
-
 
4431
	mov	[esp + 28], ecx
-
 
4432
	mov	[esp + 32], eax
-
 
4433
	setc	al
4352
	add	eax,7
Line 4434... Line 4353...
4434
	and	[esp + 44], byte 0xfe
4353
	mov	dword [esp + 32], eax	; 32-bit protected-mode interface not supported
Line 4435... Line 4354...
4435
	or	[esp + 44], al
4354
	ret