Mihaylov Iliya Andreevich aka Ghost

Advanced Power Management
SYSTEM CALL
eax = 49
dx = number of the function APM BIOS (Is similar AX in real mode)
Others registers (bx, cx) on the specification (see. docs/apm.zip>apm.txt)
Result: on the specification (including CF), the high part 32 bit registers is not defined


git-svn-id: svn://kolibrios.org@76 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2006-05-06 14:34:30 +00:00
parent 17da7e7f7a
commit c9d4558817
6 changed files with 567 additions and 457 deletions

File diff suppressed because it is too large Load Diff

View File

@ -35,6 +35,24 @@ os_data_l:
dw 11011111b *256 +10010010b
db 0x00
; --------------- APM ---------------------
apm_code_32:
dw 0x10 ; limit 64kb
db 0, 0, 0
dw 11011111b *256 +10011010b
db 0x00
apm_code_16:
dw 0x10
db 0, 0, 0
dw 10011111b *256 +10011010b
db 0x00
apm_data_16:
dw 0x10
db 0, 0, 0
dw 10011111b *256 +10010010b
db 0x00
; -----------------------------------------
app_code_l:
dw ((0x80000000-std_application_base_address) shr 12) and 0xffff
dw 0

View File

@ -120,7 +120,7 @@ iglobal
dd syscall_reserveportarea ; 46-ReservePortArea and FreePortArea
dd display_number ; 47-WriteNum
dd display_settings ; 48-SetRedrawType and SetButtonType
dd syscall_appints ; 49-AppInts
dd sys_apm ; 49-Advanced Power Management (APM)
dd random_shaped_window ; 50-Window shape & scale
dd syscall_threads ; 51-Threads
dd stack_driver_stat ; 52-Stack driver status

BIN
kernel/trunk/docs/apm.zip Normal file

Binary file not shown.

View File

@ -283,6 +283,14 @@ B32:
rep stosd
; SAVE REAL MODE VARIABLES
; --------------- APM ---------------------
mov eax, [0x2f0000 + 0x9040] ; entry point
mov dword[apm_entry], eax
mov word [apm_entry + 4], apm_code_32 - gdts
mov eax, [0x2f0000 + 0x9044] ; version & flags
mov [apm_vf], eax
; -----------------------------------------
; movzx eax,byte [0x2f0000+0x9010] ; mouse port
; mov [0xF604],byte 1 ;al
mov al,[0x2f0000+0x9000] ; bpp
@ -2404,7 +2412,7 @@ draw_background_temp:
;draw_background_temp:
; mov [bgrchanged],1 ;0
mov [0xfff0],byte 1
mov [background_defined], 1
mov [background_defined], 1
nosb31:
ret
nosb3:
@ -3203,7 +3211,7 @@ iglobal
endg
uglobal
background_defined db 0 ; diamond, 11.04.2006
background_defined db 0 ; diamond, 11.04.2006
endg
align 4
@ -3233,8 +3241,8 @@ checkmisc:
cmp [0xfff0],byte 0 ; background update ?
jz nobackgr
cmp [background_defined], 0
jz nobackgr
cmp [background_defined], 0
jz nobackgr
mov [0xfff0],byte 2
call change_task
mov [draw_data+32+0],dword 0
@ -4790,12 +4798,6 @@ syscall_reserveportarea: ; ReservePortArea and FreePortArea
mov [esp+36],eax
ret
;align 4
syscall_appints: ; AppInts
; mov [esp+36],dword -1
ret
align 4
syscall_threads: ; CreateThreads
@ -4879,6 +4881,42 @@ write_to_hd: ; Write a file to hd
; ret
;
; --------------- APM ---------------------
apm_entry dp 0
apm_vf dd 0
align 4
sys_apm:
cmp word [apm_vf], 0 ; Check APM BIOS enable
jne @f
or [esp + 40], byte 1 ; error
mov [esp + 36], dword 8 ; 32-bit protected-mode interface not supported
ret
@@: xchg eax, ecx
xchg ebx, ecx
cmp al, 3
ja @f
and [esp + 40], byte 0xfe ; emulate func 0..3 as func 0
mov eax, [apm_vf]
mov [esp + 36], eax
shr eax, 16
mov [esp + 32], eax
ret
@@: call pword [apm_entry] ; call APM BIOS
mov [esp + 8 ], edi
mov [esp + 12], esi
mov [esp + 24], ebx
mov [esp + 28], edx
mov [esp + 32], ecx
mov [esp + 36], eax
setc al
and [esp + 40], byte 0xfe
or [esp + 40], al
ret
; -----------------------------------------
align 4
undefined_syscall: ; Undefined system call

View File

@ -17,7 +17,9 @@
; 0:9020 8bytes pci data
; 0:9030 byte VRR start enabled 1, 2-no
; 0:9031 word IDEContrRegsBaseAddr
;
; 0x9040 - dword - entry point of APM BIOS
; 0x9044 - word - version (BCD)
; 0x9046 - word - flags
;
; Runtime:
;