sync with trunk
git-svn-id: svn://kolibrios.org@1198 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -681,6 +681,7 @@ EjectMedium:
|
|||||||
;* ChannelNumber - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; *
|
;* ChannelNumber - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; *
|
||||||
;* DiskNumber - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. *
|
;* DiskNumber - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. *
|
||||||
;*************************************************
|
;*************************************************
|
||||||
|
align 4
|
||||||
check_ATAPI_device_event:
|
check_ATAPI_device_event:
|
||||||
pusha
|
pusha
|
||||||
mov eax,[timer_ticks]
|
mov eax,[timer_ticks]
|
||||||
|
@@ -282,6 +282,7 @@ save_timer_fdd_motor:
|
|||||||
;*****************************************
|
;*****************************************
|
||||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||||
;*****************************************
|
;*****************************************
|
||||||
|
align 4
|
||||||
check_fdd_motor_status:
|
check_fdd_motor_status:
|
||||||
cmp [fdd_motor_status],0
|
cmp [fdd_motor_status],0
|
||||||
je end_check_fdd_motor_status_1
|
je end_check_fdd_motor_status_1
|
||||||
|
@@ -815,9 +815,12 @@ end if
|
|||||||
dec al
|
dec al
|
||||||
mov [boot_dev], al
|
mov [boot_dev], al
|
||||||
|
|
||||||
|
; GET MEMORY MAP
|
||||||
|
include 'detect/biosmem.inc'
|
||||||
|
|
||||||
; READ DISKETTE TO MEMORY
|
; READ DISKETTE TO MEMORY
|
||||||
|
|
||||||
; cmp [boot_dev],0
|
cmp [boot_dev],0
|
||||||
jne no_sys_on_floppy
|
jne no_sys_on_floppy
|
||||||
mov si,diskload
|
mov si,diskload
|
||||||
call print
|
call print
|
||||||
|
@@ -104,7 +104,7 @@ _rs db 186,'
|
|||||||
_bt db 186,' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',13,10,0
|
_bt db 186,' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',13,10,0
|
||||||
|
|
||||||
remark1 db "Default values were selected to match most of configurations, but not all.",0
|
remark1 db "Default values were selected to match most of configurations, but not all.",0
|
||||||
remark2 db "If you have LCD-monitor, disable VRR in the item [c] - you do not need it.",0
|
remark2 db "If you have CRT-monitor, enable VRR in the item [c].",0
|
||||||
remark3 db "If the system does not boot, try to disable the item [b].",0
|
remark3 db "If the system does not boot, try to disable the item [b].",0
|
||||||
remarks dw remark1, remark2, remark3
|
remarks dw remark1, remark2, remark3
|
||||||
num_remarks = 3
|
num_remarks = 3
|
||||||
|
@@ -109,7 +109,7 @@ save_quest db "J
|
|||||||
loader_block_error db "Alglaaduri andmed vigased, ei saa j<>tkata. Peatatud.",0
|
loader_block_error db "Alglaaduri andmed vigased, ei saa j<>tkata. Peatatud.",0
|
||||||
|
|
||||||
remark1 db "Default values were selected to match most of configurations, but not all.",0
|
remark1 db "Default values were selected to match most of configurations, but not all.",0
|
||||||
remark2 db "If you have LCD-monitor, disable VRR in the item [c] - you do not need it.",0
|
remark2 db "If you have CRT-monitor, enable VRR in the item [c].",0
|
||||||
remark3 db "If the system does not boot, try to disable the item [b].",0
|
remark3 db "If the system does not boot, try to disable the item [b].",0
|
||||||
remarks dw remark1, remark2, remark3
|
remarks dw remark1, remark2, remark3
|
||||||
num_remarks = 3
|
num_remarks = 3
|
||||||
|
@@ -114,7 +114,7 @@ save_quest db "Aktuelle Einstellungen speichern? [y/n]: ",0
|
|||||||
loader_block_error db "Bootloader Daten ungueltig, Kann nicht fortfahren. Angehalten.",0
|
loader_block_error db "Bootloader Daten ungueltig, Kann nicht fortfahren. Angehalten.",0
|
||||||
|
|
||||||
remark1 db "Default values were selected to match most of configurations, but not all.",0
|
remark1 db "Default values were selected to match most of configurations, but not all.",0
|
||||||
remark2 db "If you have LCD-monitor, disable VRR in the item [c] - you do not need it.",0
|
remark2 db "If you have CRT-monitor, enable VRR in the item [c].",0
|
||||||
remark3 db "If the system does not boot, try to disable the item [b].",0
|
remark3 db "If the system does not boot, try to disable the item [b].",0
|
||||||
remarks dw remark1, remark2, remark3
|
remarks dw remark1, remark2, remark3
|
||||||
num_remarks = 3
|
num_remarks = 3
|
||||||
|
@@ -85,7 +85,7 @@ _bt db 186,'
|
|||||||
|
|
||||||
|
|
||||||
remark1 db "<EFBFBD><EFBFBD><EFBFBD>祭<EFBFBD><EFBFBD> <20><> 㬮<>砭<EFBFBD><E7A0AD> <20><><EFBFBD>࠭<EFBFBD> <20><><EFBFBD> 㤮<><E3A4AE>⢠ <20><><EFBFBD><EFBFBD>設<EFBFBD>⢠, <20><> <20><> <20><><EFBFBD><EFBFBD>.",0
|
remark1 db "<EFBFBD><EFBFBD><EFBFBD>祭<EFBFBD><EFBFBD> <20><> 㬮<>砭<EFBFBD><E7A0AD> <20><><EFBFBD>࠭<EFBFBD> <20><><EFBFBD> 㤮<><E3A4AE>⢠ <20><><EFBFBD><EFBFBD>設<EFBFBD>⢠, <20><> <20><> <20><><EFBFBD><EFBFBD>.",0
|
||||||
remark2 db "<EFBFBD> <20> <20><><EFBFBD> LCD-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20>⪫<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> VRR <20> <20>㭪<EFBFBD><E3ADAA> [c] - <20><> <20><><EFBFBD> <20><> <20>㦥<EFBFBD>.",0
|
remark2 db "<EFBFBD> <20> <20><><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> VRR <20> <20>㭪<EFBFBD><E3ADAA> [c].",0
|
||||||
remark3 db "<EFBFBD> <20> <20><><EFBFBD> <20><> <20><>㧨<EFBFBD><E3A7A8><EFBFBD> <20><><EFBFBD>⥬<EFBFBD>, <20><><EFBFBD><EFBFBD><E0AEA1><EFBFBD><EFBFBD> <20>⪫<EFBFBD><E2AAAB><EFBFBD><EFBFBD><EFBFBD> <20>㭪<EFBFBD> [b].",0
|
remark3 db "<EFBFBD> <20> <20><><EFBFBD> <20><> <20><>㧨<EFBFBD><E3A7A8><EFBFBD> <20><><EFBFBD>⥬<EFBFBD>, <20><><EFBFBD><EFBFBD><E0AEA1><EFBFBD><EFBFBD> <20>⪫<EFBFBD><E2AAAB><EFBFBD><EFBFBD><EFBFBD> <20>㭪<EFBFBD> [b].",0
|
||||||
remarks dw remark1, remark2, remark3
|
remarks dw remark1, remark2, remark3
|
||||||
num_remarks = 3
|
num_remarks = 3
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
cls
|
||||||
set languages=en ru ge et
|
set languages=en ru ge et
|
||||||
set drivers=sound sis infinity ensoniq ps2mouse com_mouse uart ati2d vmode
|
set drivers=sound sis infinity ensoniq ps2mouse com_mouse uart ati2d vmode
|
||||||
set targets=all kernel drivers skins clean
|
set targets=all kernel drivers skins clean
|
||||||
@@ -74,6 +74,33 @@ goto :eof
|
|||||||
)
|
)
|
||||||
cd ..
|
cd ..
|
||||||
move bin\drivers\vmode.obj bin\drivers\vmode.mdr
|
move bin\drivers\vmode.obj bin\drivers\vmode.mdr
|
||||||
|
|
||||||
|
|
||||||
|
kpack >nul 2>&1
|
||||||
|
|
||||||
|
if %errorlevel%==9009 goto :Error_KpackFailed
|
||||||
|
|
||||||
|
echo *
|
||||||
|
echo ##############################################
|
||||||
|
echo *
|
||||||
|
echo Kpack KolibriOS drivers?
|
||||||
|
echo *
|
||||||
|
|
||||||
|
set /P res=[y/n]?
|
||||||
|
|
||||||
|
if "%res%"=="y" (
|
||||||
|
|
||||||
|
echo *
|
||||||
|
echo Compressing system
|
||||||
|
|
||||||
|
echo *
|
||||||
|
for %%a in (bin\drivers\*.obj) do (
|
||||||
|
echo ================== kpack %%a
|
||||||
|
kpack %%a
|
||||||
|
if not %errorlevel%==0 goto :Error_KpackFailed
|
||||||
|
)
|
||||||
|
|
||||||
|
)
|
||||||
goto :eof
|
goto :eof
|
||||||
|
|
||||||
|
|
||||||
@@ -95,11 +122,21 @@ goto :Exit_OK
|
|||||||
|
|
||||||
:Error_FasmFailed
|
:Error_FasmFailed
|
||||||
echo error: fasm execution failed
|
echo error: fasm execution failed
|
||||||
erase lang.inc
|
erase lang.inc >nul 2>&1
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
exit 1
|
||||||
|
|
||||||
|
:Error_KpackFailed
|
||||||
|
echo *** NOTICE ***
|
||||||
|
echo If you want to pack all applications you may
|
||||||
|
echo place "kpack" in accessible directory or system %PATH%.
|
||||||
|
echo You can get this tool from KolibriOS distribution kit.
|
||||||
pause
|
pause
|
||||||
exit 1
|
exit 1
|
||||||
|
|
||||||
:Exit_OK
|
:Exit_OK
|
||||||
echo all operations has been done
|
echo.
|
||||||
|
echo all operations have been done
|
||||||
pause
|
pause
|
||||||
exit 0
|
exit 0
|
||||||
|
@@ -186,7 +186,7 @@ TSS_SIZE equ (128+8192)
|
|||||||
|
|
||||||
OS_BASE equ 0x80000000
|
OS_BASE equ 0x80000000
|
||||||
|
|
||||||
window_data equ OS_BASE
|
window_data equ (OS_BASE+0x0001000)
|
||||||
|
|
||||||
CURRENT_TASK equ (OS_BASE+0x0003000)
|
CURRENT_TASK equ (OS_BASE+0x0003000)
|
||||||
TASK_COUNT equ (OS_BASE+0x0003004)
|
TASK_COUNT equ (OS_BASE+0x0003004)
|
||||||
@@ -331,7 +331,7 @@ LFB_BASE equ 0xFE000000
|
|||||||
|
|
||||||
new_app_base equ 0;
|
new_app_base equ 0;
|
||||||
|
|
||||||
twdw equ 0x3000 ;(CURRENT_TASK-window_data)
|
twdw equ 0x2000 ;(CURRENT_TASK-window_data)
|
||||||
|
|
||||||
std_application_base_address equ new_app_base
|
std_application_base_address equ new_app_base
|
||||||
RING0_STACK_SIZE equ (0x2000 - 512) ;512 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> FPU
|
RING0_STACK_SIZE equ (0x2000 - 512) ;512 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> FPU
|
||||||
@@ -469,8 +469,9 @@ struc EVENT
|
|||||||
.state dd ? ;internal flags
|
.state dd ? ;internal flags
|
||||||
.code dd ?
|
.code dd ?
|
||||||
rd 5
|
rd 5
|
||||||
|
.size = $ - .magic
|
||||||
|
.codesize = $ - .code
|
||||||
}
|
}
|
||||||
EVENT_SIZE equ 52
|
|
||||||
|
|
||||||
virtual at 0
|
virtual at 0
|
||||||
EVENT EVENT
|
EVENT EVENT
|
||||||
@@ -687,4 +688,3 @@ end virtual
|
|||||||
virtual at 0
|
virtual at 0
|
||||||
CSYM COFF_SYM
|
CSYM COFF_SYM
|
||||||
end virtual
|
end virtual
|
||||||
|
|
||||||
|
@@ -414,62 +414,3 @@ debugger_notify:
|
|||||||
or byte [SLOT_BASE+eax+APPDATA.event_mask+1], 1 ; set flag 100h
|
or byte [SLOT_BASE+eax+APPDATA.event_mask+1], 1 ; set flag 100h
|
||||||
.ret:
|
.ret:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
debug_exc:
|
|
||||||
test byte [esp+8+2], 2
|
|
||||||
jnz v86_debug_exc
|
|
||||||
; int 1 = #DB
|
|
||||||
save_ring3_context
|
|
||||||
cld
|
|
||||||
mov ax, app_data ;os_data
|
|
||||||
mov ds, ax
|
|
||||||
mov es, ax
|
|
||||||
mov eax, dr6
|
|
||||||
push eax
|
|
||||||
xor eax, eax
|
|
||||||
mov dr6, eax
|
|
||||||
; test if debugging
|
|
||||||
cli
|
|
||||||
mov eax, [current_slot]
|
|
||||||
mov eax, [eax+APPDATA.debugger_slot]
|
|
||||||
test eax, eax
|
|
||||||
jnz .debug
|
|
||||||
sti
|
|
||||||
; not debuggee => say error and terminate
|
|
||||||
add esp, 0x20+4
|
|
||||||
mov [error_interrupt], 1
|
|
||||||
call show_error_parameters
|
|
||||||
mov edx, [TASK_BASE]
|
|
||||||
mov byte [edx+TASKDATA.state], 4
|
|
||||||
jmp change_task
|
|
||||||
.debug:
|
|
||||||
; we are debugged process, notify debugger and suspend ourself
|
|
||||||
; eax=debugger PID
|
|
||||||
pop edx
|
|
||||||
mov ebx, dr7
|
|
||||||
mov cl, not 1
|
|
||||||
.l1:
|
|
||||||
test bl, 1
|
|
||||||
jnz @f
|
|
||||||
and dl, cl
|
|
||||||
@@:
|
|
||||||
shr ebx, 2
|
|
||||||
add cl, cl
|
|
||||||
inc ecx
|
|
||||||
cmp cl, not 10h
|
|
||||||
jnz .l1
|
|
||||||
push edx ; DR6 image
|
|
||||||
mov ecx, [TASK_BASE]
|
|
||||||
push dword [ecx+TASKDATA.pid] ; PID
|
|
||||||
push 12
|
|
||||||
pop ecx
|
|
||||||
push 3 ; 3 = debug exception
|
|
||||||
call debugger_notify
|
|
||||||
pop ecx
|
|
||||||
pop ecx
|
|
||||||
pop ecx
|
|
||||||
mov edx, [TASK_BASE]
|
|
||||||
mov byte [edx+TASKDATA.state], 1 ; suspended
|
|
||||||
call change_task
|
|
||||||
restore_ring3_context
|
|
||||||
iretd
|
|
||||||
|
@@ -131,11 +131,11 @@ kernel_export:
|
|||||||
dd szGetPid , get_pid
|
dd szGetPid , get_pid
|
||||||
dd szCreateObject , create_kernel_object
|
dd szCreateObject , create_kernel_object
|
||||||
dd szDestroyObject , destroy_kernel_object
|
dd szDestroyObject , destroy_kernel_object
|
||||||
dd szCreateEvent , create_event
|
dd szCreateEvent , create_event ;see EVENT.inc for specification
|
||||||
dd szRaiseEvent , raise_event
|
dd szRaiseEvent , raise_event ;see EVENT.inc for specification
|
||||||
dd szWaitEvent , wait_event
|
dd szWaitEvent , wait_event ;see EVENT.inc for specification
|
||||||
dd szDestroyEvent , destroy_event
|
dd szDestroyEvent , destroy_event ;see EVENT.inc for specification
|
||||||
dd szClearEvent , clear_event
|
dd szClearEvent , clear_event ;see EVENT.inc for specification
|
||||||
|
|
||||||
dd szLoadCursor , load_cursor ;stdcall
|
dd szLoadCursor , load_cursor ;stdcall
|
||||||
|
|
||||||
@@ -148,7 +148,7 @@ kernel_export:
|
|||||||
dd szSysMsgBoardChar , sys_msg_board
|
dd szSysMsgBoardChar , sys_msg_board
|
||||||
dd szGetCurrentTask , get_curr_task
|
dd szGetCurrentTask , get_curr_task
|
||||||
dd szLoadFile , load_file ;retval eax, ebx
|
dd szLoadFile , load_file ;retval eax, ebx
|
||||||
dd szSendEvent , send_event
|
dd szSendEvent , send_event ;see EVENT.inc for specification
|
||||||
dd szSetMouseData , set_mouse_data ;stdcall
|
dd szSetMouseData , set_mouse_data ;stdcall
|
||||||
dd szSleep , delay_ms
|
dd szSleep , delay_ms
|
||||||
dd szGetTimerTicks , get_timer_ticks
|
dd szGetTimerTicks , get_timer_ticks
|
||||||
@@ -170,4 +170,3 @@ exp_lfb:
|
|||||||
dd 0 ;terminator, must be zero
|
dd 0 ;terminator, must be zero
|
||||||
|
|
||||||
endg
|
endg
|
||||||
|
|
||||||
|
@@ -142,7 +142,7 @@ fpu_restore:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
e7: ;#NM exception handler
|
except_7: ;#NM exception handler
|
||||||
save_ring3_context
|
save_ring3_context
|
||||||
clts
|
clts
|
||||||
mov ax, app_data ;
|
mov ax, app_data ;
|
||||||
@@ -181,108 +181,3 @@ e7: ;#NM exception handler
|
|||||||
iglobal
|
iglobal
|
||||||
fpu_owner dd 0
|
fpu_owner dd 0
|
||||||
endg
|
endg
|
||||||
|
|
||||||
reg_eip equ ebp+4
|
|
||||||
reg_cs equ ebp+8
|
|
||||||
reg_eflags equ ebp+12
|
|
||||||
reg_esp equ ebp+16
|
|
||||||
reg_ss equ ebp+20
|
|
||||||
|
|
||||||
align 4
|
|
||||||
except_16: ;fpu native exceptions handler
|
|
||||||
test byte [esp+8+2], 2
|
|
||||||
jnz v86_except_16
|
|
||||||
push ebp
|
|
||||||
mov ebp, esp
|
|
||||||
|
|
||||||
push eax
|
|
||||||
push ebx
|
|
||||||
push ecx
|
|
||||||
push edx
|
|
||||||
|
|
||||||
mov ebx, [CURRENT_TASK]
|
|
||||||
shl ebx, 8
|
|
||||||
|
|
||||||
mov eax, [ebx+SLOT_BASE+APPDATA.fpu_handler]
|
|
||||||
test eax, eax
|
|
||||||
jz .default
|
|
||||||
|
|
||||||
mov ecx, [reg_eip]
|
|
||||||
mov edx, [reg_esp]
|
|
||||||
sub edx, 4
|
|
||||||
mov [edx], ecx
|
|
||||||
mov [reg_esp], edx
|
|
||||||
mov dword [reg_eip], eax
|
|
||||||
|
|
||||||
pop edx
|
|
||||||
pop ecx
|
|
||||||
pop ebx
|
|
||||||
pop eax
|
|
||||||
|
|
||||||
leave
|
|
||||||
iretd
|
|
||||||
|
|
||||||
.default:
|
|
||||||
pop edx
|
|
||||||
pop ecx
|
|
||||||
pop ebx
|
|
||||||
pop eax
|
|
||||||
leave
|
|
||||||
|
|
||||||
save_ring3_context ;debugger support
|
|
||||||
|
|
||||||
mov bl, 16
|
|
||||||
jmp exc_c
|
|
||||||
|
|
||||||
align 4
|
|
||||||
except_19: ;sse exceptions handler
|
|
||||||
test byte [esp+8+2], 2
|
|
||||||
jnz v86_except_19
|
|
||||||
push ebp
|
|
||||||
mov ebp, esp
|
|
||||||
|
|
||||||
push eax
|
|
||||||
push ebx
|
|
||||||
push ecx
|
|
||||||
push edx
|
|
||||||
|
|
||||||
mov ebx, [current_slot]
|
|
||||||
|
|
||||||
mov eax, [ebx+APPDATA.sse_handler]
|
|
||||||
test eax, eax
|
|
||||||
jz .default
|
|
||||||
|
|
||||||
mov ecx, [reg_eip]
|
|
||||||
mov edx, [reg_esp]
|
|
||||||
sub edx, 4
|
|
||||||
mov [edx], ecx
|
|
||||||
mov [reg_esp], edx
|
|
||||||
mov dword [reg_eip], eax
|
|
||||||
|
|
||||||
pop edx
|
|
||||||
pop ecx
|
|
||||||
pop ebx
|
|
||||||
pop eax
|
|
||||||
|
|
||||||
leave
|
|
||||||
iretd
|
|
||||||
|
|
||||||
.default:
|
|
||||||
pop edx
|
|
||||||
pop ecx
|
|
||||||
pop ebx
|
|
||||||
pop eax
|
|
||||||
leave
|
|
||||||
|
|
||||||
save_ring3_context ;debugger support
|
|
||||||
|
|
||||||
mov bl, 19
|
|
||||||
jmp exc_c
|
|
||||||
|
|
||||||
restore reg_eip
|
|
||||||
restore reg_cs
|
|
||||||
restore reg_eflags
|
|
||||||
restore reg_esp
|
|
||||||
restore reg_ss
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -91,7 +91,7 @@ macro remove_from_used op
|
|||||||
align 4
|
align 4
|
||||||
proc init_kernel_heap
|
proc init_kernel_heap
|
||||||
|
|
||||||
mov ecx, 64/4
|
mov ecx, 64
|
||||||
mov edi, mem_block_list
|
mov edi, mem_block_list
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
cld
|
cld
|
||||||
@@ -138,8 +138,9 @@ proc init_kernel_heap
|
|||||||
mov [ebx+list_bk], eax
|
mov [ebx+list_bk], eax
|
||||||
mov [ebx+block_base], HEAP_BASE+4096*MEM_BLOCK_SIZE
|
mov [ebx+block_base], HEAP_BASE+4096*MEM_BLOCK_SIZE
|
||||||
|
|
||||||
mov ecx, [MEM_AMOUNT]
|
mov ecx, [pg_data.kernel_pages]
|
||||||
sub ecx, (HEAP_BASE - OS_BASE + 4096*MEM_BLOCK_SIZE)
|
shl ecx, 12
|
||||||
|
sub ecx, HEAP_BASE+4096*MEM_BLOCK_SIZE
|
||||||
mov [heap_size], ecx
|
mov [heap_size], ecx
|
||||||
mov [heap_free], ecx
|
mov [heap_free], ecx
|
||||||
mov [ebx+block_size], ecx
|
mov [ebx+block_size], ecx
|
||||||
@@ -152,7 +153,7 @@ proc init_kernel_heap
|
|||||||
mov byte [mem_block_map], 0xFC
|
mov byte [mem_block_map], 0xFC
|
||||||
and [heap_mutex], 0
|
and [heap_mutex], 0
|
||||||
mov [heap_blocks], 4095
|
mov [heap_blocks], 4095
|
||||||
mov [free_blocks], 4095
|
mov [free_blocks], 4094
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
@@ -453,7 +453,7 @@ proc new_mem_resize stdcall, new_size:dword
|
|||||||
@@:
|
@@:
|
||||||
call alloc_page
|
call alloc_page
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .exit
|
jz .exit_pop
|
||||||
|
|
||||||
stdcall map_page_table, edi, eax
|
stdcall map_page_table, edi, eax
|
||||||
|
|
||||||
@@ -491,6 +491,9 @@ proc new_mem_resize stdcall, new_size:dword
|
|||||||
jb @B
|
jb @B
|
||||||
|
|
||||||
jmp .update_size
|
jmp .update_size
|
||||||
|
.exit_pop:
|
||||||
|
pop edi
|
||||||
|
pop esi
|
||||||
.exit:
|
.exit:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
inc eax
|
inc eax
|
||||||
@@ -544,23 +547,15 @@ get_pg_addr:
|
|||||||
|
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
|
; Now it is called from core/sys32::exc_c (see stack frame there)
|
||||||
proc page_fault_handler
|
proc page_fault_handler
|
||||||
|
|
||||||
test byte [esp+12+2], 2
|
|
||||||
jnz v86_page_fault
|
|
||||||
|
|
||||||
.err_code equ ebp+32
|
|
||||||
.err_addr equ ebp-4
|
.err_addr equ ebp-4
|
||||||
|
|
||||||
pushad
|
push ebx ;save exception number (#PF)
|
||||||
mov ebp, esp
|
mov ebp, esp
|
||||||
mov eax, cr2
|
mov ebx, cr2
|
||||||
push eax
|
push ebx ;that is locals: .err_addr = cr2
|
||||||
|
|
||||||
mov ax, app_data
|
|
||||||
mov ds, ax
|
|
||||||
mov es, ax
|
|
||||||
|
|
||||||
inc [pg_data.pages_faults]
|
inc [pg_data.pages_faults]
|
||||||
|
|
||||||
; push eax
|
; push eax
|
||||||
@@ -571,10 +566,9 @@ proc page_fault_handler
|
|||||||
; pop edx
|
; pop edx
|
||||||
; pop eax
|
; pop eax
|
||||||
|
|
||||||
mov ebx, [.err_addr]
|
mov eax, [pf_err_code]
|
||||||
mov eax, [.err_code]
|
|
||||||
|
|
||||||
cmp ebx, OS_BASE
|
cmp ebx, OS_BASE ;ebx == .err_addr
|
||||||
jb .user_space ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ;
|
jb .user_space ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ;
|
||||||
|
|
||||||
cmp ebx, page_tabs
|
cmp ebx, page_tabs
|
||||||
@@ -583,7 +577,7 @@ proc page_fault_handler
|
|||||||
cmp ebx, kernel_tabs
|
cmp ebx, kernel_tabs
|
||||||
jb .alloc;.app_tabs ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ;
|
jb .alloc;.app_tabs ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ;
|
||||||
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
if 0 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
cmp ebx, LFB_BASE
|
cmp ebx, LFB_BASE
|
||||||
jb .core_tabs ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
jb .core_tabs ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
@@ -591,8 +585,13 @@ proc page_fault_handler
|
|||||||
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LFB
|
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LFB
|
||||||
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
jmp .fail
|
jmp .fail
|
||||||
|
end if
|
||||||
|
.core_tabs:
|
||||||
|
.fail: ;simply return to caller
|
||||||
|
mov esp, ebp
|
||||||
|
pop ebx ;restore exception number (#PF)
|
||||||
|
ret
|
||||||
|
|
||||||
align 4
|
|
||||||
.user_space:
|
.user_space:
|
||||||
test eax, PG_MAP
|
test eax, PG_MAP
|
||||||
jnz .err_access ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
jnz .err_access ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
@@ -615,33 +614,32 @@ align 4
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail
|
jz .fail
|
||||||
|
|
||||||
stdcall map_page,[ebp-4],eax,dword PG_UW
|
stdcall map_page,[.err_addr],eax,dword PG_UW
|
||||||
|
|
||||||
mov edi, [ebp-4]
|
mov edi, [.err_addr]
|
||||||
and edi, 0xFFFFF000
|
and edi, 0xFFFFF000
|
||||||
mov ecx, 1024
|
mov ecx, 1024
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
cld
|
;cld ;caller is duty for this
|
||||||
rep stosd
|
rep stosd
|
||||||
.exit:
|
.exit: ;iret with repeat fault instruction
|
||||||
mov esp, ebp
|
add esp,12 ;clear in stack: locals(.err_addr) + #PF + ret_to_caller
|
||||||
popad
|
restore_ring3_context
|
||||||
add esp, 4
|
|
||||||
iretd
|
iretd
|
||||||
|
|
||||||
.err_access:
|
.err_access = .fail
|
||||||
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
jmp .fail
|
;jmp .fail
|
||||||
|
|
||||||
.kernel_space:
|
.kernel_space:
|
||||||
test eax, PG_MAP
|
test eax, PG_MAP
|
||||||
jz .fail ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
jz .fail ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
|
||||||
test eax, 4 ;U/S
|
test eax,12 ;U/S (+below)
|
||||||
jnz .fail ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
jnz .fail ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
test eax, 8
|
;test eax, 8
|
||||||
jnz .fail ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>
|
;jnz .fail ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>
|
||||||
;<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> P4/Xeon
|
;<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> P4/Xeon
|
||||||
|
|
||||||
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
@@ -660,7 +658,7 @@ align 4
|
|||||||
jz .fail
|
jz .fail
|
||||||
|
|
||||||
push eax
|
push eax
|
||||||
stdcall map_page,[ebp-4],eax,dword PG_SW
|
stdcall map_page,[.err_addr],eax,dword PG_SW
|
||||||
pop eax
|
pop eax
|
||||||
mov edi, [.err_addr]
|
mov edi, [.err_addr]
|
||||||
and edi, -4096
|
and edi, -4096
|
||||||
@@ -674,26 +672,9 @@ align 4
|
|||||||
|
|
||||||
add esi, [default_io_map]
|
add esi, [default_io_map]
|
||||||
mov ecx, 4096/4
|
mov ecx, 4096/4
|
||||||
cld
|
;cld ;caller is duty for this
|
||||||
rep movsd
|
rep movsd
|
||||||
jmp .exit
|
jmp .exit
|
||||||
|
|
||||||
|
|
||||||
;<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
|
|
||||||
.core_tabs:
|
|
||||||
.fail:
|
|
||||||
mov esp, ebp
|
|
||||||
popad
|
|
||||||
add esp, 4
|
|
||||||
|
|
||||||
; iretd
|
|
||||||
|
|
||||||
save_ring3_context ;debugger support
|
|
||||||
|
|
||||||
mov bl, 14
|
|
||||||
jmp exc_c
|
|
||||||
iretd
|
|
||||||
endp
|
endp
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
@@ -983,29 +964,29 @@ endp
|
|||||||
align 4
|
align 4
|
||||||
sysfn_meminfo:
|
sysfn_meminfo:
|
||||||
|
|
||||||
; add ebx, new_app_base
|
; add ecx, new_app_base
|
||||||
cmp ebx, OS_BASE
|
cmp ecx, OS_BASE
|
||||||
jae .fail
|
jae .fail
|
||||||
|
|
||||||
mov eax, [pg_data.pages_count]
|
mov eax, [pg_data.pages_count]
|
||||||
mov [ebx], eax
|
mov [ecx], eax
|
||||||
shl eax, 12
|
shl eax, 12
|
||||||
mov [esp+36], eax
|
mov [esp+32], eax
|
||||||
mov ecx, [pg_data.pages_free]
|
mov eax, [pg_data.pages_free]
|
||||||
mov [ebx+4], ecx
|
mov [ecx+4], eax
|
||||||
mov edx, [pg_data.pages_faults]
|
mov eax, [pg_data.pages_faults]
|
||||||
mov [ebx+8], edx
|
mov [ecx+8], eax
|
||||||
mov esi, [heap_size]
|
mov eax, [heap_size]
|
||||||
mov [ebx+12], esi
|
mov [ecx+12], eax
|
||||||
mov edi, [heap_free]
|
mov eax, [heap_free]
|
||||||
mov [ebx+16], edi
|
mov [ecx+16], eax
|
||||||
mov eax, [heap_blocks]
|
mov eax, [heap_blocks]
|
||||||
mov [ebx+20], eax
|
mov [ecx+20], eax
|
||||||
mov ecx, [free_blocks]
|
mov eax, [free_blocks]
|
||||||
mov [ebx+24], ecx
|
mov [ecx+24], eax
|
||||||
ret
|
ret
|
||||||
.fail:
|
.fail:
|
||||||
mov dword [esp+36], -1
|
mov dword [esp+32], -1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
@@ -1014,15 +995,17 @@ f68call:
|
|||||||
dd f68.12
|
dd f68.12
|
||||||
dd f68.13
|
dd f68.13
|
||||||
dd f68.14
|
dd f68.14
|
||||||
dd f68.15
|
dd f68.fail ;moved to f68.24
|
||||||
dd f68.16
|
dd f68.16
|
||||||
dd f68.17
|
dd f68.17
|
||||||
dd f68.18
|
dd f68.fail ;moved to f68.25
|
||||||
dd f68.19
|
dd f68.19
|
||||||
dd f68.20
|
dd f68.20
|
||||||
dd f68.21
|
dd f68.21
|
||||||
dd f68.22
|
dd f68.22
|
||||||
dd f68.23
|
dd f68.23
|
||||||
|
dd f68.24
|
||||||
|
dd f68.25
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
f68:
|
f68:
|
||||||
@@ -1032,7 +1015,7 @@ f68:
|
|||||||
cmp eax, 11
|
cmp eax, 11
|
||||||
jb .fail
|
jb .fail
|
||||||
|
|
||||||
cmp eax, 23
|
cmp eax, 25
|
||||||
ja .fail
|
ja .fail
|
||||||
|
|
||||||
jmp dword [f68call+eax*4-11*4]
|
jmp dword [f68call+eax*4-11*4]
|
||||||
@@ -1051,14 +1034,16 @@ f68:
|
|||||||
.14:
|
.14:
|
||||||
cmp ebx, OS_BASE
|
cmp ebx, OS_BASE
|
||||||
jae .fail
|
jae .fail
|
||||||
stdcall get_event_ex, ebx, ecx
|
mov edi,ebx
|
||||||
|
call get_event_ex
|
||||||
mov [esp+36], eax
|
mov [esp+36], eax
|
||||||
ret
|
ret
|
||||||
.15:
|
.24:
|
||||||
mov ecx, [current_slot]
|
mov eax, [current_slot]
|
||||||
mov eax, [ecx+APPDATA.fpu_handler]
|
xchg ebx, [eax+APPDATA.exc_handler]
|
||||||
mov [ecx+APPDATA.fpu_handler], ebx
|
xchg ecx, [eax+APPDATA.except_mask]
|
||||||
mov [esp+36], eax
|
mov [esp+36], ebx ; reg_eax+8
|
||||||
|
mov [esp+24], ecx ; reg_ebx+8
|
||||||
ret
|
ret
|
||||||
.16:
|
.16:
|
||||||
test ebx, ebx
|
test ebx, ebx
|
||||||
@@ -1072,12 +1057,15 @@ f68:
|
|||||||
call srv_handlerEx ;ebx
|
call srv_handlerEx ;ebx
|
||||||
mov [esp+36], eax
|
mov [esp+36], eax
|
||||||
ret
|
ret
|
||||||
.18:
|
.25:
|
||||||
mov ecx, [current_slot]
|
cmp ebx,32
|
||||||
mov eax, [ecx+APPDATA.sse_handler]
|
jae .fail
|
||||||
mov [ecx+APPDATA.sse_handler], ebx
|
mov eax, [current_slot]
|
||||||
mov [esp+36], eax
|
btr [eax+APPDATA.except_mask],ebx
|
||||||
ret
|
setc byte[esp+36]
|
||||||
|
jecxz @f
|
||||||
|
bts [eax+APPDATA.except_mask],ebx
|
||||||
|
@@: ret
|
||||||
.19:
|
.19:
|
||||||
cmp ebx, OS_BASE
|
cmp ebx, OS_BASE
|
||||||
jae .fail
|
jae .fail
|
||||||
@@ -1318,6 +1306,3 @@ proc create_ring_buffer stdcall, size:dword, flags:dword
|
|||||||
.fail:
|
.fail:
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -16,74 +16,35 @@ $Revision: 907 $
|
|||||||
align 32
|
align 32
|
||||||
irq0:
|
irq0:
|
||||||
pushad
|
pushad
|
||||||
mov ax, app_data ;
|
Mov ds, ax, app_data
|
||||||
mov ds, ax
|
|
||||||
mov es, ax
|
mov es, ax
|
||||||
|
inc [timer_ticks]
|
||||||
; cmp dword[CURRENT_TASK], 1
|
|
||||||
; jnz @f
|
|
||||||
; mov eax, [esp + 32]
|
|
||||||
; cmp eax, idle_loop + 1
|
|
||||||
; jz @f
|
|
||||||
; DEBUGF 1, "K : OOOPS! EAX = 0x%x\n", eax
|
|
||||||
; @@:
|
|
||||||
|
|
||||||
inc dword [timer_ticks]
|
|
||||||
|
|
||||||
mov eax, [timer_ticks]
|
mov eax, [timer_ticks]
|
||||||
call playNote ; <<<--- Speaker driver
|
call playNote ; <<<--- Speaker driver
|
||||||
|
sub eax,[next_usage_update]
|
||||||
cmp eax,[next_usage_update]
|
cmp eax,100
|
||||||
jb .nocounter
|
jb .nocounter
|
||||||
add eax,100
|
add [next_usage_update],100
|
||||||
mov [next_usage_update],eax
|
|
||||||
call updatecputimes
|
call updatecputimes
|
||||||
.nocounter:
|
.nocounter:
|
||||||
cmp [DONT_SWITCH], byte 1
|
|
||||||
jne .change_task
|
|
||||||
|
|
||||||
mov al,0x20 ; send End Of Interrupt signal
|
mov al,0x20 ; send End Of Interrupt signal
|
||||||
mov dx,0x20
|
out 0x20,al
|
||||||
out dx,al
|
btr dword[DONT_SWITCH], 0
|
||||||
|
jc .return
|
||||||
mov [DONT_SWITCH], byte 0
|
|
||||||
|
|
||||||
popad
|
|
||||||
iretd
|
|
||||||
|
|
||||||
.change_task:
|
|
||||||
call update_counters
|
|
||||||
|
|
||||||
call find_next_task
|
call find_next_task
|
||||||
mov ecx, eax
|
jz .return ; if there is only one running process
|
||||||
|
|
||||||
mov al,0x20 ; send End Of Interrupt signal
|
|
||||||
mov dx,0x20
|
|
||||||
out dx,al
|
|
||||||
|
|
||||||
test ecx, ecx ; if there is only one running process
|
|
||||||
jnz .return
|
|
||||||
|
|
||||||
call do_change_task
|
call do_change_task
|
||||||
|
|
||||||
.return:
|
.return:
|
||||||
popad
|
popad
|
||||||
; popfd
|
|
||||||
iretd
|
iretd
|
||||||
|
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
change_task:
|
change_task:
|
||||||
|
|
||||||
pushfd
|
pushfd
|
||||||
cli
|
cli
|
||||||
pushad
|
pushad
|
||||||
|
|
||||||
call update_counters
|
|
||||||
|
|
||||||
if 0
|
if 0
|
||||||
|
; \begin{Mario79} ; <- must be refractoried, if used...
|
||||||
; \begin{Mario79}
|
|
||||||
cmp [dma_task_switched], 1
|
cmp [dma_task_switched], 1
|
||||||
jne .find_next_task
|
jne .find_next_task
|
||||||
mov [dma_task_switched], 0
|
mov [dma_task_switched], 0
|
||||||
@@ -96,195 +57,152 @@ if 0
|
|||||||
jmp @f
|
jmp @f
|
||||||
.find_next_task:
|
.find_next_task:
|
||||||
; \end{Mario79}
|
; \end{Mario79}
|
||||||
|
|
||||||
end if
|
end if
|
||||||
|
|
||||||
call find_next_task
|
call find_next_task
|
||||||
test eax, eax ; the same task -> skip switch
|
jz .return ; the same task -> skip switch
|
||||||
jnz .return
|
@@: mov byte[DONT_SWITCH], 1
|
||||||
@@:
|
|
||||||
mov [DONT_SWITCH],byte 1
|
|
||||||
call do_change_task
|
call do_change_task
|
||||||
|
|
||||||
.return:
|
.return:
|
||||||
popad
|
popad
|
||||||
popfd
|
popfd
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
uglobal
|
uglobal
|
||||||
align 4
|
align 4
|
||||||
far_jump:
|
; far_jump:
|
||||||
.offs dd ?
|
; .offs dd ?
|
||||||
.sel dw ?
|
; .sel dw ?
|
||||||
context_counter dd ? ;noname & halyavin
|
context_counter dd 0 ;noname & halyavin
|
||||||
next_usage_update dd ?
|
next_usage_update dd 0
|
||||||
timer_ticks dd ?
|
timer_ticks dd 0
|
||||||
prev_slot dd ?
|
; prev_slot dd ?
|
||||||
event_sched dd ?
|
; event_sched dd ?
|
||||||
endg
|
endg
|
||||||
|
|
||||||
|
align 4
|
||||||
update_counters:
|
update_counters:
|
||||||
mov edi, [TASK_BASE]
|
mov edi, [TASK_BASE]
|
||||||
mov ebx, [edi+TASKDATA.counter_add] ; time stamp counter add
|
|
||||||
rdtsc
|
rdtsc
|
||||||
sub eax, ebx
|
sub eax, [edi+TASKDATA.counter_add] ; time stamp counter add
|
||||||
add eax, [edi+TASKDATA.counter_sum] ; counter sum
|
add [edi+TASKDATA.counter_sum], eax ; counter sum
|
||||||
mov [edi+TASKDATA.counter_sum], eax
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
; Find next task to execute
|
|
||||||
; result: ebx = number of the selected task
|
|
||||||
; eax = 1 if the task is the same
|
|
||||||
; edi = address of the data for the task in ebx
|
|
||||||
; [0x3000] = ebx and [0x3010] = edi
|
|
||||||
; corrupts other regs
|
|
||||||
find_next_task:
|
|
||||||
mov ebx, [CURRENT_TASK]
|
|
||||||
mov edi, [TASK_BASE]
|
|
||||||
mov [prev_slot], ebx
|
|
||||||
|
|
||||||
.waiting_for_termination:
|
|
||||||
.waiting_for_reuse:
|
|
||||||
.waiting_for_event:
|
|
||||||
.suspended:
|
|
||||||
cmp ebx, [TASK_COUNT]
|
|
||||||
jb @f
|
|
||||||
mov edi, CURRENT_TASK
|
|
||||||
xor ebx, ebx
|
|
||||||
@@:
|
|
||||||
|
|
||||||
add edi,0x20
|
|
||||||
inc ebx
|
|
||||||
|
|
||||||
mov al, byte [edi+TASKDATA.state]
|
|
||||||
test al, al
|
|
||||||
jz .found
|
|
||||||
cmp al, 1
|
|
||||||
jz .suspended
|
|
||||||
cmp al, 2
|
|
||||||
jz .suspended
|
|
||||||
cmp al, 3
|
|
||||||
je .waiting_for_termination
|
|
||||||
cmp al, 4
|
|
||||||
je .waiting_for_termination
|
|
||||||
cmp al, 9
|
|
||||||
je .waiting_for_reuse
|
|
||||||
|
|
||||||
mov [CURRENT_TASK],ebx
|
|
||||||
mov [TASK_BASE],edi
|
|
||||||
|
|
||||||
cmp al, 5
|
|
||||||
jne .noevents
|
|
||||||
call get_event_for_app
|
|
||||||
test eax, eax
|
|
||||||
jnz @f
|
|
||||||
mov eax, ebx
|
|
||||||
shl eax, 8
|
|
||||||
mov eax, [SLOT_BASE + APPDATA.wait_timeout + eax]
|
|
||||||
cmp eax, [timer_ticks]
|
|
||||||
jae .waiting_for_event
|
|
||||||
xor eax, eax
|
|
||||||
@@:
|
|
||||||
mov [event_sched], eax
|
|
||||||
mov [edi+TASKDATA.state], byte 0
|
|
||||||
.noevents:
|
|
||||||
.found:
|
|
||||||
mov [CURRENT_TASK],ebx
|
|
||||||
mov [TASK_BASE],edi
|
|
||||||
rdtsc ;call _rdtsc
|
|
||||||
mov [edi+TASKDATA.counter_add],eax
|
|
||||||
|
|
||||||
mov esi, [prev_slot]
|
|
||||||
xor eax, eax
|
|
||||||
cmp ebx, esi
|
|
||||||
sete al
|
|
||||||
ret
|
|
||||||
|
|
||||||
; param
|
|
||||||
; ebx = incoming task
|
|
||||||
; esi = outcomig task
|
|
||||||
|
|
||||||
do_change_task:
|
|
||||||
|
|
||||||
shl ebx, 8
|
|
||||||
add ebx, SLOT_BASE
|
|
||||||
mov [current_slot], ebx
|
|
||||||
|
|
||||||
shl esi, 8
|
|
||||||
add esi, SLOT_BASE
|
|
||||||
|
|
||||||
mov [esi+APPDATA.saved_esp], esp
|
|
||||||
mov esp, [ebx+APPDATA.saved_esp]
|
|
||||||
|
|
||||||
; set thread io map
|
|
||||||
|
|
||||||
mov ecx, [ebx+APPDATA.io_map]
|
|
||||||
mov edx, [ebx+APPDATA.io_map+4]
|
|
||||||
mov dword [page_tabs+((tss._io_map_0 and -4096) shr 10)], ecx
|
|
||||||
mov dword [page_tabs+((tss._io_map_1 and -4096) shr 10)], edx
|
|
||||||
|
|
||||||
mov eax, [ebx+APPDATA.dir_table]
|
|
||||||
cmp eax, [esi+APPDATA.dir_table]
|
|
||||||
je @F
|
|
||||||
mov cr3, eax
|
|
||||||
@@:
|
|
||||||
mov eax, [ebx+APPDATA.saved_esp0]
|
|
||||||
mov [tss._esp0], eax
|
|
||||||
mov ax, graph_data
|
|
||||||
mov gs, ax
|
|
||||||
|
|
||||||
mov eax, [CURRENT_TASK]
|
|
||||||
cmp eax, [fpu_owner]
|
|
||||||
clts ;clear a task switch flag
|
|
||||||
je @F
|
|
||||||
;and set it again if the owner
|
|
||||||
mov ecx, cr0 ;of a fpu has changed
|
|
||||||
or ecx, CR0_TS
|
|
||||||
mov cr0, ecx
|
|
||||||
@@:
|
|
||||||
inc [context_counter] ;noname & halyavin
|
|
||||||
test [ebx+APPDATA.dbg_state], 1
|
|
||||||
jnz @F
|
|
||||||
ret
|
|
||||||
@@:
|
|
||||||
mov eax, [ebx+APPDATA.dbg_regs.dr0]
|
|
||||||
mov dr0, eax
|
|
||||||
mov eax, [ebx+APPDATA.dbg_regs.dr1]
|
|
||||||
mov dr1, eax
|
|
||||||
mov eax, [ebx+APPDATA.dbg_regs.dr2]
|
|
||||||
mov dr2, eax
|
|
||||||
mov eax, [ebx+APPDATA.dbg_regs.dr3]
|
|
||||||
mov dr3, eax
|
|
||||||
xor eax, eax
|
|
||||||
mov dr6, eax
|
|
||||||
mov eax, [ebx+APPDATA.dbg_regs.dr7]
|
|
||||||
mov dr7, eax
|
|
||||||
ret
|
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
updatecputimes:
|
updatecputimes:
|
||||||
|
xor eax,eax
|
||||||
mov eax,[idleuse]
|
xchg eax,[idleuse]
|
||||||
mov [idleusesec],eax
|
mov [idleusesec],eax
|
||||||
mov [idleuse],dword 0
|
|
||||||
mov ecx, [TASK_COUNT]
|
mov ecx, [TASK_COUNT]
|
||||||
mov edi, TASK_DATA
|
mov edi, TASK_DATA
|
||||||
.newupdate:
|
.newupdate:
|
||||||
mov ebx,[edi+TASKDATA.counter_sum]
|
xor eax,eax
|
||||||
mov [edi+TASKDATA.cpu_usage],ebx
|
xchg eax,[edi+TASKDATA.counter_sum]
|
||||||
mov [edi+TASKDATA.counter_sum],dword 0
|
mov [edi+TASKDATA.cpu_usage],eax
|
||||||
add edi,0x20
|
add edi,0x20
|
||||||
dec ecx
|
loop .newupdate
|
||||||
jnz .newupdate
|
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
align 4
|
||||||
|
find_next_task:
|
||||||
|
;info:
|
||||||
|
; Find next task to execute
|
||||||
|
;retval:
|
||||||
|
; ebx = address of the APPDATA for the selected task (slot-base)
|
||||||
|
; esi = previous slot-base ([current_slot] at the begin)
|
||||||
|
; edi = address of the TASKDATA for the selected task
|
||||||
|
; ZF = 1 if the task is the same
|
||||||
|
;warning:
|
||||||
|
; [CURRENT_TASK] = bh , [TASK_BASE] = edi -- as result
|
||||||
|
; [current_slot] is not set to new value (ebx)!!!
|
||||||
|
;scratched: eax,ecx
|
||||||
|
call update_counters ; edi := [TASK_BASE]
|
||||||
|
Mov esi, ebx, [current_slot]
|
||||||
|
.loop:
|
||||||
|
cmp bh,[TASK_COUNT]
|
||||||
|
jb @f
|
||||||
|
xor bh, bh
|
||||||
|
mov edi,CURRENT_TASK
|
||||||
|
@@: inc bh ; ebx += APPDATA.size
|
||||||
|
add edi,0x20 ; edi += TASKDATA.size
|
||||||
|
mov al, [edi+TASKDATA.state]
|
||||||
|
test al, al
|
||||||
|
jz .found ; state == 0
|
||||||
|
cmp al, 5
|
||||||
|
jne .loop ; state == 1,2,3,4,9
|
||||||
|
; state == 5
|
||||||
|
pushad ; more freedom for [APPDATA.wait_test]
|
||||||
|
call [ebx+APPDATA.wait_test]
|
||||||
|
mov [esp+28],eax
|
||||||
|
popad
|
||||||
|
or eax,eax
|
||||||
|
jnz @f
|
||||||
|
; testing for timeout
|
||||||
|
mov ecx, [timer_ticks]
|
||||||
|
sub ecx, [ebx+APPDATA.wait_begin]
|
||||||
|
cmp ecx, [ebx+APPDATA.wait_timeout]
|
||||||
|
jb .loop
|
||||||
|
@@: mov [ebx+APPDATA.wait_param], eax ; retval for wait
|
||||||
|
mov [edi+TASKDATA.state], 0
|
||||||
|
.found:
|
||||||
|
mov [CURRENT_TASK],bh
|
||||||
|
mov [TASK_BASE],edi
|
||||||
|
rdtsc ;call _rdtsc
|
||||||
|
mov [edi+TASKDATA.counter_add],eax ; for next using update_counters
|
||||||
|
cmp ebx, esi ;esi - previous slot-base
|
||||||
|
ret
|
||||||
|
;TODO: <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> do_change_task <EFBFBD><EFBFBD> V86...
|
||||||
|
; <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> TASKDATA.counter_add/sum <EFBFBD> do_change_task
|
||||||
|
|
||||||
|
align 4
|
||||||
|
do_change_task:
|
||||||
|
;param:
|
||||||
|
; ebx = address of the APPDATA for incoming task (new)
|
||||||
|
;warning:
|
||||||
|
; [CURRENT_TASK] and [TASK_BASE] must be changed before (e.g. in find_next_task)
|
||||||
|
; [current_slot] is the outcoming (old), and set here to a new value (ebx)
|
||||||
|
;scratched: eax,ecx,esi
|
||||||
|
mov esi,ebx
|
||||||
|
xchg esi,[current_slot]
|
||||||
|
; set new stack after saving old
|
||||||
|
mov [esi+APPDATA.saved_esp], esp
|
||||||
|
mov esp, [ebx+APPDATA.saved_esp]
|
||||||
|
; set new thread io-map
|
||||||
|
Mov dword [page_tabs+((tss._io_map_0 and -4096) shr 10)],eax,[ebx+APPDATA.io_map]
|
||||||
|
Mov dword [page_tabs+((tss._io_map_1 and -4096) shr 10)],eax,[ebx+APPDATA.io_map+4]
|
||||||
|
; set new thread memory-map
|
||||||
|
mov ecx, APPDATA.dir_table
|
||||||
|
mov eax, [ebx+ecx] ;offset>0x7F
|
||||||
|
cmp eax, [esi+ecx] ;offset>0x7F
|
||||||
|
je @f
|
||||||
|
mov cr3, eax
|
||||||
|
@@: ; set tss.esp0
|
||||||
|
Mov [tss._esp0],eax,[ebx+APPDATA.saved_esp0]
|
||||||
|
; set gs selector unconditionally
|
||||||
|
Mov gs,ax,graph_data
|
||||||
|
; set CR0.TS
|
||||||
|
cmp bh, byte[fpu_owner] ;bh == incoming task (new)
|
||||||
|
clts ;clear a task switch flag
|
||||||
|
je @f
|
||||||
|
mov eax, cr0 ;and set it again if the owner
|
||||||
|
or eax, CR0_TS ;of a fpu has changed
|
||||||
|
mov cr0, eax
|
||||||
|
@@: ; set context_counter (only for user pleasure ???)
|
||||||
|
inc [context_counter] ;noname & halyavin
|
||||||
|
; set debug-registers, if it's necessary
|
||||||
|
test byte[ebx+APPDATA.dbg_state], 1
|
||||||
|
jz @f
|
||||||
|
xor eax, eax
|
||||||
|
mov dr6, eax
|
||||||
|
lea esi,[ebx+ecx+APPDATA.dbg_regs-APPDATA.dir_table] ;offset>0x7F
|
||||||
|
cld
|
||||||
|
macro lodsReg [reg] {
|
||||||
|
lodsd
|
||||||
|
mov reg,eax
|
||||||
|
} lodsReg dr0, dr1, dr2, dr3, dr7
|
||||||
|
purge lodsReg
|
||||||
|
@@: ret
|
||||||
|
;end.
|
||||||
|
|
||||||
if 0
|
if 0
|
||||||
|
|
||||||
|
|
||||||
struc TIMER
|
struc TIMER
|
||||||
{
|
{
|
||||||
.next dd ?
|
.next dd ?
|
||||||
@@ -293,14 +211,6 @@ struc TIMER
|
|||||||
.arg dd ?
|
.arg dd ?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MAX_PROIRITY 0 ; highest, used for kernel tasks
|
MAX_PROIRITY 0 ; highest, used for kernel tasks
|
||||||
MAX_USER_PRIORITY 0 ; highest priority for user processes
|
MAX_USER_PRIORITY 0 ; highest priority for user processes
|
||||||
USER_PRIORITY 7 ; default (should correspond to nice 0)
|
USER_PRIORITY 7 ; default (should correspond to nice 0)
|
||||||
@@ -310,7 +220,6 @@ NR_SCHED_QUEUES 16 ; MUST equal IDLE_PRIORYTY + 1
|
|||||||
|
|
||||||
rdy_head rd 16
|
rdy_head rd 16
|
||||||
|
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
pick_task:
|
pick_task:
|
||||||
|
|
||||||
@@ -330,7 +239,6 @@ pick_task:
|
|||||||
inc eax
|
inc eax
|
||||||
jmp .pick
|
jmp .pick
|
||||||
|
|
||||||
|
|
||||||
; param
|
; param
|
||||||
; eax= task
|
; eax= task
|
||||||
;
|
;
|
||||||
@@ -338,7 +246,6 @@ pick_task:
|
|||||||
; eax= task
|
; eax= task
|
||||||
; ebx= queue
|
; ebx= queue
|
||||||
; ecx= front if 1 or back if 0
|
; ecx= front if 1 or back if 0
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
shed:
|
shed:
|
||||||
cmp [eax+.tics_left], 0 ;signed compare
|
cmp [eax+.tics_left], 0 ;signed compare
|
||||||
@@ -356,7 +263,6 @@ shed:
|
|||||||
|
|
||||||
; param
|
; param
|
||||||
; eax= task
|
; eax= task
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
enqueue:
|
enqueue:
|
||||||
call shed ;eax
|
call shed ;eax
|
||||||
@@ -385,4 +291,3 @@ enqueue:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
@@ -14,212 +14,227 @@
|
|||||||
$Revision: 982 $
|
$Revision: 982 $
|
||||||
|
|
||||||
|
|
||||||
align 4
|
align 4 ;3A08
|
||||||
idtreg:
|
|
||||||
dw 8*0x41-1
|
|
||||||
dd idts+8
|
|
||||||
|
|
||||||
build_interrupt_table:
|
build_interrupt_table:
|
||||||
|
mov edi, idts
|
||||||
mov edi, idts+8
|
|
||||||
mov esi, sys_int
|
mov esi, sys_int
|
||||||
mov ecx, 0x40
|
mov ecx, 0x40
|
||||||
@@:
|
mov eax, (10001110b shl 24) + os_code
|
||||||
lodsd
|
@@: movsw ;low word of code-entry
|
||||||
mov [edi], ax ; lower part of offset
|
stosd ;interrupt gate type : os_code selector
|
||||||
mov [edi+2], word os_code ; segment selector
|
movsw ;high word of code-entry
|
||||||
mov ax, word 10001110b shl 8 ; type: interrupt gate
|
|
||||||
mov [edi+4], eax
|
|
||||||
add edi, 8
|
|
||||||
loop @b
|
loop @b
|
||||||
|
movsd ;copy low dword of trap gate for int 0x40
|
||||||
;mov edi,8*0x40+idts+8
|
movsd ;copy high dword of trap gate for int 0x40
|
||||||
mov dword [edi], (i40 and 0xFFFF) or (os_code shl 16)
|
lidt [esi]
|
||||||
mov dword [edi+4], (11101111b shl 8) or (i40 and 0xFFFF0000)
|
|
||||||
; type: trap gate
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
iglobal
|
iglobal
|
||||||
|
align 4
|
||||||
msg_sel_ker db "kernel", 0
|
|
||||||
msg_sel_app db "application", 0
|
|
||||||
|
|
||||||
sys_int:
|
sys_int:
|
||||||
dd e0,debug_exc,e2,e3
|
;exception handlers addresses (for interrupt gate construction)
|
||||||
dd e4,e5,e6,e7
|
dd e0,e1,e2,e3,e4,e5,e6,except_7 ; SEE: core/fpu.inc
|
||||||
dd e8,e9,e10,e11
|
dd e8,e9,e10,e11,e12,e13,page_fault_exc,e15
|
||||||
dd e12,e13,page_fault_handler,e15
|
dd e16, e17,e18, e19
|
||||||
|
times 12 dd unknown_interrupt ;int_20..int_31
|
||||||
dd except_16, e17,e18, except_19
|
|
||||||
times 12 dd unknown_interrupt
|
|
||||||
|
|
||||||
|
;interrupt handlers addresses (for interrupt gate construction)
|
||||||
dd irq0, irq_serv.irq_1, irq_serv.irq_2
|
dd irq0, irq_serv.irq_1, irq_serv.irq_2
|
||||||
if USE_COM_IRQ
|
if USE_COM_IRQ
|
||||||
dd irq_serv.irq_3, irq_serv.irq_4
|
dd irq_serv.irq_3, irq_serv.irq_4
|
||||||
else
|
else
|
||||||
dd p_irq3, p_irq4
|
dd p_irq3, p_irq4 ;??? <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
end if
|
end if
|
||||||
dd irq_serv.irq_5, p_irq6, irq_serv.irq_7
|
dd irq_serv.irq_5, p_irq6, irq_serv.irq_7
|
||||||
dd irq_serv.irq_8, irq_serv.irq_9, irq_serv.irq_10
|
dd irq_serv.irq_8, irq_serv.irq_9, irq_serv.irq_10
|
||||||
dd irq_serv.irq_11, irq_serv.irq_12, irqD,p_irq14,p_irq15
|
dd irq_serv.irq_11, irq_serv.irq_12, irqD,p_irq14,p_irq15
|
||||||
|
times 16 dd unknown_interrupt ;int_0x30..int_0x3F
|
||||||
|
|
||||||
times 16 dd unknown_interrupt
|
;int_0x40 gate trap (for directly copied)
|
||||||
|
dw i40 and 0xFFFF, os_code, 11101111b shl 8, i40 shr 16
|
||||||
|
|
||||||
|
idtreg: ; data for LIDT instruction (!!! must be immediately below sys_int data)
|
||||||
|
dw 2*($-sys_int-4)-1
|
||||||
|
dd idts ;0x8000B100
|
||||||
|
dw 0 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
|
||||||
|
msg_fault_sel dd msg_exc_8,msg_exc_u,msg_exc_a,msg_exc_b
|
||||||
|
dd msg_exc_c,msg_exc_d,msg_exc_e
|
||||||
|
|
||||||
|
msg_exc_8 db "Double fault", 0
|
||||||
|
msg_exc_u db "Undefined Exception", 0
|
||||||
|
msg_exc_a db "Invalid TSS", 0
|
||||||
|
msg_exc_b db "Segment not present", 0
|
||||||
|
msg_exc_c db "Stack fault", 0
|
||||||
|
msg_exc_d db "General protection fault", 0
|
||||||
|
msg_exc_e db "Page fault", 0
|
||||||
|
|
||||||
|
msg_sel_ker db "kernel", 0
|
||||||
|
msg_sel_app db "application", 0
|
||||||
|
|
||||||
dd i40
|
|
||||||
endg
|
endg
|
||||||
|
|
||||||
macro save_ring3_context
|
macro save_ring3_context {
|
||||||
{
|
|
||||||
pushad
|
pushad
|
||||||
}
|
}
|
||||||
macro restore_ring3_context
|
macro restore_ring3_context {
|
||||||
{
|
|
||||||
popad
|
popad
|
||||||
}
|
}
|
||||||
|
macro exc_wo_code [num] {
|
||||||
; simply return control to interrupted process
|
|
||||||
unknown_interrupt:
|
|
||||||
iret
|
|
||||||
|
|
||||||
macro exc_wo_code [num]
|
|
||||||
{
|
|
||||||
forward
|
|
||||||
e#num :
|
e#num :
|
||||||
save_ring3_context
|
save_ring3_context
|
||||||
mov bl, num
|
mov bl, num
|
||||||
jmp exc_c
|
jmp exc_c
|
||||||
}
|
} exc_wo_code 0,1,2,3,4,5,6,15,16,19
|
||||||
|
|
||||||
macro exc_w_code [num]
|
macro exc_w_code [num] {
|
||||||
{
|
|
||||||
forward
|
|
||||||
e#num :
|
e#num :
|
||||||
add esp, 4
|
add esp, 4
|
||||||
save_ring3_context
|
save_ring3_context
|
||||||
mov bl, num
|
mov bl, num
|
||||||
jmp exc_c
|
jmp exc_c
|
||||||
}
|
} exc_w_code 8,9,10,11,12,13,17,18
|
||||||
|
|
||||||
exc_wo_code 0, 2, 3, 4, 5, 6, 9, 15, 18
|
|
||||||
exc_w_code 8, 10, 11, 12, 13, 14, 17
|
|
||||||
|
|
||||||
exc_c:
|
uglobal
|
||||||
mov ax, app_data ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
pf_err_code dd ?
|
||||||
mov ds, ax ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
endg
|
||||||
mov es, ax ;<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
|
|
||||||
|
page_fault_exc: ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...
|
||||||
|
pop [ss:pf_err_code]; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> #PF
|
||||||
|
save_ring3_context
|
||||||
|
mov bl,14
|
||||||
|
|
||||||
|
exc_c: ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 7-<EFBFBD><EFBFBD> - #NM)
|
||||||
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> 3-<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> + pushad (<EFBFBD>.<EFBFBD>., <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||||
|
reg_ss equ esp+0x30
|
||||||
|
reg_esp3 equ esp+0x2C
|
||||||
|
reg_eflags equ esp+0x28
|
||||||
|
reg_cs3 equ esp+0x24
|
||||||
|
reg_eip equ esp+0x20
|
||||||
|
; <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> pushad
|
||||||
|
reg_eax equ esp+0x1C
|
||||||
|
reg_ecx equ esp+0x18
|
||||||
|
reg_edx equ esp+0x14
|
||||||
|
reg_ebx equ esp+0x10
|
||||||
|
reg_esp0 equ esp+0x0C
|
||||||
|
reg_ebp equ esp+0x08
|
||||||
|
reg_esi equ esp+0x04
|
||||||
|
reg_edi equ esp+0x00
|
||||||
|
|
||||||
|
Mov ds,ax,app_data ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
mov es,ax ; <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
cld ; <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DF <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
movzx ebx,bl
|
||||||
; redirect to V86 manager? (EFLAGS & 0x20000) != 0?
|
; redirect to V86 manager? (EFLAGS & 0x20000) != 0?
|
||||||
test byte [esp+20h+8+2], 2
|
test byte[reg_eflags+2],2
|
||||||
jnz v86_exc_c
|
jnz v86_exc_c
|
||||||
|
cmp bl,14 ; #PF
|
||||||
; test if debugging
|
jne @f
|
||||||
cli
|
call page_fault_handler ; SEE: core/memory.inc
|
||||||
mov eax, [current_slot]
|
@@: mov esi, [current_slot]
|
||||||
mov eax, [eax+APPDATA.debugger_slot]
|
btr [esi+APPDATA.except_mask], ebx
|
||||||
|
jnc @f
|
||||||
|
mov eax,[esi+APPDATA.exc_handler]
|
||||||
|
test eax, eax
|
||||||
|
jnz IRetToUserHook
|
||||||
|
@@: cli
|
||||||
|
mov eax, [esi+APPDATA.debugger_slot]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz .debug
|
jnz .debug
|
||||||
sti
|
sti
|
||||||
; not debuggee => say error and terminate
|
; not debuggee => say error and terminate
|
||||||
movzx eax, bl
|
call show_error_parameters ;; only ONE using, inline ???
|
||||||
mov [error_interrupt], eax
|
;mov edx, [TASK_BASE]
|
||||||
call show_error_parameters
|
mov [edx + TASKDATA.state], byte 4 ; terminate
|
||||||
add esp, 0x20
|
jmp change_task ; stack - here it does not matter at all, SEE: core/shed.inc
|
||||||
mov edx, [TASK_BASE]
|
|
||||||
mov [edx + TASKDATA.state], byte 4
|
|
||||||
|
|
||||||
jmp change_task
|
|
||||||
|
|
||||||
.debug:
|
.debug:
|
||||||
; we are debugged process, notify debugger and suspend ourself
|
; we are debugged process, notify debugger and suspend ourself
|
||||||
; eax=debugger PID
|
; eax=debugger PID
|
||||||
cld
|
mov ecx,1 ; debug_message code=other_exception
|
||||||
movzx ecx, bl
|
cmp bl,1 ; #DB
|
||||||
push ecx
|
jne .notify ; notify debugger and suspend ourself
|
||||||
mov ecx, [TASK_BASE]
|
mov ebx, dr6 ; debug_message data=DR6_image
|
||||||
push dword [ecx+TASKDATA.pid] ; PID of current process
|
xor edx, edx
|
||||||
push 12
|
mov dr6, edx
|
||||||
pop ecx
|
mov edx, dr7
|
||||||
push 1 ; 1=exception
|
mov cl, not 8
|
||||||
call debugger_notify
|
.l1: shl dl,2
|
||||||
pop ecx
|
jc @f
|
||||||
pop ecx
|
and bl, cl
|
||||||
pop ecx
|
@@: sar cl,1
|
||||||
|
jc .l1
|
||||||
|
mov cl, 3 ; debug_message code=debug_exception
|
||||||
|
.notify:
|
||||||
|
push ebx ; debug_message data
|
||||||
|
mov ebx, [TASK_BASE]
|
||||||
|
push [ebx+TASKDATA.pid] ; PID
|
||||||
|
push ecx ; debug_message code ((here: ecx==1/3))
|
||||||
|
mov cl, 12 ; debug_message size
|
||||||
|
call debugger_notify ;; only ONE using, inline ??? SEE: core/debug.inc
|
||||||
|
add esp,12
|
||||||
mov edx, [TASK_BASE]
|
mov edx, [TASK_BASE]
|
||||||
mov byte [edx+TASKDATA.state], 1 ; suspended
|
mov byte [edx+TASKDATA.state], 1 ; suspended
|
||||||
call change_task
|
call change_task ; SEE: core/shed.inc
|
||||||
restore_ring3_context
|
restore_ring3_context
|
||||||
iretd
|
iretd
|
||||||
|
|
||||||
iglobal
|
IRetToUserHook:
|
||||||
hexletters db '0123456789ABCDEF'
|
xchg eax, [reg_eip]
|
||||||
error_interrupt dd -1
|
sub dword[reg_esp3], 8
|
||||||
endg
|
mov edi, [reg_esp3]
|
||||||
|
stosd
|
||||||
|
mov [edi], ebx
|
||||||
|
restore_ring3_context
|
||||||
|
unknown_interrupt:
|
||||||
|
iretd
|
||||||
|
|
||||||
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||||
show_error_parameters:
|
show_error_parameters:
|
||||||
mov eax,[CURRENT_TASK]
|
mov edx,[TASK_BASE] ;not scratched below
|
||||||
shl eax, 5
|
DEBUGF 1, "K : Process - forced terminate PID: %x\n", [edx+TASKDATA.pid]
|
||||||
DEBUGF 1, "K : Process - forced terminate PID: %x\n", [CURRENT_TASK + TASKDATA.pid + eax]
|
cmp bl, 0x08
|
||||||
mov eax, [error_interrupt]
|
jb .l0
|
||||||
cmp al, 0x08
|
cmp bl, 0x0e
|
||||||
jne @f
|
jbe .l1
|
||||||
DEBUGF 1, "K : Double fault\n"
|
.l0: mov bl, 0x09
|
||||||
jmp defined_error
|
.l1: mov eax,[msg_fault_sel+ebx*4 - 0x08*4]
|
||||||
@@:
|
DEBUGF 1, "K : %s\n", eax
|
||||||
cmp al, 0x0a
|
mov eax, [reg_cs3+4]
|
||||||
jne @f
|
|
||||||
DEBUGF 1, "K : Invalid TSS\n"
|
|
||||||
jmp defined_error
|
|
||||||
@@:
|
|
||||||
cmp al, 0x0b
|
|
||||||
jne @f
|
|
||||||
DEBUGF 1, "K : Segment not present\n"
|
|
||||||
jmp defined_error
|
|
||||||
@@:
|
|
||||||
cmp al, 0x0c
|
|
||||||
jne @f
|
|
||||||
DEBUGF 1, "K : Stack fault\n"
|
|
||||||
jmp defined_error
|
|
||||||
@@:
|
|
||||||
cmp al, 0x0d
|
|
||||||
jne @f
|
|
||||||
DEBUGF 1, "K : General protection fault\n"
|
|
||||||
jmp defined_error
|
|
||||||
@@:
|
|
||||||
cmp al, 0x0e
|
|
||||||
jne @f
|
|
||||||
DEBUGF 1, "K : Page fault\n"
|
|
||||||
jmp defined_error
|
|
||||||
@@:
|
|
||||||
DEBUGF 1, "K : Undefined Exception\n"
|
|
||||||
defined_error:
|
|
||||||
DEBUGF 1, "K : EAX : %x EBX : %x ECX : %x\n", [esp + 0x20], [esp - 12 + 0x20], [esp - 4 + 0x20]
|
|
||||||
DEBUGF 1, "K : EDX : %x ESI : %x EDI : %x\n", [esp - 8 + 0x20], [esp - 24 + 0x20], [esp - 28 + 0x20]
|
|
||||||
DEBUGF 1, "K : EBP : %x EIP : %x ", [esp - 20 + 0x20], [esp + 4 + 0x20]
|
|
||||||
|
|
||||||
mov eax, [esp + 8 + 0x20]
|
|
||||||
mov edi, msg_sel_app
|
mov edi, msg_sel_app
|
||||||
mov ebx, [esp + 16 + 0x20]
|
mov ebx, [reg_esp3+4]
|
||||||
cmp eax, app_code
|
cmp eax, app_code
|
||||||
je @f
|
je @f
|
||||||
mov edi, msg_sel_ker
|
mov edi, msg_sel_ker
|
||||||
mov ebx, [esp - 16 + 0x20]
|
mov ebx, [reg_esp0+4]
|
||||||
@@:
|
@@: DEBUGF 1, "K : EAX : %x EBX : %x ECX : %x\n", [reg_eax+4], [reg_ebx+4], [reg_ecx+4]
|
||||||
DEBUGF 1, "ESP : %x\nK : Flags : %x CS : %x (%s)\n", ebx, [esp + 12 + 0x20], eax, edi
|
DEBUGF 1, "K : EDX : %x ESI : %x EDI : %x\n", [reg_edx+4], [reg_esi+4], [reg_edi+4]
|
||||||
|
DEBUGF 1, "K : EBP : %x EIP : %x ESP : %x\n", [reg_ebp+4], [reg_eip+4], ebx
|
||||||
|
DEBUGF 1, "K : Flags : %x CS : %x (%s)\n", [reg_eflags+4], eax, edi
|
||||||
ret
|
ret
|
||||||
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||||
|
|
||||||
|
restore reg_ss
|
||||||
|
restore reg_esp3
|
||||||
|
restore reg_eflags
|
||||||
|
restore reg_cs
|
||||||
|
restore reg_eip
|
||||||
|
restore reg_eax
|
||||||
|
restore reg_ecx
|
||||||
|
restore reg_edx
|
||||||
|
restore reg_ebx
|
||||||
|
restore reg_esp0
|
||||||
|
restore reg_ebp
|
||||||
|
restore reg_esi
|
||||||
|
restore reg_edi
|
||||||
|
|
||||||
; irq1 -> hid/keyboard.inc
|
; irq1 -> hid/keyboard.inc
|
||||||
macro irqh [num]
|
macro irqh [num] {
|
||||||
{
|
|
||||||
forward
|
|
||||||
p_irq#num :
|
p_irq#num :
|
||||||
mov edi, num
|
mov edi, num
|
||||||
jmp irqhandler
|
jmp irqhandler
|
||||||
}
|
}
|
||||||
|
|
||||||
irqh 2,3,4,5,7,8,9,10,11
|
|
||||||
|
|
||||||
|
|
||||||
p_irq6:
|
p_irq6:
|
||||||
@@ -277,26 +292,18 @@ ready_for_next_irq_1:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
irqD:
|
irqD:
|
||||||
save_ring3_context
|
push eax
|
||||||
mov ax, app_data ;os_data
|
|
||||||
mov ds, ax
|
|
||||||
mov es, ax
|
|
||||||
|
|
||||||
mov dx,0xf0
|
|
||||||
mov al,0
|
mov al,0
|
||||||
out dx,al
|
out 0xf0,al
|
||||||
|
|
||||||
mov dx,0xa0
|
|
||||||
mov al,0x20
|
mov al,0x20
|
||||||
out dx,al
|
out 0xa0,al
|
||||||
mov dx,0x20
|
out 0x20,al
|
||||||
out dx,al
|
pop eax
|
||||||
|
|
||||||
restore_ring3_context
|
|
||||||
|
|
||||||
iret
|
iret
|
||||||
|
|
||||||
|
|
||||||
|
irqh 2,3,4,5,7,8,9,10,11
|
||||||
|
|
||||||
irqhandler:
|
irqhandler:
|
||||||
|
|
||||||
mov esi,edi ; 1
|
mov esi,edi ; 1
|
||||||
@@ -421,8 +428,8 @@ sys_threads:
|
|||||||
jmp new_sys_threads
|
jmp new_sys_threads
|
||||||
|
|
||||||
iglobal
|
iglobal
|
||||||
process_terminating db 'K : Process - terminating',13,10,0
|
; process_terminating db 'K : Process - terminating',13,10,0
|
||||||
process_terminated db 'K : Process - done',13,10,0
|
; process_terminated db 'K : Process - done',13,10,0
|
||||||
msg_obj_destroy db 'K : destroy app object',13,10,0
|
msg_obj_destroy db 'K : destroy app object',13,10,0
|
||||||
endg
|
endg
|
||||||
|
|
||||||
@@ -445,7 +452,6 @@ terminate: ; terminate application
|
|||||||
@@:
|
@@:
|
||||||
;mov esi,process_terminating
|
;mov esi,process_terminating
|
||||||
;call sys_msg_board_str
|
;call sys_msg_board_str
|
||||||
DEBUGF 1,"%s",process_terminating
|
|
||||||
@@:
|
@@:
|
||||||
cli
|
cli
|
||||||
cmp [application_table_status],0
|
cmp [application_table_status],0
|
||||||
@@ -805,7 +811,6 @@ term9:
|
|||||||
mov [application_table_status],0
|
mov [application_table_status],0
|
||||||
;mov esi,process_terminated
|
;mov esi,process_terminated
|
||||||
;call sys_msg_board_str
|
;call sys_msg_board_str
|
||||||
DEBUGF 1,"%s",process_terminated
|
|
||||||
add esp, 4
|
add esp, 4
|
||||||
ret
|
ret
|
||||||
restore .slot
|
restore .slot
|
||||||
|
@@ -16,27 +16,11 @@ cross_order:
|
|||||||
mov ecx, edx
|
mov ecx, edx
|
||||||
mov edx, esi
|
mov edx, esi
|
||||||
mov esi, edi
|
mov esi, edi
|
||||||
mov edi, [esp+28 + 4]
|
movzx edi, byte[esp+28 + 4]
|
||||||
and edi,0xff
|
|
||||||
call dword [servetable+edi*4]
|
call dword [servetable+edi*4]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
;; ;;
|
|
||||||
;; SYSTEM CALL ENTRY ;;
|
|
||||||
;; ;;
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
|
|
||||||
|
|
||||||
align 16
|
|
||||||
i40:
|
|
||||||
pushad
|
|
||||||
cld
|
|
||||||
movzx eax, al
|
|
||||||
call dword [servetable2 + eax * 4]
|
|
||||||
popad
|
|
||||||
iretd
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; SYSENTER ENTRY ;;
|
;; SYSENTER ENTRY ;;
|
||||||
@@ -68,6 +52,21 @@ sysenter_entry:
|
|||||||
pop edx
|
pop edx
|
||||||
sysexit
|
sysexit
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; ;;
|
||||||
|
;; SYSTEM CALL ENTRY ;;
|
||||||
|
;; ;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
align 16
|
||||||
|
i40:
|
||||||
|
pushad
|
||||||
|
cld
|
||||||
|
movzx eax, al
|
||||||
|
call dword [servetable2 + eax * 4]
|
||||||
|
popad
|
||||||
|
iretd
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; SYSCALL ENTRY ;;
|
;; SYSCALL ENTRY ;;
|
||||||
@@ -95,6 +94,7 @@ syscall_entry:
|
|||||||
mov ecx, [ss:esp+4]
|
mov ecx, [ss:esp+4]
|
||||||
pop esp
|
pop esp
|
||||||
sysret
|
sysret
|
||||||
|
|
||||||
iglobal
|
iglobal
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; SYSTEM FUNCTIONS TABLE ;;
|
;; SYSTEM FUNCTIONS TABLE ;;
|
||||||
@@ -175,7 +175,6 @@ iglobal
|
|||||||
dd sys_debug_services ; 69-Debug
|
dd sys_debug_services ; 69-Debug
|
||||||
dd file_system_lfn ; 70-Common file system interface, version 2
|
dd file_system_lfn ; 70-Common file system interface, version 2
|
||||||
dd syscall_windowsettings ; 71-Window settings
|
dd syscall_windowsettings ; 71-Window settings
|
||||||
dd sys_sendwindowmsg ; 72-Send window message
|
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -256,7 +255,7 @@ iglobal
|
|||||||
dd cross_order ; 69-Debug
|
dd cross_order ; 69-Debug
|
||||||
dd cross_order ; 70-Common file system interface, version 2
|
dd cross_order ; 70-Common file system interface, version 2
|
||||||
dd cross_order ; 71-Window settings
|
dd cross_order ; 71-Window settings
|
||||||
dd cross_order ; 72-Send window message
|
dd sys_sendwindowmsg ; 72-Send window message
|
||||||
dd sys_network ; 73-Network stack
|
dd sys_network ; 73-Network stack
|
||||||
dd sys_socket ; 74-Sockets
|
dd sys_socket ; 74-Sockets
|
||||||
dd sys_protocols ; 75-Protocols
|
dd sys_protocols ; 75-Protocols
|
||||||
|
@@ -140,7 +140,6 @@ proc fs_execute
|
|||||||
|
|
||||||
;mov esi, new_process_loading
|
;mov esi, new_process_loading
|
||||||
;call sys_msg_board_str ; write message to message board
|
;call sys_msg_board_str ; write message to message board
|
||||||
DEBUGF 1,"%s",new_process_loading
|
|
||||||
|
|
||||||
.wait_lock:
|
.wait_lock:
|
||||||
cmp [application_table_status],0
|
cmp [application_table_status],0
|
||||||
@@ -850,7 +849,6 @@ proc new_sys_threads
|
|||||||
|
|
||||||
;mov esi,new_process_loading
|
;mov esi,new_process_loading
|
||||||
;call sys_msg_board_str
|
;call sys_msg_board_str
|
||||||
DEBUGF 1,"%s",new_process_loading
|
|
||||||
.wait_lock:
|
.wait_lock:
|
||||||
cmp [application_table_status],0
|
cmp [application_table_status],0
|
||||||
je .get_lock
|
je .get_lock
|
||||||
@@ -905,7 +903,6 @@ proc new_sys_threads
|
|||||||
|
|
||||||
;mov esi,new_process_running
|
;mov esi,new_process_running
|
||||||
;call sys_msg_board_str ;output information about succefull startup
|
;call sys_msg_board_str ;output information about succefull startup
|
||||||
DEBUGF 1,"%s",new_process_running
|
|
||||||
|
|
||||||
mov [application_table_status],0 ;unlock application_table_status mutex
|
mov [application_table_status],0 ;unlock application_table_status mutex
|
||||||
mov eax,[process_number] ;set result
|
mov eax,[process_number] ;set result
|
||||||
@@ -921,18 +918,15 @@ endp
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
wait_mutex:
|
wait_mutex:
|
||||||
|
;;Maxis use atomic bts for mutex 4.4.2009
|
||||||
push eax
|
push eax
|
||||||
push ebx
|
push ebx
|
||||||
.do_wait:
|
.do_wait:
|
||||||
cmp dword [ebx],0
|
bts dword [ebx],0
|
||||||
je .get_lock
|
jnc .locked
|
||||||
call change_task
|
call change_task
|
||||||
jmp .do_wait
|
jmp .do_wait
|
||||||
.get_lock:
|
.locked:
|
||||||
mov eax, 1
|
|
||||||
xchg eax, [ebx]
|
|
||||||
test eax, eax
|
|
||||||
jnz .do_wait
|
|
||||||
pop ebx
|
pop ebx
|
||||||
pop eax
|
pop eax
|
||||||
ret
|
ret
|
||||||
@@ -961,8 +955,8 @@ proc set_app_params stdcall,slot:dword, params:dword,\
|
|||||||
|
|
||||||
shl eax, 8
|
shl eax, 8
|
||||||
mov [eax+SLOT_BASE+APPDATA.fpu_state], edi
|
mov [eax+SLOT_BASE+APPDATA.fpu_state], edi
|
||||||
mov [eax+SLOT_BASE+APPDATA.fpu_handler], 0
|
mov [eax+SLOT_BASE+APPDATA.exc_handler], 0
|
||||||
mov [eax+SLOT_BASE+APPDATA.sse_handler], 0
|
mov [eax+SLOT_BASE+APPDATA.except_mask], 0
|
||||||
|
|
||||||
;set default io permission map
|
;set default io permission map
|
||||||
mov [eax+SLOT_BASE+APPDATA.io_map],\
|
mov [eax+SLOT_BASE+APPDATA.io_map],\
|
||||||
@@ -1104,7 +1098,6 @@ proc set_app_params stdcall,slot:dword, params:dword,\
|
|||||||
mov [CURRENT_TASK+ebx+TASKDATA.state], cl
|
mov [CURRENT_TASK+ebx+TASKDATA.state], cl
|
||||||
;mov esi,new_process_running
|
;mov esi,new_process_running
|
||||||
;call sys_msg_board_str ;output information about succefull startup
|
;call sys_msg_board_str ;output information about succefull startup
|
||||||
DEBUGF 1,"%s",new_process_running
|
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
@@ -351,27 +351,6 @@ endg
|
|||||||
; a protected-mode interrupt handler (typically the general-protection
|
; a protected-mode interrupt handler (typically the general-protection
|
||||||
; exception handler, which in turn calls the virtual 8086-mode monitor).
|
; exception handler, which in turn calls the virtual 8086-mode monitor).
|
||||||
|
|
||||||
v86_debug_exc:
|
|
||||||
pushad
|
|
||||||
xor eax, eax
|
|
||||||
mov dr6, eax
|
|
||||||
mov bl, 1
|
|
||||||
jmp v86_exc_c
|
|
||||||
|
|
||||||
v86_page_fault:
|
|
||||||
add esp, 4
|
|
||||||
pushad
|
|
||||||
mov bl, 14
|
|
||||||
jmp v86_exc_c
|
|
||||||
|
|
||||||
v86_except_16:
|
|
||||||
pushad
|
|
||||||
mov bl, 16
|
|
||||||
jmp v86_exc_c
|
|
||||||
v86_except_19:
|
|
||||||
pushad
|
|
||||||
mov bl, 19
|
|
||||||
|
|
||||||
iglobal
|
iglobal
|
||||||
v86_exc_str1 db 'V86 : unexpected exception ',0
|
v86_exc_str1 db 'V86 : unexpected exception ',0
|
||||||
v86_exc_str2 db ' at ',0
|
v86_exc_str2 db ' at ',0
|
||||||
@@ -387,11 +366,12 @@ v86_irqerr db 'V86 : IRQ already hooked',13,10,0
|
|||||||
endg
|
endg
|
||||||
|
|
||||||
v86_exc_c:
|
v86_exc_c:
|
||||||
mov ax, app_data
|
|
||||||
mov ds, ax
|
|
||||||
mov es, ax
|
|
||||||
; Did we all that we have wanted to do?
|
; Did we all that we have wanted to do?
|
||||||
mov eax, [esp+v86_regs.size+10h+18h]
|
cmp bl,1
|
||||||
|
jne @f
|
||||||
|
xor eax, eax
|
||||||
|
mov dr6, eax
|
||||||
|
@@: mov eax, [esp+v86_regs.size+10h+18h]
|
||||||
cmp word [esp+v86_regs.eip], ax
|
cmp word [esp+v86_regs.eip], ax
|
||||||
jnz @f
|
jnz @f
|
||||||
shr eax, 16
|
shr eax, 16
|
||||||
@@ -945,12 +925,11 @@ v86_irq2:
|
|||||||
mov cx, [eax*4+2]
|
mov cx, [eax*4+2]
|
||||||
mov word [esi-v86_regs.size+v86_regs.cs], cx
|
mov word [esi-v86_regs.size+v86_regs.cs], cx
|
||||||
and byte [esi-v86_regs.size+v86_regs.eflags+1], not 3
|
and byte [esi-v86_regs.size+v86_regs.eflags+1], not 3
|
||||||
push ebx
|
|
||||||
call update_counters
|
call update_counters
|
||||||
pop ebx
|
lea edi, [ebx + 0x100000000 - SLOT_BASE]
|
||||||
sub ebx, SLOT_BASE
|
shr edi, 3
|
||||||
shr ebx, 8
|
add edi, TASK_DATA
|
||||||
mov esi, [CURRENT_TASK]
|
call find_next_task.found
|
||||||
call do_change_task
|
call do_change_task
|
||||||
popad
|
popad
|
||||||
iretd
|
iretd
|
||||||
|
@@ -63,6 +63,7 @@ keymap_alt:
|
|||||||
boot_setostask db 'Setting OS task',0
|
boot_setostask db 'Setting OS task',0
|
||||||
boot_allirqs db 'Unmasking all IRQs',0
|
boot_allirqs db 'Unmasking all IRQs',0
|
||||||
boot_tsc db 'Reading TSC',0
|
boot_tsc db 'Reading TSC',0
|
||||||
|
boot_cpufreq db 'CPU frequency is ',' ',' MHz',0
|
||||||
boot_pal_ega db 'Setting EGA/CGA 320x200 palette',0
|
boot_pal_ega db 'Setting EGA/CGA 320x200 palette',0
|
||||||
boot_pal_vga db 'Setting VGA 640x480 palette',0
|
boot_pal_vga db 'Setting VGA 640x480 palette',0
|
||||||
boot_failed db 'Failed to start first app',0
|
boot_failed db 'Failed to start first app',0
|
||||||
@@ -71,8 +72,8 @@ if preboot_blogesc
|
|||||||
boot_tasking db 'All set - press ESC to start',0
|
boot_tasking db 'All set - press ESC to start',0
|
||||||
end if
|
end if
|
||||||
|
|
||||||
new_process_loading db 'K : New Process - loading',13,10,0
|
;new_process_loading db 'K : New Process - loading',13,10,0
|
||||||
new_process_running db 'K : New Process - done',13,10,0
|
;new_process_running db 'K : New Process - done',13,10,0
|
||||||
start_not_enough_memory db 'K : New Process - not enough memory',13,10,0
|
start_not_enough_memory db 'K : New Process - not enough memory',13,10,0
|
||||||
|
|
||||||
msg_unresolved db 'unresolved ',0
|
msg_unresolved db 'unresolved ',0
|
||||||
@@ -89,7 +90,7 @@ AMD_str db "AuthenticAMD",0
|
|||||||
;szInfinity db 'INFINITY',0
|
;szInfinity db 'INFINITY',0
|
||||||
szHwMouse db 'ATI2D',0
|
szHwMouse db 'ATI2D',0
|
||||||
szPS2MDriver db 'PS2MOUSE',0
|
szPS2MDriver db 'PS2MOUSE',0
|
||||||
szCOM_MDriver db 'COM_MOUSE',0
|
;szCOM_MDriver db 'COM_MOUSE',0
|
||||||
szUSB db 'USB',0
|
szUSB db 'USB',0
|
||||||
szAtiHW db '/rd/1/drivers/ati2d.drv',0
|
szAtiHW db '/rd/1/drivers/ati2d.drv',0
|
||||||
|
|
||||||
@@ -291,7 +292,6 @@ irq15read rd 16
|
|||||||
irq_tab rd 16
|
irq_tab rd 16
|
||||||
|
|
||||||
mem_block_map rb 512
|
mem_block_map rb 512
|
||||||
event_map rb 64
|
|
||||||
mem_block_list rd 64
|
mem_block_list rd 64
|
||||||
large_block_list rd 31
|
large_block_list rd 31
|
||||||
mem_block_mask rd 2
|
mem_block_mask rd 2
|
||||||
@@ -314,10 +314,6 @@ mst MEM_STATE
|
|||||||
|
|
||||||
page_start rd 1
|
page_start rd 1
|
||||||
page_end rd 1
|
page_end rd 1
|
||||||
events rd 1
|
|
||||||
event_start rd 1
|
|
||||||
event_end rd 1
|
|
||||||
event_uid rd 1
|
|
||||||
sys_page_map rd 1
|
sys_page_map rd 1
|
||||||
os_stack_seg rd 1
|
os_stack_seg rd 1
|
||||||
|
|
||||||
@@ -402,7 +398,7 @@ MouseTickCounter rd 1
|
|||||||
|
|
||||||
img_background rd 1
|
img_background rd 1
|
||||||
mem_BACKGROUND rd 1
|
mem_BACKGROUND rd 1
|
||||||
wraw_bacground_select rb 1
|
static_background_data rd 1
|
||||||
|
|
||||||
cache_ide0:
|
cache_ide0:
|
||||||
cache_ide0_pointer rd 1
|
cache_ide0_pointer rd 1
|
||||||
@@ -470,4 +466,3 @@ BiosDiskCaches rb 80h*(cache_ide1-cache_ide0)
|
|||||||
BiosDiskPartitions rd 80h
|
BiosDiskPartitions rd 80h
|
||||||
|
|
||||||
IncludeUGlobals
|
IncludeUGlobals
|
||||||
|
|
||||||
|
43
kernel/branches/net/detect/biosmem.inc
Normal file
43
kernel/branches/net/detect/biosmem.inc
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; ;;
|
||||||
|
;; Copyright (C) KolibriOS team 2009. All rights reserved. ;;
|
||||||
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
|
;; ;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
; Query physical memory map from BIOS.
|
||||||
|
; diamond, 2009
|
||||||
|
|
||||||
|
push ds
|
||||||
|
; first call to fn E820
|
||||||
|
mov eax, 0xE820
|
||||||
|
xor ebx, ebx
|
||||||
|
mov es, bx
|
||||||
|
mov ds, bx
|
||||||
|
mov di, 0x9104
|
||||||
|
mov [di-4], ebx ; no blocks yet
|
||||||
|
mov ecx, 20
|
||||||
|
mov edx, 0x534D4150
|
||||||
|
int 15h
|
||||||
|
jc no_E820
|
||||||
|
cmp eax, 0x534D4150
|
||||||
|
jnz no_E820
|
||||||
|
e820_mem_loop:
|
||||||
|
cmp byte [di+16], 1 ; ignore non-free areas
|
||||||
|
jnz e820_mem_next
|
||||||
|
inc byte [0x9100]
|
||||||
|
add di, 20
|
||||||
|
e820_mem_next:
|
||||||
|
; consequent calls to fn E820
|
||||||
|
test ebx, ebx
|
||||||
|
jz e820_test_done
|
||||||
|
cmp byte [0x9100], 32
|
||||||
|
jae e820_test_done
|
||||||
|
mov eax, 0xE820
|
||||||
|
int 15h
|
||||||
|
jc e820_test_done
|
||||||
|
jmp e820_mem_loop
|
||||||
|
no_E820:
|
||||||
|
; let's hope for mem_test from init.inc
|
||||||
|
e820_test_done:
|
||||||
|
pop ds
|
@@ -70,15 +70,26 @@ $Revision: 750 $
|
|||||||
jz .endbd
|
jz .endbd
|
||||||
mov esi,BiosDiskCaches
|
mov esi,BiosDiskCaches
|
||||||
.loopbd:
|
.loopbd:
|
||||||
cmp byte [BiosDisksData+ecx*4+2],-1
|
push ecx
|
||||||
jnz .contbd
|
movsx ecx,byte [BiosDisksData+ecx*4+2]
|
||||||
|
inc ecx
|
||||||
|
jz .getbd
|
||||||
|
add ecx,ecx
|
||||||
|
movzx eax,byte [DRIVE_DATA+1]
|
||||||
|
shl eax,cl
|
||||||
|
and ah,3
|
||||||
|
cmp ah,1
|
||||||
|
jz .contbd
|
||||||
|
pop ecx
|
||||||
|
mov byte [BiosDisksData+ecx*4+2], -1
|
||||||
|
push ecx
|
||||||
|
.getbd:
|
||||||
mov eax,[cache_ide0_size]
|
mov eax,[cache_ide0_size]
|
||||||
mov [esi+cache_ide0_size-cache_ide0],eax
|
mov [esi+cache_ide0_size-cache_ide0],eax
|
||||||
push ecx
|
|
||||||
mov cl,1
|
mov cl,1
|
||||||
call get_cache_ide
|
call get_cache_ide
|
||||||
pop ecx
|
|
||||||
.contbd:
|
.contbd:
|
||||||
|
pop ecx
|
||||||
add esi,cache_ide1-cache_ide0
|
add esi,cache_ide1-cache_ide0
|
||||||
inc ecx
|
inc ecx
|
||||||
cmp ecx,[NumBiosDisks]
|
cmp ecx,[NumBiosDisks]
|
||||||
|
@@ -22,7 +22,7 @@ sb_dma_num equ 5 ;default values for SB16, may be overrided by autodetect
|
|||||||
|
|
||||||
small_buffer equ 32768
|
small_buffer equ 32768
|
||||||
full_buffer equ 65536
|
full_buffer equ 65536
|
||||||
sb_buffer_size equ full_buffer
|
sb_buffer_size equ small_buffer ; FIX ring buffer overlapped events issue; full_buffer
|
||||||
|
|
||||||
__supported_buffer_sizes fix <small_buffer, full_buffer>
|
__supported_buffer_sizes fix <small_buffer, full_buffer>
|
||||||
|
|
||||||
|
@@ -201,7 +201,6 @@ macro DEBUGH_N _sign,_num,_hex {
|
|||||||
if ~_hex eq ax
|
if ~_hex eq ax
|
||||||
movzx eax,_hex
|
movzx eax,_hex
|
||||||
end if
|
end if
|
||||||
shl eax,16
|
|
||||||
if (_num eq)
|
if (_num eq)
|
||||||
mov edx,4
|
mov edx,4
|
||||||
end if
|
end if
|
||||||
@@ -209,7 +208,6 @@ macro DEBUGH_N _sign,_num,_hex {
|
|||||||
if ~_hex eq al
|
if ~_hex eq al
|
||||||
movzx eax,_hex
|
movzx eax,_hex
|
||||||
end if
|
end if
|
||||||
shl eax,24
|
|
||||||
if (_num eq)
|
if (_num eq)
|
||||||
mov edx,2
|
mov edx,2
|
||||||
end if
|
end if
|
||||||
|
@@ -1062,14 +1062,6 @@ fs_HdRead:
|
|||||||
mov eax, ERROR_ACCESS_DENIED
|
mov eax, ERROR_ACCESS_DENIED
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.noaccess_3:
|
|
||||||
add esp,4
|
|
||||||
.noaccess_1:
|
|
||||||
add esp,4
|
|
||||||
.noaccess_4:
|
|
||||||
add esp,4*5
|
|
||||||
jmp .noaccess_2
|
|
||||||
|
|
||||||
@@:
|
@@:
|
||||||
call hd_find_lfn
|
call hd_find_lfn
|
||||||
jnc .found
|
jnc .found
|
||||||
@@ -1133,9 +1125,9 @@ fs_HdRead:
|
|||||||
push ebx
|
push ebx
|
||||||
mov ebx, edx
|
mov ebx, edx
|
||||||
call hd_read
|
call hd_read
|
||||||
|
pop ebx
|
||||||
cmp [hd_error],0
|
cmp [hd_error],0
|
||||||
jne .noaccess_1
|
jne .noaccess_1
|
||||||
pop ebx
|
|
||||||
add edx, 512
|
add edx, 512
|
||||||
sub ecx, 512
|
sub ecx, 512
|
||||||
jmp .skip
|
jmp .skip
|
||||||
@@ -1144,11 +1136,10 @@ fs_HdRead:
|
|||||||
push eax ebx
|
push eax ebx
|
||||||
mov ebx, buffer
|
mov ebx, buffer
|
||||||
call hd_read
|
call hd_read
|
||||||
cmp [hd_error],0
|
|
||||||
jne .noaccess_3
|
|
||||||
|
|
||||||
mov eax, ebx
|
mov eax, ebx
|
||||||
pop ebx
|
pop ebx
|
||||||
|
cmp [hd_error],0
|
||||||
|
jne .noaccess_3
|
||||||
add eax, ebx
|
add eax, ebx
|
||||||
push ecx
|
push ecx
|
||||||
add ecx, ebx
|
add ecx, ebx
|
||||||
@@ -1171,9 +1162,14 @@ fs_HdRead:
|
|||||||
mov eax, [cluster_tmp]
|
mov eax, [cluster_tmp]
|
||||||
call get_FAT
|
call get_FAT
|
||||||
cmp [hd_error],0
|
cmp [hd_error],0
|
||||||
jne .noaccess_4
|
jne .noaccess_1
|
||||||
|
|
||||||
jmp .new_cluster
|
jmp .new_cluster
|
||||||
|
.noaccess_3:
|
||||||
|
pop eax
|
||||||
|
.noaccess_1:
|
||||||
|
pop eax
|
||||||
|
push 11
|
||||||
.done:
|
.done:
|
||||||
mov ebx, edx
|
mov ebx, edx
|
||||||
pop eax edx ecx edi
|
pop eax edx ecx edi
|
||||||
|
@@ -383,9 +383,13 @@ boot_read_ok:
|
|||||||
mov [FAT_START],eax ; fat_start = partition_start + reserved
|
mov [FAT_START],eax ; fat_start = partition_start + reserved
|
||||||
|
|
||||||
movzx eax,byte [ebx+0xd] ; sectors per cluster
|
movzx eax,byte [ebx+0xd] ; sectors per cluster
|
||||||
|
test eax,eax
|
||||||
|
jz problem_fat_dec_count
|
||||||
mov [SECTORS_PER_CLUSTER],eax
|
mov [SECTORS_PER_CLUSTER],eax
|
||||||
|
|
||||||
movzx ecx,word [ebx+0xb] ; bytes per sector
|
movzx ecx,word [ebx+0xb] ; bytes per sector
|
||||||
|
cmp ecx,0x200
|
||||||
|
jnz problem_fat_dec_count
|
||||||
mov [BYTES_PER_SECTOR],ecx
|
mov [BYTES_PER_SECTOR],ecx
|
||||||
|
|
||||||
movzx eax,word [ebx+0x11] ; count of rootdir entries (=0 fat32)
|
movzx eax,word [ebx+0x11] ; count of rootdir entries (=0 fat32)
|
||||||
|
@@ -423,7 +423,7 @@ negativebutton:
|
|||||||
;
|
;
|
||||||
; first at 0x10
|
; first at 0x10
|
||||||
|
|
||||||
|
align 4
|
||||||
checkbuttons:
|
checkbuttons:
|
||||||
|
|
||||||
cmp [BTN_DOWN],byte 0 ; mouse buttons pressed
|
cmp [BTN_DOWN],byte 0 ; mouse buttons pressed
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1166,10 +1166,10 @@ restore_minimized_window:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
iglobal
|
;iglobal
|
||||||
window_moving db 'K : Window - move/resize',13,10,0
|
; window_moving db 'K : Window - move/resize',13,10,0
|
||||||
window_moved db 'K : Window - done',13,10,0
|
; window_moved db 'K : Window - done',13,10,0
|
||||||
endg
|
;endg
|
||||||
|
|
||||||
; check window touch
|
; check window touch
|
||||||
align 4
|
align 4
|
||||||
@@ -1316,10 +1316,10 @@ endg
|
|||||||
|
|
||||||
.continue:
|
.continue:
|
||||||
|
|
||||||
push esi
|
; push esi
|
||||||
mov esi, window_moving
|
; mov esi, window_moving
|
||||||
call sys_msg_board_str
|
; call sys_msg_board_str
|
||||||
pop esi
|
; pop esi
|
||||||
|
|
||||||
mov ecx, [timer_ticks] ; double-click ?
|
mov ecx, [timer_ticks] ; double-click ?
|
||||||
mov edx, ecx
|
mov edx, ecx
|
||||||
@@ -1684,8 +1684,8 @@ endg
|
|||||||
mov [MOUSE_BACKGROUND],byte 0 ; no mouse under
|
mov [MOUSE_BACKGROUND],byte 0 ; no mouse under
|
||||||
mov [MOUSE_DOWN],byte 0 ; react to mouse up/down
|
mov [MOUSE_DOWN],byte 0 ; react to mouse up/down
|
||||||
|
|
||||||
mov esi,window_moved
|
; mov esi,window_moved
|
||||||
call sys_msg_board_str
|
; call sys_msg_board_str
|
||||||
|
|
||||||
popad
|
popad
|
||||||
|
|
||||||
|
@@ -14,6 +14,9 @@ MEM_UC equ 0 ;uncached memory
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc mem_test
|
proc mem_test
|
||||||
|
; if we have BIOS with fn E820, skip the test
|
||||||
|
cmp dword [BOOT_VAR-OS_BASE + 0x9100], 0
|
||||||
|
jnz .ret
|
||||||
|
|
||||||
mov eax, cr0
|
mov eax, cr0
|
||||||
and eax, not (CR0_CD+CR0_NW)
|
and eax, not (CR0_CD+CR0_NW)
|
||||||
@@ -29,37 +32,91 @@ proc mem_test
|
|||||||
cmp dword [edi], 'TEST'
|
cmp dword [edi], 'TEST'
|
||||||
xchg ebx, dword [edi]
|
xchg ebx, dword [edi]
|
||||||
je @b
|
je @b
|
||||||
mov [MEM_AMOUNT-OS_BASE], edi
|
|
||||||
|
|
||||||
and eax, not (CR0_CD+CR0_NW) ;enable caching
|
and eax, not (CR0_CD+CR0_NW) ;enable caching
|
||||||
mov cr0, eax
|
mov cr0, eax
|
||||||
mov eax, edi
|
inc dword [BOOT_VAR-OS_BASE + 0x9100]
|
||||||
|
xor eax, eax
|
||||||
|
mov [BOOT_VAR-OS_BASE + 0x9104], eax
|
||||||
|
mov [BOOT_VAR-OS_BASE + 0x9108], eax
|
||||||
|
mov [BOOT_VAR-OS_BASE + 0x910C], edi
|
||||||
|
mov [BOOT_VAR-OS_BASE + 0x9110], eax
|
||||||
|
.ret:
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc init_mem
|
proc init_mem
|
||||||
mov eax, [MEM_AMOUNT-OS_BASE]
|
; calculate maximum allocatable address and number of allocatable pages
|
||||||
mov [pg_data.mem_amount-OS_BASE], eax
|
mov edi, BOOT_VAR-OS_BASE + 0x9104
|
||||||
|
mov ecx, [edi-4]
|
||||||
shr eax, 12
|
xor esi, esi ; esi will hold total amount of memory
|
||||||
|
xor edx, edx ; edx will hold maximum allocatable address
|
||||||
|
.calcmax:
|
||||||
|
; round all to pages
|
||||||
|
mov eax, [edi]
|
||||||
|
test eax, 0xFFF
|
||||||
|
jz @f
|
||||||
|
neg eax
|
||||||
|
and eax, 0xFFF
|
||||||
|
add [edi], eax
|
||||||
|
adc dword [edi+4], 0
|
||||||
|
sub [edi+8], eax
|
||||||
|
sbb dword [edi+12], 0
|
||||||
|
jc .unusable
|
||||||
|
@@:
|
||||||
|
and dword [edi+8], not 0xFFF
|
||||||
|
jz .unusable
|
||||||
|
; ignore memory after 4 Gb
|
||||||
|
cmp dword [edi+4], 0
|
||||||
|
jnz .unusable
|
||||||
|
mov eax, [edi]
|
||||||
|
cmp dword [edi+12], 0
|
||||||
|
jnz .overflow
|
||||||
|
add eax, [edi+8]
|
||||||
|
jnc @f
|
||||||
|
.overflow:
|
||||||
|
mov eax, 0xFFFFF000
|
||||||
|
@@:
|
||||||
|
cmp edx, eax
|
||||||
|
jae @f
|
||||||
mov edx, eax
|
mov edx, eax
|
||||||
mov [pg_data.pages_count-OS_BASE], eax
|
@@:
|
||||||
shr eax, 3
|
sub eax, [edi]
|
||||||
mov [pg_data.pagemap_size-OS_BASE], eax
|
mov [edi+8], eax
|
||||||
|
add esi, eax
|
||||||
|
jmp .usable
|
||||||
|
.unusable:
|
||||||
|
and dword [edi+8], 0
|
||||||
|
.usable:
|
||||||
|
add edi, 20
|
||||||
|
loop .calcmax
|
||||||
|
.calculated:
|
||||||
|
mov [MEM_AMOUNT-OS_BASE], esi
|
||||||
|
mov [pg_data.mem_amount-OS_BASE], esi
|
||||||
|
shr esi, 12
|
||||||
|
mov [pg_data.pages_count-OS_BASE], esi
|
||||||
|
|
||||||
add eax, (sys_pgmap-OS_BASE)+4095
|
shr edx, 12
|
||||||
and eax, not 4095
|
add edx, 31
|
||||||
mov [tmp_page_tabs], eax
|
and edx, not 31
|
||||||
|
shr edx, 3
|
||||||
|
mov [pg_data.pagemap_size-OS_BASE], edx
|
||||||
|
|
||||||
|
add edx, (sys_pgmap-OS_BASE)+4095
|
||||||
|
and edx, not 4095
|
||||||
|
mov [tmp_page_tabs], edx
|
||||||
|
|
||||||
|
mov edx, esi
|
||||||
|
and edx, -1024
|
||||||
cmp edx, (OS_BASE/4096)
|
cmp edx, (OS_BASE/4096)
|
||||||
jbe @F
|
jbe @F
|
||||||
mov edx, (OS_BASE/4096)
|
mov edx, (OS_BASE/4096)
|
||||||
jmp .set
|
jmp .set
|
||||||
@@:
|
@@:
|
||||||
cmp edx, (HEAP_MIN_SIZE/4096)
|
cmp edx, (HEAP_BASE+HEAP_MIN_SIZE)/4096
|
||||||
jae .set
|
jae .set
|
||||||
mov edx, (HEAP_MIN_SIZE/4096)
|
mov edx, (HEAP_BASE+HEAP_MIN_SIZE)/4096
|
||||||
.set:
|
.set:
|
||||||
mov [pg_data.kernel_pages-OS_BASE], edx
|
mov [pg_data.kernel_pages-OS_BASE], edx
|
||||||
shr edx, 10
|
shr edx, 10
|
||||||
@@ -130,14 +187,63 @@ endp
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc init_page_map
|
proc init_page_map
|
||||||
|
; mark all memory as unavailable
|
||||||
mov edi, sys_pgmap-OS_BASE
|
mov edi, sys_pgmap-OS_BASE
|
||||||
mov ecx, [pg_data.pagemap_size-OS_BASE]
|
mov ecx, [pg_data.pagemap_size-OS_BASE]
|
||||||
shr ecx, 2
|
shr ecx, 2
|
||||||
or eax, -1
|
xor eax, eax
|
||||||
cld
|
cld
|
||||||
rep stosd
|
rep stosd
|
||||||
|
|
||||||
|
; scan through memory map and mark free areas as available
|
||||||
|
mov ebx, BOOT_VAR-OS_BASE + 0x9104
|
||||||
|
mov edx, [ebx-4]
|
||||||
|
.scanmap:
|
||||||
|
mov ecx, [ebx+8]
|
||||||
|
shr ecx, 12 ; ecx = number of pages
|
||||||
|
jz .next
|
||||||
|
mov edi, [ebx]
|
||||||
|
shr edi, 12 ; edi = first page
|
||||||
|
mov eax, edi
|
||||||
|
neg eax
|
||||||
|
shr edi, 5
|
||||||
|
add edi, sys_pgmap-OS_BASE
|
||||||
|
and eax, 31
|
||||||
|
jz .startok
|
||||||
|
sub ecx, eax
|
||||||
|
jbe .onedword
|
||||||
|
push ecx
|
||||||
|
mov ecx, eax
|
||||||
|
xor eax, eax
|
||||||
|
inc eax
|
||||||
|
shl eax, cl
|
||||||
|
dec eax
|
||||||
|
or [edi], eax
|
||||||
|
add edi, 4
|
||||||
|
pop ecx
|
||||||
|
.startok:
|
||||||
|
push ecx
|
||||||
|
shr ecx, 5
|
||||||
|
or eax, -1
|
||||||
|
rep stosd
|
||||||
|
pop ecx
|
||||||
|
and ecx, 31
|
||||||
|
not eax
|
||||||
|
shl eax, cl
|
||||||
|
or [edi], eax
|
||||||
|
jmp .next
|
||||||
|
.onedword:
|
||||||
|
add ecx, eax
|
||||||
|
@@:
|
||||||
|
dec eax
|
||||||
|
bts [edi], eax
|
||||||
|
loop @b
|
||||||
|
.next:
|
||||||
|
add ebx, 20
|
||||||
|
dec edx
|
||||||
|
jnz .scanmap
|
||||||
|
|
||||||
|
; mark kernel memory as allocated (unavailable)
|
||||||
mov ecx, [tmp_page_tabs]
|
mov ecx, [tmp_page_tabs]
|
||||||
mov edx, [pg_data.pages_count-OS_BASE]
|
mov edx, [pg_data.pages_count-OS_BASE]
|
||||||
shr ecx, 12
|
shr ecx, 12
|
||||||
@@ -155,7 +261,7 @@ proc init_page_map
|
|||||||
mov ecx, ebx
|
mov ecx, ebx
|
||||||
and ecx, 31
|
and ecx, 31
|
||||||
shl eax, cl
|
shl eax, cl
|
||||||
mov [edi], eax
|
and [edi], eax
|
||||||
add edi, OS_BASE
|
add edi, OS_BASE
|
||||||
mov [page_start-OS_BASE], edi;
|
mov [page_start-OS_BASE], edi;
|
||||||
|
|
||||||
|
@@ -61,7 +61,8 @@ $Revision: 1025 $
|
|||||||
|
|
||||||
USE_COM_IRQ equ 1 ; make irq 3 and irq 4 available for PCI devices
|
USE_COM_IRQ equ 1 ; make irq 3 and irq 4 available for PCI devices
|
||||||
|
|
||||||
debug_com_base equ 0x3f8 ; 0x3f8 is com1, 0x2f8 is com2, 0x3e8 is com3, 0x2e8 is com4, no irq's are used, comment this line out to disable
|
; Enabling the next line will enable serial output console
|
||||||
|
;debug_com_base equ 0x3f8 ; 0x3f8 is com1, 0x2f8 is com2, 0x3e8 is com3, 0x2e8 is com4, no irq's are used
|
||||||
|
|
||||||
include "proc32.inc"
|
include "proc32.inc"
|
||||||
include "kglobals.inc"
|
include "kglobals.inc"
|
||||||
@@ -237,8 +238,8 @@ B32:
|
|||||||
mov edi,0x2F0000
|
mov edi,0x2F0000
|
||||||
mov ecx,0x10000 / 4
|
mov ecx,0x10000 / 4
|
||||||
rep movsd
|
rep movsd
|
||||||
xor edi, edi
|
mov edi,0x1000
|
||||||
mov ecx,0x10000 / 4
|
mov ecx,0xf000 / 4
|
||||||
rep stosd
|
rep stosd
|
||||||
|
|
||||||
call test_cpu
|
call test_cpu
|
||||||
@@ -453,8 +454,8 @@ high_code:
|
|||||||
|
|
||||||
; LOAD IDT
|
; LOAD IDT
|
||||||
|
|
||||||
call build_interrupt_table
|
call build_interrupt_table ;lidt is executed
|
||||||
lidt [idtreg]
|
;lidt [idtreg]
|
||||||
|
|
||||||
call init_kernel_heap
|
call init_kernel_heap
|
||||||
stdcall kernel_alloc, RING0_STACK_SIZE+512
|
stdcall kernel_alloc, RING0_STACK_SIZE+512
|
||||||
@@ -548,9 +549,8 @@ high_code:
|
|||||||
mov [BgrDrawMode],eax
|
mov [BgrDrawMode],eax
|
||||||
mov [BgrDataWidth],eax
|
mov [BgrDataWidth],eax
|
||||||
mov [BgrDataHeight],eax
|
mov [BgrDataHeight],eax
|
||||||
mov [mem_BACKGROUND],4095
|
mov [mem_BACKGROUND], 4
|
||||||
stdcall kernel_alloc, [mem_BACKGROUND]
|
mov [img_background], static_background_data
|
||||||
mov [img_background], eax
|
|
||||||
|
|
||||||
mov [SLOT_BASE + 256 + APPDATA.dir_table], sys_pgdir - OS_BASE
|
mov [SLOT_BASE + 256 + APPDATA.dir_table], sys_pgdir - OS_BASE
|
||||||
|
|
||||||
@@ -674,8 +674,8 @@ no_lib_load:
|
|||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov dword [SLOT_BASE+APPDATA.fpu_state], fpu_data
|
mov dword [SLOT_BASE+APPDATA.fpu_state], fpu_data
|
||||||
mov dword [SLOT_BASE+APPDATA.fpu_handler], eax
|
mov dword [SLOT_BASE+APPDATA.exc_handler], eax
|
||||||
mov dword [SLOT_BASE+APPDATA.sse_handler], eax
|
mov dword [SLOT_BASE+APPDATA.except_mask], eax
|
||||||
|
|
||||||
; name for OS/IDLE process
|
; name for OS/IDLE process
|
||||||
|
|
||||||
@@ -696,8 +696,8 @@ no_lib_load:
|
|||||||
cld
|
cld
|
||||||
rep movsd
|
rep movsd
|
||||||
|
|
||||||
mov dword [SLOT_BASE+256+APPDATA.fpu_handler], eax
|
mov dword [SLOT_BASE+256+APPDATA.exc_handler], eax
|
||||||
mov dword [SLOT_BASE+256+APPDATA.sse_handler], eax
|
mov dword [SLOT_BASE+256+APPDATA.except_mask], eax
|
||||||
|
|
||||||
mov ebx, SLOT_BASE+256+APP_OBJ_OFFSET
|
mov ebx, SLOT_BASE+256+APP_OBJ_OFFSET
|
||||||
mov dword [SLOT_BASE+256+APPDATA.fd_obj], ebx
|
mov dword [SLOT_BASE+256+APPDATA.fd_obj], ebx
|
||||||
@@ -724,18 +724,35 @@ no_lib_load:
|
|||||||
mov esi,boot_tsc
|
mov esi,boot_tsc
|
||||||
call boot_log
|
call boot_log
|
||||||
cli
|
cli
|
||||||
call _rdtsc
|
rdtsc ;call _rdtsc
|
||||||
mov ecx,eax
|
mov ecx,eax
|
||||||
mov esi,250 ; wait 1/4 a second
|
mov esi,250 ; wait 1/4 a second
|
||||||
call delay_ms
|
call delay_ms
|
||||||
call _rdtsc
|
rdtsc ;call _rdtsc
|
||||||
sti
|
sti
|
||||||
sub eax,ecx
|
sub eax,ecx
|
||||||
shl eax,2
|
shl eax,2
|
||||||
mov [CPU_FREQ],eax ; save tsc / sec
|
mov [CPU_FREQ],eax ; save tsc / sec
|
||||||
mov ebx, 1000000
|
; mov ebx, 1000000
|
||||||
div ebx
|
; div ebx
|
||||||
mov [stall_mcs], eax
|
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><> <20>ந<EFBFBD><E0AEA8><EFBFBD><EFBFBD><EFBFBD>⥫쭮<E2A5AB><ECADAE><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⭮<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
; ᮢ<><E1AEA2>襭<EFBFBD><E8A5AD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>筠, <20><> <20>⮡<EFBFBD> <20><>⪭<EFBFBD><E2AAAD><EFBFBD> <20>⥫<EEA1A8><E2A5AB>
|
||||||
|
; <20><>⨬<EFBFBD><E2A8AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>...
|
||||||
|
mov edx, 2251799814
|
||||||
|
mul edx
|
||||||
|
shr edx, 19
|
||||||
|
mov [stall_mcs], edx
|
||||||
|
; PRINT CPU FREQUENCY
|
||||||
|
mov esi, boot_cpufreq
|
||||||
|
call boot_log
|
||||||
|
|
||||||
|
mov ebx, edx
|
||||||
|
movzx ecx, word [boot_y]
|
||||||
|
add ecx, (10+17*6) shl 16 - 10 ; 'CPU frequency is '
|
||||||
|
mov edx, 0xFFFFFF
|
||||||
|
mov edi, 1
|
||||||
|
mov eax, 0x00040000
|
||||||
|
call display_number_force
|
||||||
|
|
||||||
; SET VARIABLES
|
; SET VARIABLES
|
||||||
|
|
||||||
@@ -745,7 +762,7 @@ no_lib_load:
|
|||||||
|
|
||||||
;call detect_devices
|
;call detect_devices
|
||||||
stdcall load_driver, szPS2MDriver
|
stdcall load_driver, szPS2MDriver
|
||||||
stdcall load_driver, szCOM_MDriver
|
; stdcall load_driver, szCOM_MDriver
|
||||||
|
|
||||||
mov esi,boot_setmouse
|
mov esi,boot_setmouse
|
||||||
call boot_log
|
call boot_log
|
||||||
@@ -789,8 +806,6 @@ no_lib_load:
|
|||||||
stdcall map_page,tss._io_map_1,\
|
stdcall map_page,tss._io_map_1,\
|
||||||
(tss._io_map_1-OS_BASE), PG_MAP
|
(tss._io_map_1-OS_BASE), PG_MAP
|
||||||
|
|
||||||
mov ax,[OS_BASE+0x10000+bx_from_load]
|
|
||||||
|
|
||||||
|
|
||||||
; LOAD FIRST APPLICATION
|
; LOAD FIRST APPLICATION
|
||||||
cli
|
cli
|
||||||
@@ -989,55 +1004,27 @@ osloop:
|
|||||||
; MAIN OS LOOP END ;
|
; MAIN OS LOOP END ;
|
||||||
; ;
|
; ;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
align 4
|
||||||
checkidle:
|
checkidle:
|
||||||
pushad
|
pushad
|
||||||
|
|
||||||
cmp [check_idle_semaphore],0
|
|
||||||
jne no_idle_state
|
|
||||||
|
|
||||||
call change_task
|
call change_task
|
||||||
mov eax,[idlemem]
|
jmp idle_loop_entry
|
||||||
mov ebx,[timer_ticks] ;[0xfdf0]
|
|
||||||
cmp eax,ebx
|
|
||||||
jnz idle_exit
|
|
||||||
call _rdtsc
|
|
||||||
mov ecx,eax
|
|
||||||
idle_loop:
|
idle_loop:
|
||||||
|
cmp eax,[idlemem] ; eax == [timer_ticks]
|
||||||
|
jne idle_exit
|
||||||
|
rdtsc ;call _rdtsc
|
||||||
|
mov ecx,eax
|
||||||
hlt
|
hlt
|
||||||
cmp [check_idle_semaphore],0
|
rdtsc ;call _rdtsc
|
||||||
jne idle_loop_exit
|
|
||||||
mov eax,[timer_ticks] ;[0xfdf0]
|
|
||||||
cmp ebx,eax
|
|
||||||
jz idle_loop
|
|
||||||
idle_loop_exit:
|
|
||||||
mov [idlemem],eax
|
|
||||||
call _rdtsc
|
|
||||||
sub eax,ecx
|
sub eax,ecx
|
||||||
mov ebx,[idleuse]
|
add [idleuse],eax
|
||||||
add ebx,eax
|
idle_loop_entry:
|
||||||
mov [idleuse],ebx
|
mov eax,[timer_ticks] ; eax = [timer_ticks]
|
||||||
|
cmp [check_idle_semaphore],0
|
||||||
popad
|
je idle_loop
|
||||||
ret
|
|
||||||
|
|
||||||
idle_exit:
|
|
||||||
|
|
||||||
mov ebx,[timer_ticks] ;[0xfdf0]
|
|
||||||
mov [idlemem],ebx
|
|
||||||
call change_task
|
|
||||||
|
|
||||||
popad
|
|
||||||
ret
|
|
||||||
|
|
||||||
no_idle_state:
|
|
||||||
|
|
||||||
dec [check_idle_semaphore]
|
dec [check_idle_semaphore]
|
||||||
|
idle_exit:
|
||||||
mov ebx,[timer_ticks] ;[0xfdf0]
|
mov [idlemem],eax ; eax == [timer_ticks]
|
||||||
mov [idlemem],ebx
|
|
||||||
call change_task
|
|
||||||
|
|
||||||
popad
|
popad
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@@ -1146,7 +1133,6 @@ set_variables:
|
|||||||
mov [BTN_ADDR],dword BUTTON_INFO ; address of button list
|
mov [BTN_ADDR],dword BUTTON_INFO ; address of button list
|
||||||
|
|
||||||
;!! IP 04.02.2005:
|
;!! IP 04.02.2005:
|
||||||
mov [next_usage_update], 100
|
|
||||||
mov byte [DONT_SWITCH], 0 ; change task if possible
|
mov byte [DONT_SWITCH], 0 ; change task if possible
|
||||||
|
|
||||||
ret
|
ret
|
||||||
@@ -1306,6 +1292,7 @@ display_number_force:
|
|||||||
xor edx,edx
|
xor edx,edx
|
||||||
call division_64_bits
|
call division_64_bits
|
||||||
div ebx
|
div ebx
|
||||||
|
hexletters = __fdo_hexdigits
|
||||||
add edx,hexletters
|
add edx,hexletters
|
||||||
mov dl,[edx]
|
mov dl,[edx]
|
||||||
mov [edi],dl
|
mov [edi],dl
|
||||||
@@ -2261,8 +2248,9 @@ sys_cachetodiskette:
|
|||||||
|
|
||||||
uglobal
|
uglobal
|
||||||
; bgrchanged dd 0x0
|
; bgrchanged dd 0x0
|
||||||
bgrlock db 0
|
align 4
|
||||||
bgrlockpid dd 0
|
bgrlockpid dd 0
|
||||||
|
bgrlock db 0
|
||||||
endg
|
endg
|
||||||
|
|
||||||
sys_background:
|
sys_background:
|
||||||
@@ -2274,10 +2262,9 @@ sys_background:
|
|||||||
cmp edx,0
|
cmp edx,0
|
||||||
je sbgrr
|
je sbgrr
|
||||||
@@:
|
@@:
|
||||||
mov al, 1
|
;;Maxis use atomic bts for mutexes 4.4.2009
|
||||||
xchg [bgrlock], al
|
bts dword [bgrlock], 0
|
||||||
test al, al
|
jnc @f
|
||||||
jz @f
|
|
||||||
call change_task
|
call change_task
|
||||||
jmp @b
|
jmp @b
|
||||||
@@:
|
@@:
|
||||||
@@ -2287,7 +2274,11 @@ sys_background:
|
|||||||
|
|
||||||
pushad
|
pushad
|
||||||
; return memory for old background
|
; return memory for old background
|
||||||
stdcall kernel_free, [img_background]
|
mov eax, [img_background]
|
||||||
|
cmp eax, static_background_data
|
||||||
|
jz @f
|
||||||
|
stdcall kernel_free, eax
|
||||||
|
@@:
|
||||||
; calculate RAW size
|
; calculate RAW size
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
inc eax
|
inc eax
|
||||||
@@ -2306,9 +2297,18 @@ sys_background:
|
|||||||
; get memory for new background
|
; get memory for new background
|
||||||
stdcall kernel_alloc, eax
|
stdcall kernel_alloc, eax
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .exit_mem
|
jz .memfailed
|
||||||
mov [img_background], eax
|
mov [img_background], eax
|
||||||
.exit_mem:
|
jmp .exit
|
||||||
|
.memfailed:
|
||||||
|
; revert to static monotone data
|
||||||
|
mov [img_background], static_background_data
|
||||||
|
xor eax, eax
|
||||||
|
inc eax
|
||||||
|
mov [BgrDataWidth], eax
|
||||||
|
mov [BgrDataHeight], eax
|
||||||
|
mov [mem_BACKGROUND], 4
|
||||||
|
.exit:
|
||||||
popad
|
popad
|
||||||
mov [bgrlock], 0
|
mov [bgrlock], 0
|
||||||
|
|
||||||
@@ -2320,20 +2320,25 @@ nosb1:
|
|||||||
cmp ebx,2 ; SET PIXEL
|
cmp ebx,2 ; SET PIXEL
|
||||||
jnz nosb2
|
jnz nosb2
|
||||||
|
|
||||||
|
mov eax, [img_background]
|
||||||
|
test ecx, ecx
|
||||||
|
jz @f
|
||||||
|
cmp eax, static_background_data
|
||||||
|
jz .ret
|
||||||
|
@@:
|
||||||
mov ebx, [mem_BACKGROUND]
|
mov ebx, [mem_BACKGROUND]
|
||||||
add ebx, 4095
|
add ebx, 4095
|
||||||
and ebx, -4096
|
and ebx, -4096
|
||||||
sub ebx, 4
|
sub ebx, 4
|
||||||
cmp ecx, ebx
|
cmp ecx, ebx
|
||||||
ja @F
|
ja .ret
|
||||||
|
|
||||||
mov eax,[img_background]
|
|
||||||
mov ebx,[eax+ecx]
|
mov ebx,[eax+ecx]
|
||||||
and ebx,0xFF000000 ;255*256*256*256
|
and ebx,0xFF000000 ;255*256*256*256
|
||||||
and edx,0x00FFFFFF ;255*256*256+255*256+255
|
and edx,0x00FFFFFF ;255*256*256+255*256+255
|
||||||
add edx,ebx
|
add edx,ebx
|
||||||
mov [eax+ecx],edx
|
mov [eax+ecx],edx
|
||||||
@@:
|
.ret:
|
||||||
ret
|
ret
|
||||||
nosb2:
|
nosb2:
|
||||||
|
|
||||||
@@ -2363,6 +2368,13 @@ draw_background_temp:
|
|||||||
|
|
||||||
cmp ebx,5 ; BLOCK MOVE TO BGR
|
cmp ebx,5 ; BLOCK MOVE TO BGR
|
||||||
jnz nosb5
|
jnz nosb5
|
||||||
|
cmp [img_background], static_background_data
|
||||||
|
jnz @f
|
||||||
|
test edx, edx
|
||||||
|
jnz .fin
|
||||||
|
cmp esi, 4
|
||||||
|
ja .fin
|
||||||
|
@@:
|
||||||
; bughere
|
; bughere
|
||||||
mov eax, ecx
|
mov eax, ecx
|
||||||
mov ebx, edx
|
mov ebx, edx
|
||||||
@@ -2375,16 +2387,17 @@ draw_background_temp:
|
|||||||
|
|
||||||
cmp ebx, 6
|
cmp ebx, 6
|
||||||
jnz nosb6
|
jnz nosb6
|
||||||
|
;;Maxis use atomic bts for mutex 4.4.2009
|
||||||
@@:
|
@@:
|
||||||
mov al, 1
|
bts dword [bgrlock], 0
|
||||||
xchg [bgrlock], al
|
jnc @f
|
||||||
test al, al
|
|
||||||
jz @f
|
|
||||||
call change_task
|
call change_task
|
||||||
jmp @b
|
jmp @b
|
||||||
@@:
|
@@:
|
||||||
mov eax, [CURRENT_TASK]
|
mov eax, [CURRENT_TASK]
|
||||||
mov [bgrlockpid], eax
|
mov [bgrlockpid], eax
|
||||||
|
cmp [img_background], static_background_data
|
||||||
|
jz .nomem
|
||||||
stdcall user_alloc, [mem_BACKGROUND]
|
stdcall user_alloc, [mem_BACKGROUND]
|
||||||
mov [esp+32], eax
|
mov [esp+32], eax
|
||||||
test eax, eax
|
test eax, eax
|
||||||
@@ -2485,19 +2498,24 @@ nogb1:
|
|||||||
cmp eax,2 ; PIXEL
|
cmp eax,2 ; PIXEL
|
||||||
jnz nogb2
|
jnz nogb2
|
||||||
|
|
||||||
|
mov eax, [img_background]
|
||||||
|
test ebx, ebx
|
||||||
|
jz @f
|
||||||
|
cmp eax, static_background_data
|
||||||
|
jz .ret
|
||||||
|
@@:
|
||||||
mov ecx, [mem_BACKGROUND]
|
mov ecx, [mem_BACKGROUND]
|
||||||
add ecx, 4095
|
add ecx, 4095
|
||||||
and ecx, -4096
|
and ecx, -4096
|
||||||
sub ecx, 4
|
sub ecx, 4
|
||||||
cmp ebx, ecx
|
cmp ebx, ecx
|
||||||
ja @F
|
ja .ret
|
||||||
|
|
||||||
mov eax,[img_background]
|
|
||||||
mov eax,[ebx+eax]
|
mov eax,[ebx+eax]
|
||||||
|
|
||||||
and eax, 0xFFFFFF
|
and eax, 0xFFFFFF
|
||||||
mov [esp+36],eax
|
mov [esp+36],eax
|
||||||
@@:
|
.ret:
|
||||||
ret
|
ret
|
||||||
nogb2:
|
nogb2:
|
||||||
|
|
||||||
@@ -3083,8 +3101,6 @@ sys_set_window:
|
|||||||
|
|
||||||
call check_window_position
|
call check_window_position
|
||||||
|
|
||||||
call set_window_clientbox
|
|
||||||
|
|
||||||
push ecx esi edi ; save for window fullscreen/resize
|
push ecx esi edi ; save for window fullscreen/resize
|
||||||
;mov esi,edi
|
;mov esi,edi
|
||||||
|
|
||||||
@@ -3133,6 +3149,8 @@ sys_set_window:
|
|||||||
mov [BTN_COUNT],byte 0 ; empty button buffer
|
mov [BTN_COUNT],byte 0 ; empty button buffer
|
||||||
|
|
||||||
newd:
|
newd:
|
||||||
|
call set_window_clientbox
|
||||||
|
|
||||||
mov [edi+WDATA.fl_redraw],byte 0 ; no redraw
|
mov [edi+WDATA.fl_redraw],byte 0 ; no redraw
|
||||||
mov edx,edi
|
mov edx,edi
|
||||||
|
|
||||||
@@ -3649,14 +3667,6 @@ redrawscreen:
|
|||||||
|
|
||||||
calculatebackground: ; background
|
calculatebackground: ; background
|
||||||
|
|
||||||
; all black
|
|
||||||
|
|
||||||
mov edi, [img_background] ;IMG_BACKGROUND ; set background to black
|
|
||||||
xor eax, eax
|
|
||||||
mov ecx, 1023 ;0x0fff00 / 4
|
|
||||||
cld
|
|
||||||
rep stosd
|
|
||||||
|
|
||||||
mov edi,display_data ; set os to use all pixels
|
mov edi,display_data ; set os to use all pixels
|
||||||
mov eax,0x01010101
|
mov eax,0x01010101
|
||||||
mov ecx,1280*1024 / 4
|
mov ecx,1280*1024 / 4
|
||||||
@@ -3705,7 +3715,9 @@ delay_ms: ; delay in 1/1000 sec
|
|||||||
|
|
||||||
set_app_param:
|
set_app_param:
|
||||||
mov edi, [TASK_BASE]
|
mov edi, [TASK_BASE]
|
||||||
|
mov eax, [edi + TASKDATA.event_mask]
|
||||||
mov [edi + TASKDATA.event_mask], ebx
|
mov [edi + TASKDATA.event_mask], ebx
|
||||||
|
mov [esp+32], eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
@@ -4648,7 +4660,7 @@ setmouse: ; set mousepicture -pointer
|
|||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
if used _rdtsc
|
||||||
_rdtsc:
|
_rdtsc:
|
||||||
bt [cpu_caps], CAPS_TSC
|
bt [cpu_caps], CAPS_TSC
|
||||||
jnc ret_rdtsc
|
jnc ret_rdtsc
|
||||||
@@ -4658,6 +4670,7 @@ _rdtsc:
|
|||||||
mov edx,0xffffffff
|
mov edx,0xffffffff
|
||||||
mov eax,0xffffffff
|
mov eax,0xffffffff
|
||||||
ret
|
ret
|
||||||
|
end if
|
||||||
|
|
||||||
rerouteirqs:
|
rerouteirqs:
|
||||||
|
|
||||||
@@ -5350,7 +5363,7 @@ align 4
|
|||||||
sys_apm:
|
sys_apm:
|
||||||
cmp word [apm_vf], 0 ; Check APM BIOS enable
|
cmp word [apm_vf], 0 ; Check APM BIOS enable
|
||||||
jne @f
|
jne @f
|
||||||
or [esp + 56], byte 1 ; error
|
or [esp + 48], byte 1 ; error
|
||||||
mov [esp + 36], dword 8 ; 32-bit protected-mode interface not supported
|
mov [esp + 36], dword 8 ; 32-bit protected-mode interface not supported
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@@ -5360,7 +5373,7 @@ sys_apm:
|
|||||||
|
|
||||||
cmp al, 3
|
cmp al, 3
|
||||||
ja @f
|
ja @f
|
||||||
and [esp + 56], byte 0xfe ; emulate func 0..3 as func 0
|
and [esp + 48], byte 0xfe ; emulate func 0..3 as func 0
|
||||||
mov eax, [apm_vf]
|
mov eax, [apm_vf]
|
||||||
mov [esp + 36], eax
|
mov [esp + 36], eax
|
||||||
shr eax, 16
|
shr eax, 16
|
||||||
@@ -5390,8 +5403,8 @@ sys_apm:
|
|||||||
mov [esp + 32], ecx
|
mov [esp + 32], ecx
|
||||||
mov [esp + 36], eax
|
mov [esp + 36], eax
|
||||||
setc al
|
setc al
|
||||||
and [esp + 56], byte 0xfe
|
and [esp + 48], byte 0xfe
|
||||||
or [esp + 56], al
|
or [esp + 48], al
|
||||||
|
|
||||||
|
|
||||||
ret
|
ret
|
||||||
@@ -5443,7 +5456,7 @@ yes_shutdown_param:
|
|||||||
out 0x21, al
|
out 0x21, al
|
||||||
out 0xA1, al
|
out 0xA1, al
|
||||||
|
|
||||||
if 1
|
if 0
|
||||||
mov word [OS_BASE+0x467+0],pr_mode_exit
|
mov word [OS_BASE+0x467+0],pr_mode_exit
|
||||||
mov word [OS_BASE+0x467+2],0x1000
|
mov word [OS_BASE+0x467+2],0x1000
|
||||||
|
|
||||||
@@ -5456,6 +5469,7 @@ if 1
|
|||||||
out 0x64,al
|
out 0x64,al
|
||||||
|
|
||||||
hlt
|
hlt
|
||||||
|
jmp $-1
|
||||||
|
|
||||||
else
|
else
|
||||||
cmp byte [OS_BASE + 0x9030], 2
|
cmp byte [OS_BASE + 0x9030], 2
|
||||||
@@ -5507,6 +5521,72 @@ else
|
|||||||
jmp no_acpi_power_off
|
jmp no_acpi_power_off
|
||||||
.fadt_found:
|
.fadt_found:
|
||||||
; ebx is linear address of FADT
|
; ebx is linear address of FADT
|
||||||
|
mov edi, [ebx+40] ; physical address of the DSDT
|
||||||
|
lea eax, [ebp+4000h]
|
||||||
|
stdcall map_page, eax, edi, PG_MAP
|
||||||
|
lea eax, [ebp+5000h]
|
||||||
|
lea esi, [edi+0x1000]
|
||||||
|
stdcall map_page, eax, esi, PG_MAP
|
||||||
|
and esi, 0xFFF
|
||||||
|
sub edi, esi
|
||||||
|
cmp dword [esi+ebp+4000h], 'DSDT'
|
||||||
|
jnz no_acpi_power_off
|
||||||
|
mov eax, [esi+ebp+4004h] ; DSDT length
|
||||||
|
sub eax, 36+4
|
||||||
|
jbe no_acpi_power_off
|
||||||
|
add esi, 36
|
||||||
|
.scan_dsdt:
|
||||||
|
cmp dword [esi+ebp+4000h], '_S5_'
|
||||||
|
jnz .scan_dsdt_cont
|
||||||
|
cmp byte [esi+ebp+4000h+4], 12h ; DefPackage opcode
|
||||||
|
jnz .scan_dsdt_cont
|
||||||
|
mov dl, [esi+ebp+4000h+6]
|
||||||
|
cmp dl, 4 ; _S5_ package must contain 4 bytes
|
||||||
|
; ...in theory; in practice, VirtualBox has 2 bytes
|
||||||
|
ja .scan_dsdt_cont
|
||||||
|
cmp dl, 1
|
||||||
|
jb .scan_dsdt_cont
|
||||||
|
lea esi, [esi+ebp+4000h+7]
|
||||||
|
xor ecx, ecx
|
||||||
|
cmp byte [esi], 0 ; 0 means zero byte, 0Ah xx means byte xx
|
||||||
|
jz @f
|
||||||
|
cmp byte [esi], 0xA
|
||||||
|
jnz no_acpi_power_off
|
||||||
|
inc esi
|
||||||
|
mov cl, [esi]
|
||||||
|
@@:
|
||||||
|
inc esi
|
||||||
|
cmp dl, 2
|
||||||
|
jb @f
|
||||||
|
cmp byte [esi], 0
|
||||||
|
jz @f
|
||||||
|
cmp byte [esi], 0xA
|
||||||
|
jnz no_acpi_power_off
|
||||||
|
inc esi
|
||||||
|
mov ch, [esi]
|
||||||
|
@@:
|
||||||
|
jmp do_acpi_power_off
|
||||||
|
.scan_dsdt_cont:
|
||||||
|
inc esi
|
||||||
|
cmp esi, 0x1000
|
||||||
|
jb @f
|
||||||
|
sub esi, 0x1000
|
||||||
|
add edi, 0x1000
|
||||||
|
push eax
|
||||||
|
lea eax, [ebp+4000h]
|
||||||
|
stdcall map_page, eax, edi, PG_MAP
|
||||||
|
push PG_MAP
|
||||||
|
lea eax, [edi+1000h]
|
||||||
|
push eax
|
||||||
|
lea eax, [ebp+5000h]
|
||||||
|
push eax
|
||||||
|
stdcall map_page
|
||||||
|
pop eax
|
||||||
|
@@:
|
||||||
|
dec eax
|
||||||
|
jnz .scan_dsdt
|
||||||
|
jmp no_acpi_power_off
|
||||||
|
do_acpi_power_off:
|
||||||
mov edx, [ebx+48]
|
mov edx, [ebx+48]
|
||||||
test edx, edx
|
test edx, edx
|
||||||
jz .nosmi
|
jz .nosmi
|
||||||
@@ -5518,17 +5598,20 @@ else
|
|||||||
test al, 1
|
test al, 1
|
||||||
jz @b
|
jz @b
|
||||||
.nosmi:
|
.nosmi:
|
||||||
|
and cx, 0x0707
|
||||||
|
shl cx, 2
|
||||||
|
or cx, 0x2020
|
||||||
mov edx, [ebx+64]
|
mov edx, [ebx+64]
|
||||||
in ax, dx
|
in ax, dx
|
||||||
and ax, 203h
|
and ax, 203h
|
||||||
or ax, 3C00h
|
or ah, cl
|
||||||
out dx, ax
|
out dx, ax
|
||||||
mov edx, [ebx+68]
|
mov edx, [ebx+68]
|
||||||
test edx, edx
|
test edx, edx
|
||||||
jz @f
|
jz @f
|
||||||
in ax, dx
|
in ax, dx
|
||||||
and ax, 203h
|
and ax, 203h
|
||||||
or ax, 3C00h
|
or ah, ch
|
||||||
out dx, ax
|
out dx, ax
|
||||||
@@:
|
@@:
|
||||||
jmp $
|
jmp $
|
||||||
@@ -5547,6 +5630,7 @@ no_acpi_power_off:
|
|||||||
out 0x64,al
|
out 0x64,al
|
||||||
|
|
||||||
hlt
|
hlt
|
||||||
|
jmp $-1
|
||||||
|
|
||||||
scan_rsdp:
|
scan_rsdp:
|
||||||
add eax, OS_BASE
|
add eax, OS_BASE
|
||||||
@@ -5578,4 +5662,3 @@ __REV__ = __REV
|
|||||||
|
|
||||||
uglobals_size = $ - endofcode
|
uglobals_size = $ - endofcode
|
||||||
diff16 "end of kernel code",0,$
|
diff16 "end of kernel code",0,$
|
||||||
|
|
||||||
|
@@ -121,9 +121,9 @@ struc APPDATA
|
|||||||
db 5 dup(?)
|
db 5 dup(?)
|
||||||
|
|
||||||
.fpu_state dd ? ;+16
|
.fpu_state dd ? ;+16
|
||||||
.ev_count dd ? ;+20
|
.ev_count_ dd ? ;unused ;+20
|
||||||
.fpu_handler dd ? ;+24
|
.exc_handler dd ? ;+24
|
||||||
.sse_handler dd ? ;+28
|
.except_mask dd ? ;+28
|
||||||
.pl0_stack dd ? ;unused ;+32
|
.pl0_stack dd ? ;unused ;+32
|
||||||
.heap_base dd ? ;+36
|
.heap_base dd ? ;+36
|
||||||
.heap_top dd ? ;+40
|
.heap_top dd ? ;+40
|
||||||
@@ -138,8 +138,10 @@ struc APPDATA
|
|||||||
.cur_dir dd ? ;+80
|
.cur_dir dd ? ;+80
|
||||||
.wait_timeout dd ? ;+84
|
.wait_timeout dd ? ;+84
|
||||||
.saved_esp0 dd ? ;+88
|
.saved_esp0 dd ? ;+88
|
||||||
|
.wait_begin dd ? ;+92 +++
|
||||||
db 36 dup(?) ;+92
|
.wait_test dd ? ;+96 +++
|
||||||
|
.wait_param dd ? ;+100 +++
|
||||||
|
db 24 dup(?) ;+104
|
||||||
|
|
||||||
.wnd_shape dd ? ;+128
|
.wnd_shape dd ? ;+128
|
||||||
.wnd_shape_scale dd ? ;+132
|
.wnd_shape_scale dd ? ;+132
|
||||||
|
@@ -98,3 +98,9 @@ if ~ f eq
|
|||||||
end if
|
end if
|
||||||
}
|
}
|
||||||
; \end{diamond}[29.09.2006]
|
; \end{diamond}[29.09.2006]
|
||||||
|
|
||||||
|
macro Mov op1,op2,op3 ; op1 = op2 = op3
|
||||||
|
{
|
||||||
|
mov op2,op3
|
||||||
|
mov op1,op2
|
||||||
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
FASM=fasm
|
FASM=fasm
|
||||||
FLAGS=-m 65536
|
FLAGS=-m 65536
|
||||||
languages=en|ru|ge|et
|
languages=en|ru|ge|et
|
||||||
drivers_src=sound sis infinity ensoniq ps2mouse uart ati2d vmode
|
drivers_src=sound sis infinity uart ati2d vmode com_mouse
|
||||||
skins_src=default
|
skins_src=default
|
||||||
|
|
||||||
.PHONY: all kernel drivers skins clean
|
.PHONY: all kernel drivers skins clean
|
||||||
|
@@ -23,12 +23,17 @@
|
|||||||
; 0x9046 - word - flags
|
; 0x9046 - word - flags
|
||||||
; 0:907F byte number of BIOS hard disks
|
; 0:907F byte number of BIOS hard disks
|
||||||
; 0:9080 Nbytes BIOS hard disks
|
; 0:9080 Nbytes BIOS hard disks
|
||||||
|
; 0:9100 word available physical memory map: number of blocks
|
||||||
|
; 0:9104 available physical memory map: blocks
|
||||||
;
|
;
|
||||||
; Runtime:
|
; Runtime:
|
||||||
;
|
;
|
||||||
; 0x00000000 -> 0x7FFFFFFF application 2Gb
|
; 0x00000000 -> 0x7FFFFFFF application 2Gb
|
||||||
|
|
||||||
; 0x80000000 -> 1FFF window_data - 256 entries
|
; 0x80000000 -> 0FFF physical page zero - do not write
|
||||||
|
; (used by int 13h in some configurations)
|
||||||
|
;
|
||||||
|
; 0x80001000 -> 2FFF window_data - 256 entries
|
||||||
;
|
;
|
||||||
; 0000 dword x start
|
; 0000 dword x start
|
||||||
; 0004 dword y start
|
; 0004 dword y start
|
||||||
@@ -39,8 +44,6 @@
|
|||||||
; 0018 dword color of frames
|
; 0018 dword color of frames
|
||||||
; 001C dword window flags, +30 = window drawn, +31 redraw flag
|
; 001C dword window flags, +30 = window drawn, +31 redraw flag
|
||||||
;
|
;
|
||||||
; 2000 -> 2FFF free
|
|
||||||
;
|
|
||||||
; 3000 -> 4FFF task list - 256 entries
|
; 3000 -> 4FFF task list - 256 entries
|
||||||
;
|
;
|
||||||
; 00 dword process count
|
; 00 dword process count
|
||||||
@@ -70,9 +73,9 @@
|
|||||||
;
|
;
|
||||||
; A400 -> B0FF free
|
; A400 -> B0FF free
|
||||||
|
|
||||||
; B100 -> B2FF IDT
|
; B100 -> B307 IDT for int_0x00..int_0x40
|
||||||
|
|
||||||
; B300 -> BFFF free
|
; B308 -> BFFF free
|
||||||
|
|
||||||
; C000 -> C3FF window stack C000 no of windows - all in words
|
; C000 -> C3FF window stack C000 no of windows - all in words
|
||||||
; C402 -> C7FF window position in stack
|
; C402 -> C7FF window position in stack
|
||||||
|
@@ -113,7 +113,7 @@ palette320x200:
|
|||||||
loop palnew
|
loop palnew
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
align 4
|
||||||
uglobal
|
uglobal
|
||||||
novesachecksum dd 0x0
|
novesachecksum dd 0x0
|
||||||
EGA_counter db 0
|
EGA_counter db 0
|
||||||
@@ -123,7 +123,7 @@ uglobal
|
|||||||
temp:
|
temp:
|
||||||
.cx dd 0
|
.cx dd 0
|
||||||
endg
|
endg
|
||||||
|
align 4
|
||||||
checkVga_N13:
|
checkVga_N13:
|
||||||
|
|
||||||
cmp [SCR_MODE],dword 0x13
|
cmp [SCR_MODE],dword 0x13
|
||||||
|
Reference in New Issue
Block a user