Good-bye APM !

git-svn-id: svn://kolibrios.org@3194 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Artem Jerdev (art_zh) 2013-01-22 22:47:49 +00:00
parent 2a1f846c07
commit b1147c3be7
4 changed files with 8 additions and 238 deletions

View File

@ -39,7 +39,7 @@ start_of_code:
cpugood: cpugood:
xor ax, ax xor ax, ax
push ax push ax
popf popf
sti sti
@ -49,35 +49,28 @@ cpugood:
push ax push ax
pop es pop es
mov [es:0x9031], ax
; --------------- APM - removed--------------------
and word [es:0x9044], 0 ; ver = 0.0 (APM not found)
cfgmanager: cfgmanager:
; DMA ACCESS TO HD ; DMA ACCESS TO HD
mov al, 1 ; mov al, 1
mov [es:0x901F], al
; GRAPHICS ACCELERATION ; GRAPHICS ACCELERATION
; force yes ; force yes
mov [es:0x901C], al ; mov [es:0x901C], al
; VRR_M USE ; VRR_M USE
mov [es:0x9030], byte 2 ; mov [es:0x9030], byte 2
mov [es:0x901E], al
; BOOT DEVICE ; BOOT DEVICE
xor ax, ax xor ax, ax
mov [boot_dev], al mov [boot_dev], al
mov es, ax ; mov es, ax
; SET GRAPHICS ; SET GRAPHICS

View File

@ -1,126 +0,0 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$Revision$
; READ RAMDISK IMAGE FROM HD
; cmp [boot_dev+OS_BASE+0x10000],1
jmp no_sys_on_hd
if 0
test [DRIVE_DATA+1],byte 0x40
jz position_2
mov [hdbase],0x1f0
mov [hdid],0x0
mov [hdpos],1
mov [fat32part], 0
position_1_1:
inc [fat32part]
call search_and_read_image
cmp [image_retrieved],1
je yes_sys_on_hd
movzx eax,byte [DRIVE_DATA+2]
cmp [fat32part],eax
jle position_1_1
position_2:
test [DRIVE_DATA+1],byte 0x10
jz position_3
mov [hdbase],0x1f0
mov [hdid],0x10
mov [hdpos],2
mov [fat32part],0
position_2_1:
inc [fat32part]
call search_and_read_image
cmp [image_retrieved],1
je yes_sys_on_hd
movzx eax,byte [DRIVE_DATA+3]
cmp eax,[fat32part]
jle position_2_1
position_3:
test [DRIVE_DATA+1],byte 0x4
jz position_4
mov [hdbase],0x170
mov [hdid],0x0
mov [hdpos],3
mov [fat32part],0
position_3_1:
inc [fat32part]
call search_and_read_image
cmp [image_retrieved],1
je yes_sys_on_hd
movzx eax,byte [DRIVE_DATA+4]
cmp eax,[fat32part]
jle position_3_1
position_4:
test [DRIVE_DATA+1],byte 0x1
jz no_sys_on_hd
mov [hdbase],0x170
mov [hdid],0x10
mov [hdpos],4
mov [fat32part],0
position_4_1:
inc [fat32part]
call search_and_read_image
cmp [image_retrieved],1
je yes_sys_on_hd
movzx eax,byte [DRIVE_DATA+5]
cmp eax,[fat32part]
jle position_4_1
jmp yes_sys_on_hd
search_and_read_image:
call set_FAT32_variables
mov edx, bootpath
call read_image
test eax, eax
jz image_present
mov edx, bootpath2
call read_image
test eax, eax
jz image_present
ret
image_present:
mov [image_retrieved],1
ret
read_image:
mov eax, hdsysimage+OS_BASE+0x10000
mov ebx, 1474560/512
mov ecx, RAMDISK
mov esi, 0
mov edi, 12
call file_read
ret
end if
image_retrieved db 0
counter_of_partitions db 0
no_sys_on_hd:
; test_to_format_ram_disk (need if not using ram disk)
cmp [boot_dev+OS_BASE+0x10000],3
jne not_format_ram_disk
; format_ram_disk
mov edi, RAMDISK
mov ecx, 0x1080
xor eax,eax
@@:
stosd
loop @b
mov ecx, 0x58F7F
mov eax,0xF6F6F6F6
@@:
stosd
loop @b
mov [RAMDISK+0x200],dword 0xFFFFF0 ; fat table
mov [RAMDISK+0x4200],dword 0xFFFFF0
not_format_ram_disk:
yes_sys_on_hd:

View File

@ -212,22 +212,6 @@ pci_data_32:
db D32 ;lim 16-19+props db D32 ;lim 16-19+props
db 0 ;base 24-31 db 0 ;base 24-31
; --------------- APM ---------------------
apm_code_32:
dw 0x0f ; limit 64kb
db 0, 0, 0
dw 11010000b *256 +10011010b
db 0x00
apm_code_16:
dw 0x0f
db 0, 0, 0
dw 10010000b *256 +10011010b
db 0x00
apm_data_16:
dw 0x0f
db 0, 0, 0
dw 10010000b *256 +10010010b
db 0x00
; ----------------------------------------- ; -----------------------------------------
graph_data_l: graph_data_l:

View File

@ -248,12 +248,6 @@ align 4
bios32_entry dd ? bios32_entry dd ?
tmp_page_tabs dd ? tmp_page_tabs dd ?
;use16
;org $-0x10000
;include "boot/shutdown.inc" ; shutdown or restart
;org $+0x10000
use32
__DEBUG__ fix 1 __DEBUG__ fix 1
__DEBUG_LEVEL__ fix 1 __DEBUG_LEVEL__ fix 1
@ -291,41 +285,11 @@ high_code:
mov cr3, eax ; flush TLB mov cr3, eax ; flush TLB
; SAVE REAL MODE VARIABLES ; SAVE REAL MODE VARIABLES
mov ax, [BOOT_VAR + 0x9031] xor eax, eax
mov [IDEContrRegsBaseAddr], ax 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 [allow_dma_access], al
mov eax, 32 ; << bpp mov eax, 32 ; << bpp
mov [ScreenBPP],al mov [ScreenBPP],al
@ -4379,61 +4343,16 @@ set_screen:
hlt ; Houston, we've had a problem hlt ; Houston, we've had a problem
; --------------- APM --------------------- ; --------------- APM ---------------------
uglobal
apm_entry dp 0
apm_vf dd 0
endg
align 4 align 4
sys_apm: sys_apm:
xor eax,eax xor eax,eax
cmp word [apm_vf], ax ; Check APM BIOS enable
jne @f
inc eax inc eax
or dword [esp + 44], eax ; error or dword [esp + 44], eax ; error
add eax,7 add eax,7
mov dword [esp + 32], eax ; 32-bit protected-mode interface not supported mov dword [esp + 32], eax ; 32-bit protected-mode interface not supported
ret 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 align 4