248,13 → 248,7 |
bios32_entry dd ? |
tmp_page_tabs dd ? |
|
;use16 |
;org $-0x10000 |
;include "boot/shutdown.inc" ; shutdown or restart |
;org $+0x10000 |
|
use32 |
|
__DEBUG__ fix 1 |
__DEBUG_LEVEL__ fix 1 |
include 'init.inc' |
291,41 → 285,11 |
mov cr3, eax ; flush TLB |
|
; SAVE REAL MODE VARIABLES |
mov ax, [BOOT_VAR + 0x9031] |
xor eax, eax |
mov [IDEContrRegsBaseAddr], ax |
; --------------- APM --------------------- |
|
; init selectors |
mov ebx,[BOOT_VAR+0x9040] ; offset of APM entry point |
movzx eax,word [BOOT_VAR+0x9050] ; real-mode segment base address of |
; protected-mode 32-bit code segment |
movzx ecx,word [BOOT_VAR+0x9052] ; real-mode segment base address of |
; protected-mode 16-bit code segment |
movzx edx,word [BOOT_VAR+0x9054] ; real-mode segment base address of |
; protected-mode 16-bit data segment |
|
shl eax, 4 |
mov [dword apm_code_32 + 2], ax |
shr eax, 16 |
mov [dword apm_code_32 + 4], al |
|
shl ecx, 4 |
mov [dword apm_code_16 + 2], cx |
shr ecx, 16 |
mov [dword apm_code_16 + 4], cl |
|
shl edx, 4 |
mov [dword apm_data_16 + 2], dx |
shr edx, 16 |
mov [dword apm_data_16 + 4], dl |
|
mov dword[apm_entry], ebx |
mov word [apm_entry + 4], apm_code_32 - gdts |
|
mov eax, [BOOT_VAR + 0x9044] ; version & flags |
mov [apm_vf], eax |
; ----------------------------------------- |
mov al, [BOOT_VAR+0x901F] ; DMA access |
inc eax |
; mov al, [BOOT_VAR+0x901F] ; DMA access |
mov [allow_dma_access], al |
mov eax, 32 ; << bpp |
mov [ScreenBPP],al |
4379,16 → 4343,10 |
hlt ; Houston, we've had a problem |
|
; --------------- APM --------------------- |
uglobal |
apm_entry dp 0 |
apm_vf dd 0 |
endg |
|
align 4 |
sys_apm: |
xor eax,eax |
cmp word [apm_vf], ax ; Check APM BIOS enable |
jne @f |
inc eax |
or dword [esp + 44], eax ; error |
add eax,7 |
4395,45 → 4353,6 |
mov dword [esp + 32], eax ; 32-bit protected-mode interface not supported |
ret |
|
@@: |
; xchg eax, ecx |
; xchg ebx, ecx |
|
cmp dx, 3 |
ja @f |
and [esp + 44], byte 0xfe ; emulate func 0..3 as func 0 |
mov eax,[apm_vf] |
mov [esp + 32], eax |
shr eax, 16 |
mov [esp + 28], eax |
ret |
|
@@: |
|
mov esi,[master_tab+(OS_BASE shr 20)] |
xchg [master_tab], esi |
push esi |
mov edi, cr3 |
mov cr3, edi ;flush TLB |
|
call pword [apm_entry] ;call APM BIOS |
|
xchg eax, [esp] |
mov [master_tab], eax |
mov eax, cr3 |
mov cr3, eax |
pop eax |
|
mov [esp + 4 ], edi |
mov [esp + 8], esi |
mov [esp + 20], ebx |
mov [esp + 24], edx |
mov [esp + 28], ecx |
mov [esp + 32], eax |
setc al |
and [esp + 44], byte 0xfe |
or [esp + 44], al |
ret |
; ----------------------------------------- |
|
align 4 |