sync with trunk

git-svn-id: svn://kolibrios.org@1198 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
CleverMouse 2009-10-07 09:59:35 +00:00
parent 9c06d10fb3
commit 6507cc5019
36 changed files with 5707 additions and 5930 deletions

File diff suppressed because it is too large Load Diff

View File

@ -282,6 +282,7 @@ save_timer_fdd_motor:
;***************************************** ;*****************************************
;* 闲温判世 抢呐衅嗜 论仕拮磐冗 涛椅欣 * ;* 闲温判世 抢呐衅嗜 论仕拮磐冗 涛椅欣 *
;***************************************** ;*****************************************
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

View File

@ -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

View File

@ -104,7 +104,7 @@ _rs db 186,'
_bt db 186,' ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÙ',13,10,0 _bt db 186,' ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÙ',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

View File

@ -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

View File

@ -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

View File

@ -85,7 +85,7 @@ _bt db 186,'
remark1 db "‡­ ç¥­¨ï ¯® 㬮«ç ­¨î ¢ë¡à ­ë ¤«ï 㤮¡á⢠ ¡®«ì設á⢠, ­® ­¥ ¢á¥å.",0 remark1 db "‡­ ç¥­¨ï ¯® 㬮«ç ­¨î ¢ë¡à ­ë ¤«ï 㤮¡á⢠ ¡®«ì設á⢠, ­® ­¥ ¢á¥å.",0
remark2 db "…᫨ ã ‚ á LCD-¬®­¨â®à, ®âª«îç¨â¥ VRR ¢ ¯ã­ªâ¥ [c] - ®­ ‚ ¬ ­¥ ­ã¦¥­.",0 remark2 db "…᫨ ã ‚ á <EFBFBD>-¬®­¨â®à, ¢ª«îç¨â¥ VRR ¢ ¯ã­ªâ¥ [c].",0
remark3 db "…᫨ ã ‚ á ­¥ £à㧨âáï á¨á⥬ , ¯®¯à®¡ã©â¥ ®âª«îç¨âì ¯ã­ªâ [b].",0 remark3 db "…᫨ ã ‚ á ­¥ £à㧨âáï á¨á⥬ , ¯®¯à®¡ã©â¥ ®âª«îç¨âì ¯ã­ªâ [b].",0
remarks dw remark1, remark2, remark3 remarks dw remark1, remark2, remark3
num_remarks = 3 num_remarks = 3

View File

@ -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

View File

@ -95,11 +95,11 @@ CAPS_SVM equ 73 ;secure virual machine
CAPS_ALTMOVCR8 equ 74 ; CAPS_ALTMOVCR8 equ 74 ;
; CPU MSR names ; CPU MSR names
MSR_SYSENTER_CS equ 0x174 MSR_SYSENTER_CS equ 0x174
MSR_SYSENTER_ESP equ 0x175 MSR_SYSENTER_ESP equ 0x175
MSR_SYSENTER_EIP equ 0x176 MSR_SYSENTER_EIP equ 0x176
MSR_AMD_EFER equ 0xC0000080 ; Extended Feature Enable Register MSR_AMD_EFER equ 0xC0000080 ; Extended Feature Enable Register
MSR_AMD_STAR equ 0xC0000081 ; SYSCALL/SYSRET Target Address Register MSR_AMD_STAR equ 0xC0000081 ; SYSCALL/SYSRET Target Address Register
CR0_PE equ 0x00000001 ;protected mode CR0_PE equ 0x00000001 ;protected mode
CR0_MP equ 0x00000002 ;monitor fpu CR0_MP equ 0x00000002 ;monitor fpu
@ -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 áàéò äëÿ êîíòåêñòà FPU RING0_STACK_SIZE equ (0x2000 - 512) ;512 áàéò äëÿ êîíòåêñòà 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

View File

@ -10,71 +10,71 @@ $Revision: 750 $
; diamond, 2006 ; diamond, 2006
sys_debug_services: sys_debug_services:
cmp eax, 9 cmp eax, 9
ja @f ja @f
jmp dword [sys_debug_services_table+eax*4] jmp dword [sys_debug_services_table+eax*4]
@@: ret @@: ret
sys_debug_services_table: sys_debug_services_table:
dd debug_set_event_data dd debug_set_event_data
dd debug_getcontext dd debug_getcontext
dd debug_setcontext dd debug_setcontext
dd debug_detach dd debug_detach
dd debug_suspend dd debug_suspend
dd debug_resume dd debug_resume
dd debug_read_process_memory dd debug_read_process_memory
dd debug_write_process_memory dd debug_write_process_memory
dd debug_terminate dd debug_terminate
dd debug_set_drx dd debug_set_drx
debug_set_event_data: debug_set_event_data:
; in: ebx = pointer ; in: ebx = pointer
; destroys eax ; destroys eax
mov eax, [current_slot] mov eax, [current_slot]
mov [eax+APPDATA.dbg_event_mem], ebx mov [eax+APPDATA.dbg_event_mem], ebx
ret ret
get_debuggee_slot: get_debuggee_slot:
; in: ebx=PID ; in: ebx=PID
; out: CF=1 if error ; out: CF=1 if error
; CF=0 and eax=slot*0x20 if ok ; CF=0 and eax=slot*0x20 if ok
; out: interrupts disabled ; out: interrupts disabled
cli cli
mov eax, ebx mov eax, ebx
call pid_to_slot call pid_to_slot
test eax, eax test eax, eax
jz .ret_bad jz .ret_bad
shl eax, 5 shl eax, 5
push ebx push ebx
mov ebx, [CURRENT_TASK] mov ebx, [CURRENT_TASK]
cmp [SLOT_BASE+eax*8+APPDATA.debugger_slot], ebx cmp [SLOT_BASE+eax*8+APPDATA.debugger_slot], ebx
pop ebx pop ebx
jnz .ret_bad jnz .ret_bad
; clc ; automatically ; clc ; automatically
ret ret
.ret_bad: .ret_bad:
stc stc
ret ret
debug_detach: debug_detach:
; in: ebx=pid ; in: ebx=pid
; destroys eax,ebx ; destroys eax,ebx
call get_debuggee_slot call get_debuggee_slot
jc .ret jc .ret
and dword [eax*8+SLOT_BASE+APPDATA.debugger_slot], 0 and dword [eax*8+SLOT_BASE+APPDATA.debugger_slot], 0
call do_resume call do_resume
.ret: .ret:
sti sti
ret ret
debug_terminate: debug_terminate:
; in: ebx=pid ; in: ebx=pid
call get_debuggee_slot call get_debuggee_slot
jc debug_detach.ret jc debug_detach.ret
mov ecx, eax mov ecx, eax
shr ecx, 5 shr ecx, 5
push 2 push 2
pop ebx pop ebx
jmp sys_system jmp sys_system
debug_suspend: debug_suspend:
; in: ebx=pid ; in: ebx=pid
@ -85,30 +85,30 @@ debug_suspend:
shl eax, 5 shl eax, 5
jz .ret jz .ret
mov bl, [CURRENT_TASK+eax+TASKDATA.state] ; process state mov bl, [CURRENT_TASK+eax+TASKDATA.state] ; process state
test bl, bl test bl, bl
jz .1 jz .1
cmp bl, 5 cmp bl, 5
jnz .ret jnz .ret
mov bl, 2 mov bl, 2
.2: mov [CURRENT_TASK+eax+TASKDATA.state], bl .2: mov [CURRENT_TASK+eax+TASKDATA.state], bl
.ret: .ret:
sti sti
ret ret
.1: .1:
inc ebx inc ebx
jmp .2 jmp .2
do_resume: do_resume:
mov bl, [CURRENT_TASK+eax+TASKDATA.state] mov bl, [CURRENT_TASK+eax+TASKDATA.state]
cmp bl, 1 cmp bl, 1
jz .1 jz .1
cmp bl, 2 cmp bl, 2
jnz .ret jnz .ret
mov bl, 5 mov bl, 5
.2: mov [CURRENT_TASK+eax+TASKDATA.state], bl .2: mov [CURRENT_TASK+eax+TASKDATA.state], bl
.ret: ret .ret: ret
.1: dec ebx .1: dec ebx
jmp .2 jmp .2
debug_resume: debug_resume:
; in: ebx=pid ; in: ebx=pid
@ -119,8 +119,8 @@ debug_resume:
shl eax, 5 shl eax, 5
jz .ret jz .ret
call do_resume call do_resume
.ret: sti .ret: sti
ret ret
debug_getcontext: debug_getcontext:
; in: ; in:
@ -128,16 +128,16 @@ debug_getcontext:
; ecx=sizeof(CONTEXT) ; ecx=sizeof(CONTEXT)
; edx->CONTEXT ; edx->CONTEXT
; destroys eax,ecx,edx,esi,edi ; destroys eax,ecx,edx,esi,edi
cmp ecx, 28h cmp ecx, 28h
jnz .ret jnz .ret
push ebx push ebx
mov ebx, edx mov ebx, edx
call check_region call check_region
pop ebx pop ebx
dec eax dec eax
jnz .ret jnz .ret
call get_debuggee_slot call get_debuggee_slot
jc .ret jc .ret
mov eax, [eax*8+SLOT_BASE+APPDATA.pl0_stack] mov eax, [eax*8+SLOT_BASE+APPDATA.pl0_stack]
lea esi, [eax+RING0_STACK_SIZE] lea esi, [eax+RING0_STACK_SIZE]
mov edi, edx mov edi, edx
@ -147,30 +147,30 @@ debug_getcontext:
; top of ring0 stack: ring3 stack ptr (ss+esp), iret data (cs+eip+eflags), pushad ; top of ring0 stack: ring3 stack ptr (ss+esp), iret data (cs+eip+eflags), pushad
sub esi, 8+12+20h sub esi, 8+12+20h
lodsd ;edi lodsd ;edi
mov [edi+24h], eax mov [edi+24h], eax
lodsd ;esi lodsd ;esi
mov [edi+20h], eax mov [edi+20h], eax
lodsd ; ebp lodsd ; ebp
mov [edi+1Ch], eax mov [edi+1Ch], eax
lodsd ;esp lodsd ;esp
lodsd ;ebx lodsd ;ebx
mov [edi+14h], eax mov [edi+14h], eax
lodsd ;edx lodsd ;edx
mov [edi+10h], eax mov [edi+10h], eax
lodsd ;ecx lodsd ;ecx
mov [edi+0Ch], eax mov [edi+0Ch], eax
lodsd ;eax lodsd ;eax
mov [edi+8], eax mov [edi+8], eax
lodsd ;eip lodsd ;eip
mov [edi], eax mov [edi], eax
lodsd ;cs lodsd ;cs
lodsd ;eflags lodsd ;eflags
mov [edi+4], eax mov [edi+4], eax
lodsd ;esp lodsd ;esp
mov [edi+18h], eax mov [edi+18h], eax
.ret: .ret:
sti sti
ret ret
debug_setcontext: debug_setcontext:
; in: ; in:
@ -178,120 +178,120 @@ debug_setcontext:
; ecx=sizeof(CONTEXT) ; ecx=sizeof(CONTEXT)
; edx->CONTEXT ; edx->CONTEXT
; destroys eax,ecx,edx,esi,edi ; destroys eax,ecx,edx,esi,edi
cmp ecx, 28h cmp ecx, 28h
jnz .ret jnz .ret
push ebx push ebx
mov ebx, edx mov ebx, edx
call check_region call check_region
pop ebx pop ebx
dec eax dec eax
jnz .ret jnz .ret
call get_debuggee_slot call get_debuggee_slot
jc .stiret jc .stiret
mov eax, [eax*8+SLOT_BASE+APPDATA.pl0_stack] mov eax, [eax*8+SLOT_BASE+APPDATA.pl0_stack]
lea edi, [eax+RING0_STACK_SIZE] lea edi, [eax+RING0_STACK_SIZE]
mov esi, edx mov esi, edx
.ring0: .ring0:
sub edi, 8+12+20h sub edi, 8+12+20h
mov eax, [esi+24h] ;edi mov eax, [esi+24h] ;edi
stosd stosd
mov eax, [esi+20h] ;esi mov eax, [esi+20h] ;esi
stosd stosd
mov eax, [esi+1Ch] ;ebp mov eax, [esi+1Ch] ;ebp
stosd stosd
scasd scasd
mov eax, [esi+14h] ;ebx mov eax, [esi+14h] ;ebx
stosd stosd
mov eax, [esi+10h] ;edx mov eax, [esi+10h] ;edx
stosd stosd
mov eax, [esi+0Ch] ;ecx mov eax, [esi+0Ch] ;ecx
stosd stosd
mov eax, [esi+8] ;eax mov eax, [esi+8] ;eax
stosd stosd
mov eax, [esi] ;eip mov eax, [esi] ;eip
stosd stosd
scasd scasd
mov eax, [esi+4] ;eflags mov eax, [esi+4] ;eflags
stosd stosd
mov eax, [esi+18h] ;esp mov eax, [esi+18h] ;esp
stosd stosd
.stiret: .stiret:
sti sti
.ret: .ret:
ret ret
debug_set_drx: debug_set_drx:
call get_debuggee_slot call get_debuggee_slot
jc .errret jc .errret
mov ebp, eax mov ebp, eax
lea eax, [eax*8+SLOT_BASE+APPDATA.dbg_regs] lea eax, [eax*8+SLOT_BASE+APPDATA.dbg_regs]
; [eax]=dr0, [eax+4]=dr1, [eax+8]=dr2, [eax+C]=dr3 ; [eax]=dr0, [eax+4]=dr1, [eax+8]=dr2, [eax+C]=dr3
; [eax+10]=dr7 ; [eax+10]=dr7
cmp edx, OS_BASE cmp edx, OS_BASE
jae .errret jae .errret
cmp cl, 3 cmp cl, 3
ja .errret ja .errret
mov ebx, dr7 mov ebx, dr7
shr ebx, cl shr ebx, cl
shr ebx, cl shr ebx, cl
test ebx, 2 ; bit 1+2*index = G0..G3, global break enable test ebx, 2 ; bit 1+2*index = G0..G3, global break enable
jnz .errret2 jnz .errret2
test ch, ch test ch, ch
jns .new jns .new
; clear breakpoint ; clear breakpoint
movzx ecx, cl movzx ecx, cl
add ecx, ecx add ecx, ecx
and dword [eax+ecx*2], 0 ; clear DR<i> and dword [eax+ecx*2], 0 ; clear DR<i>
btr dword [eax+10h], ecx ; clear L<i> bit btr dword [eax+10h], ecx ; clear L<i> bit
test byte [eax+10h], 55h test byte [eax+10h], 55h
jnz .okret jnz .okret
; imul eax, ebp, tss_step/32 ; imul eax, ebp, tss_step/32
; and byte [eax + tss_data + TSS._trap], not 1 ; and byte [eax + tss_data + TSS._trap], not 1
and [ebp*8 + SLOT_BASE+APPDATA.dbg_state], not 1 and [ebp*8 + SLOT_BASE+APPDATA.dbg_state], not 1
.okret: .okret:
and dword [esp+36], 0 and dword [esp+36], 0
sti sti
ret ret
.errret: .errret:
sti sti
mov dword [esp+36], 1 mov dword [esp+36], 1
ret ret
.errret2: .errret2:
sti sti
mov dword [esp+36], 2 mov dword [esp+36], 2
ret ret
.new: .new:
; add new breakpoint ; add new breakpoint
; cl=index; ch=flags; edx=address ; cl=index; ch=flags; edx=address
test ch, 0xF0 test ch, 0xF0
jnz .errret jnz .errret
mov bl, ch mov bl, ch
and bl, 3 and bl, 3
cmp bl, 2 cmp bl, 2
jz .errret jz .errret
mov bl, ch mov bl, ch
shr bl, 2 shr bl, 2
cmp bl, 2 cmp bl, 2
jz .errret jz .errret
test dl, bl test dl, bl
jnz .errret jnz .errret
or byte [eax+10h+1], 3 ; set GE and LE flags or byte [eax+10h+1], 3 ; set GE and LE flags
movzx ebx, ch movzx ebx, ch
movzx ecx, cl movzx ecx, cl
add ecx, ecx add ecx, ecx
bts dword [eax+10h], ecx ; set L<i> flag bts dword [eax+10h], ecx ; set L<i> flag
add ecx, ecx add ecx, ecx
mov [eax+ecx], edx ; set DR<i> mov [eax+ecx], edx ; set DR<i>
shl ebx, cl shl ebx, cl
mov edx, 0xF mov edx, 0xF
shl edx, cl shl edx, cl
not edx not edx
and [eax+10h+2], dx and [eax+10h+2], dx
or [eax+10h+2], bx ; set R/W and LEN fields or [eax+10h+2], bx ; set R/W and LEN fields
; imul eax, ebp, tss_step/32 ; imul eax, ebp, tss_step/32
; or byte [eax + tss_data + TSS._trap], 1 ; or byte [eax + tss_data + TSS._trap], 1
or [ebp*8 + SLOT_BASE+APPDATA.dbg_state], 1 or [ebp*8 + SLOT_BASE+APPDATA.dbg_state], 1
jmp .okret jmp .okret
debug_read_process_memory: debug_read_process_memory:
; in: ; in:
@ -301,23 +301,23 @@ debug_read_process_memory:
; edx=address in debuggee ; edx=address in debuggee
; out: [esp+36]=sizeof(read) ; out: [esp+36]=sizeof(read)
; destroys all ; destroys all
push ebx push ebx
mov ebx, esi mov ebx, esi
call check_region call check_region
pop ebx pop ebx
dec eax dec eax
jnz .err jnz .err
call get_debuggee_slot call get_debuggee_slot
jc .err jc .err
shr eax, 5 shr eax, 5
mov ebx, esi mov ebx, esi
call read_process_memory call read_process_memory
sti sti
mov dword [esp+36], eax mov dword [esp+36], eax
ret ret
.err: .err:
or dword [esp+36], -1 or dword [esp+36], -1
ret ret
debug_write_process_memory: debug_write_process_memory:
; in: ; in:
@ -327,20 +327,20 @@ debug_write_process_memory:
; edx=address in debuggee ; edx=address in debuggee
; out: [esp+36]=sizeof(write) ; out: [esp+36]=sizeof(write)
; destroys all ; destroys all
push ebx push ebx
mov ebx, esi mov ebx, esi
call check_region call check_region
pop ebx pop ebx
dec eax dec eax
jnz debug_read_process_memory.err jnz debug_read_process_memory.err
call get_debuggee_slot call get_debuggee_slot
jc debug_read_process_memory.err jc debug_read_process_memory.err
shr eax, 5 shr eax, 5
mov ebx, esi mov ebx, esi
call write_process_memory call write_process_memory
sti sti
mov [esp+36], eax mov [esp+36], eax
ret ret
debugger_notify: debugger_notify:
; in: eax=debugger slot ; in: eax=debugger slot
@ -349,127 +349,68 @@ debugger_notify:
; interrupts must be disabled! ; interrupts must be disabled!
; destroys all general registers ; destroys all general registers
; interrupts remain disabled ; interrupts remain disabled
xchg ebp, eax xchg ebp, eax
mov edi, [timer_ticks] mov edi, [timer_ticks]
add edi, 500 ; 5 sec timeout add edi, 500 ; 5 sec timeout
.1: .1:
mov eax, ebp mov eax, ebp
shl eax, 8 shl eax, 8
mov edx, [SLOT_BASE+eax+APPDATA.dbg_event_mem] mov edx, [SLOT_BASE+eax+APPDATA.dbg_event_mem]
test edx, edx test edx, edx
jz .ret jz .ret
; read buffer header ; read buffer header
push ecx push ecx
push eax push eax
push eax push eax
mov eax, ebp mov eax, ebp
mov ebx, esp mov ebx, esp
mov ecx, 8 mov ecx, 8
call read_process_memory call read_process_memory
cmp eax, ecx cmp eax, ecx
jz @f jz @f
add esp, 12 add esp, 12
jmp .ret jmp .ret
@@: @@:
cmp dword [ebx], 0 cmp dword [ebx], 0
jg @f jg @f
.2: .2:
pop ecx pop ecx
pop ecx pop ecx
pop ecx pop ecx
cmp dword [CURRENT_TASK], 1 cmp dword [CURRENT_TASK], 1
jnz .notos jnz .notos
cmp [timer_ticks], edi cmp [timer_ticks], edi
jae .ret jae .ret
.notos: .notos:
sti sti
call change_task call change_task
cli cli
jmp .1 jmp .1
@@: @@:
mov ecx, [ebx+8] mov ecx, [ebx+8]
add ecx, [ebx+4] add ecx, [ebx+4]
cmp ecx, [ebx] cmp ecx, [ebx]
ja .2 ja .2
; advance buffer position ; advance buffer position
push ecx push ecx
mov ecx, 4 mov ecx, 4
sub ebx, ecx sub ebx, ecx
mov eax, ebp mov eax, ebp
add edx, ecx add edx, ecx
call write_process_memory call write_process_memory
pop eax pop eax
; write message ; write message
mov eax, ebp mov eax, ebp
add edx, ecx add edx, ecx
add edx, [ebx+8] add edx, [ebx+8]
add ebx, 20 add ebx, 20
pop ecx pop ecx
pop ecx pop ecx
pop ecx pop ecx
call write_process_memory call write_process_memory
; new debug event ; new debug event
mov eax, ebp mov eax, ebp
shl eax, 8 shl eax, 8
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

View File

@ -9,57 +9,57 @@ $Revision: 924 $
iglobal iglobal
szKernel db 'KERNEL', 0 szKernel db 'KERNEL', 0
szVersion db 'version',0 szVersion db 'version',0
szRegService db 'RegService',0 szRegService db 'RegService',0
szGetService db 'GetService',0 szGetService db 'GetService',0
szServiceHandler db 'ServiceHandler',0 szServiceHandler db 'ServiceHandler',0
szAttachIntHandler db 'AttachIntHandler',0 szAttachIntHandler db 'AttachIntHandler',0
szGetIntHandler db 'GetIntHandler', 0 szGetIntHandler db 'GetIntHandler', 0
szFpuSave db 'FpuSave',0 szFpuSave db 'FpuSave',0
szFpuRestore db 'FpuRestore',0 szFpuRestore db 'FpuRestore',0
szReservePortArea db 'ReservePortArea',0 szReservePortArea db 'ReservePortArea',0
szBoot_Log db 'Boot_Log',0 szBoot_Log db 'Boot_Log',0
szPciApi db 'PciApi', 0 szPciApi db 'PciApi', 0
szPciRead32 db 'PciRead32', 0 szPciRead32 db 'PciRead32', 0
szPciRead16 db 'PciRead16', 0 szPciRead16 db 'PciRead16', 0
szPciRead8 db 'PciRead8', 0 szPciRead8 db 'PciRead8', 0
szPciWrite8 db 'PciWrite8',0 szPciWrite8 db 'PciWrite8',0
szPciWrite16 db 'PciWrite16',0 szPciWrite16 db 'PciWrite16',0
szPciWrite32 db 'PciWrite32',0 szPciWrite32 db 'PciWrite32',0
szAllocPage db 'AllocPage',0 szAllocPage db 'AllocPage',0
szAllocPages db 'AllocPages',0 szAllocPages db 'AllocPages',0
szFreePage db 'FreePage',0 szFreePage db 'FreePage',0
szGetPgAddr db 'GetPgAddr',0 szGetPgAddr db 'GetPgAddr',0
szMapPage db 'MapPage',0 szMapPage db 'MapPage',0
szMapSpace db 'MapSpace',0 szMapSpace db 'MapSpace',0
szMapIoMem db 'MapIoMem',0 szMapIoMem db 'MapIoMem',0
szCommitPages db 'CommitPages',0 szCommitPages db 'CommitPages',0
szReleasePages db 'ReleasePages',0 szReleasePages db 'ReleasePages',0
szAllocKernelSpace db 'AllocKernelSpace',0 szAllocKernelSpace db 'AllocKernelSpace',0
szFreeKernelSpace db 'FreeKernelSpace',0 szFreeKernelSpace db 'FreeKernelSpace',0
szKernelAlloc db 'KernelAlloc',0 szKernelAlloc db 'KernelAlloc',0
szKernelFree db 'KernelFree',0 szKernelFree db 'KernelFree',0
szUserAlloc db 'UserAlloc',0 szUserAlloc db 'UserAlloc',0
szUserFree db 'UserFree',0 szUserFree db 'UserFree',0
szKmalloc db 'Kmalloc',0 szKmalloc db 'Kmalloc',0
szKfree db 'Kfree',0 szKfree db 'Kfree',0
szCreateRingBuffer db 'CreateRingBuffer',0 szCreateRingBuffer db 'CreateRingBuffer',0
szGetPid db 'GetPid',0 szGetPid db 'GetPid',0
szCreateObject db 'CreateObject',0 szCreateObject db 'CreateObject',0
szDestroyObject db 'DestroyObject',0 szDestroyObject db 'DestroyObject',0
szCreateEvent db 'CreateEvent',0 szCreateEvent db 'CreateEvent',0
szRaiseEvent db 'RaiseEvent',0 szRaiseEvent db 'RaiseEvent',0
szWaitEvent db 'WaitEvent',0 szWaitEvent db 'WaitEvent',0
szDestroyEvent db 'DestroyEvent',0 szDestroyEvent db 'DestroyEvent',0
szClearEvent db 'ClearEvent',0 szClearEvent db 'ClearEvent',0
szLoadCursor db 'LoadCursor',0 szLoadCursor db 'LoadCursor',0
szSelectHwCursor db 'SelectHwCursor',0 szSelectHwCursor db 'SelectHwCursor',0
szSetHwCursor db 'SetHwCursor',0 szSetHwCursor db 'SetHwCursor',0
szHwCursorRestore db 'HwCursorRestore', 0 szHwCursorRestore db 'HwCursorRestore', 0
@ -68,19 +68,19 @@ iglobal
szSysMsgBoardStr db 'SysMsgBoardStr', 0 szSysMsgBoardStr db 'SysMsgBoardStr', 0
szSysMsgBoardChar db 'SysMsgBoardChar', 0 szSysMsgBoardChar db 'SysMsgBoardChar', 0
szGetCurrentTask db 'GetCurrentTask',0 szGetCurrentTask db 'GetCurrentTask',0
szLFBAddress db 'LFBAddress',0 szLFBAddress db 'LFBAddress',0
szLoadFile db 'LoadFile',0 szLoadFile db 'LoadFile',0
szSendEvent db 'SendEvent',0 szSendEvent db 'SendEvent',0
szSetMouseData db 'SetMouseData',0 szSetMouseData db 'SetMouseData',0
szSleep db 'Sleep',0 szSleep db 'Sleep',0
szGetTimerTicks db 'GetTimerTicks',0 szGetTimerTicks db 'GetTimerTicks',0
szStrncat db 'strncat',0 szStrncat db 'strncat',0
szStrncpy db 'strncpy',0 szStrncpy db 'strncpy',0
szstrncmp db 'strncmp',0 szstrncmp db 'strncmp',0
szStrnlen db 'strnlen',0 szStrnlen db 'strnlen',0
szStrchr db 'strchr',0 szStrchr db 'strchr',0
szStrrchr db 'strrchr',0 szStrrchr db 'strrchr',0
szEthReceiver db 'EthReceiver',0 szEthReceiver db 'EthReceiver',0
szEthRegDev db 'EthRegDev',0 szEthRegDev db 'EthRegDev',0
@ -95,12 +95,12 @@ kernel_export:
dd szServiceHandler , srv_handler dd szServiceHandler , srv_handler
dd szAttachIntHandler, attach_int_handler dd szAttachIntHandler, attach_int_handler
dd szGetIntHandler , get_int_handler dd szGetIntHandler , get_int_handler
dd szFpuSave , fpu_save dd szFpuSave , fpu_save
dd szFpuRestore , fpu_restore dd szFpuRestore , fpu_restore
dd szReservePortArea , r_f_port_area dd szReservePortArea , r_f_port_area
dd szBoot_Log , boot_log dd szBoot_Log , boot_log
dd szPciApi , pci_api dd szPciApi , pci_api
dd szPciRead32 , pci_read32 dd szPciRead32 , pci_read32
dd szPciRead16 , pci_read16 dd szPciRead16 , pci_read16
dd szPciRead8 , pci_read8 dd szPciRead8 , pci_read8
@ -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,17 +148,17 @@ 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
dd szStrncat , strncat dd szStrncat , strncat
dd szStrncpy , strncpy dd szStrncpy , strncpy
dd szstrncmp , strncmp dd szstrncmp , strncmp
dd szStrnlen , strnlen dd szStrnlen , strnlen
dd szStrchr , strchr dd szStrchr , strchr
dd szStrrchr , strrchr dd szStrrchr , strrchr
dd szEthReceiver , ETH_Receiver dd szEthReceiver , ETH_Receiver
dd szEthRegDev , ETH_Add_Device dd szEthRegDev , ETH_Add_Device
@ -167,7 +167,6 @@ kernel_export:
exp_lfb: exp_lfb:
dd szLFBAddress , 0 dd szLFBAddress , 0
dd 0 ;terminator, must be zero dd 0 ;terminator, must be zero
endg endg

View File

@ -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 ;
@ -180,109 +180,4 @@ 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

View File

@ -91,11 +91,11 @@ 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
rep stosd rep stosd
mov ecx, 512/4 mov ecx, 512/4
mov edi, mem_block_map mov edi, mem_block_map
@ -138,22 +138,23 @@ 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
mov [heap_size], ecx sub ecx, HEAP_BASE+4096*MEM_BLOCK_SIZE
mov [heap_free], ecx mov [heap_size], ecx
mov [ebx+block_size], ecx mov [heap_free], ecx
mov [ebx+block_flags], FREE_BLOCK mov [ebx+block_size], ecx
mov [ebx+block_flags], FREE_BLOCK
mov [mem_block_mask], eax mov [mem_block_mask], eax
mov [mem_block_mask+4],0x80000000 mov [mem_block_mask+4],0x80000000
mov [mem_block_list+63*4], ebx mov [mem_block_list+63*4], ebx
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
; param ; param

View File

@ -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,24 +547,16 @@ 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 .err_addr equ ebp-4
jnz v86_page_fault
.err_code equ ebp+32 push ebx ;save exception number (#PF)
.err_addr equ ebp-4 mov ebp, esp
mov ebx, cr2
pushad push ebx ;that is locals: .err_addr = cr2
mov ebp, esp inc [pg_data.pages_faults]
mov eax, cr2
push eax
mov ax, app_data
mov ds, ax
mov es, ax
inc [pg_data.pages_faults]
; push eax ; push eax
; push edx ; push edx
@ -571,129 +566,115 @@ 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 ;ñòðàíèöà â ïàìÿòè ïðèëîæåíèÿ ; jb .user_space ;ñòðàíèöà â ïàìÿòè ïðèëîæåíèÿ ;
cmp ebx, page_tabs cmp ebx, page_tabs
jb .kernel_space ;ñòðàíèöà â ïàìÿòè ÿäðà jb .kernel_space ;ñòðàíèöà â ïàìÿòè ÿäðà
cmp ebx, kernel_tabs cmp ebx, kernel_tabs
jb .alloc;.app_tabs ;òàáëèöû ñòðàíèö ïðèëîæåíèÿ ; jb .alloc;.app_tabs ;òàáëèöû ñòðàíèö ïðèëîæåíèÿ ;
;ïðîñòî ñîçäàäèì îäíó ;ïðîñòî ñîçäàäèì îäíó
if 0 ;ïîêà ýòî ïðîñòî ëèøíåå
cmp ebx, LFB_BASE
jb .core_tabs ;òàáëèöû ñòðàíèö ÿäðà
;Îøèáêà
.lfb:
;îáëàñòü LFB
;Îøèáêà
jmp .fail
end if
.core_tabs:
.fail: ;simply return to caller
mov esp, ebp
pop ebx ;restore exception number (#PF)
ret
cmp ebx, LFB_BASE
jb .core_tabs ;òàáëèöû ñòðàíèö ÿäðà
;Îøèáêà
.lfb:
;îáëàñòü LFB
;Îøèáêà
jmp .fail
align 4
.user_space: .user_space:
test eax, PG_MAP test eax, PG_MAP
jnz .err_access ;Ñòðàíèöà ïðèñóòñòâóåò jnz .err_access ;Ñòðàíèöà ïðèñóòñòâóåò
;Îøèáêà äîñòóïà ? ;Îøèáêà äîñòóïà ?
shr ebx, 12 shr ebx, 12
mov ecx, ebx mov ecx, ebx
shr ecx, 10 shr ecx, 10
mov edx, [master_tab+ecx*4] mov edx, [master_tab+ecx*4]
test edx, PG_MAP test edx, PG_MAP
jz .fail ;òàáëèöà ñòðàíèö íå ñîçäàíà jz .fail ;òàáëèöà ñòðàíèö íå ñîçäàíà
;íåâåðíûé àäðåñ â ïðîãðàììå ;íåâåðíûé àäðåñ â ïðîãðàììå
mov eax, [page_tabs+ebx*4] mov eax, [page_tabs+ebx*4]
test eax, 2 test eax, 2
jz .fail ;àäðåñ íå çàðåçåðâèðîâàí äëÿ ; jz .fail ;àäðåñ íå çàðåçåðâèðîâàí äëÿ ;
;èñïîëüçîâàíèÿ. Îøèáêà ;èñïîëüçîâàíèÿ. Îøèáêà
.alloc: .alloc:
call alloc_page call alloc_page
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
;íèêîãäà íå ïðîèñõîäèò ;íèêîãäà íå ïðîèñõîäèò
jmp .fail ;jmp .fail
.kernel_space: .kernel_space:
test eax, PG_MAP test eax, PG_MAP
jz .fail ;ñòðàíèöà íå ïðèñóòñòâóåò jz .fail ;ñòðàíèöà íå ïðèñóòñòâóåò
test eax, 4 ;U/S test eax,12 ;U/S (+below)
jnz .fail ;ïðèëîæåíèå îáðàòèëîñü ê ïàìÿòè jnz .fail ;ïðèëîæåíèå îáðàòèëîñü ê ïàìÿòè
;ÿäðà ;ÿäðà
test eax, 8 ;test eax, 8
jnz .fail ;óñòàíîâëåí çàðåçåðâèðîâàííûé áèò ;jnz .fail ;óñòàíîâëåí çàðåçåðâèðîâàííûé áèò
;â òàáëèöàõ ñòðàíèö. äîáàâëåíî â P4/Xeon ;â òàáëèöàõ ñòðàíèö. äîáàâëåíî â P4/Xeon
;ïîïûòêà çàïèñè â çàùèù¸ííóþ ñòðàíèöó ÿäðà ;ïîïûòêà çàïèñè â çàùèù¸ííóþ ñòðàíèöó ÿäðà
cmp ebx, tss._io_map_0 cmp ebx, tss._io_map_0
jb .fail jb .fail
cmp ebx, tss._io_map_0+8192 cmp ebx, tss._io_map_0+8192
jae .fail jae .fail
; io permission map ; io permission map
; copy-on-write protection ; copy-on-write protection
call alloc_page call alloc_page
test eax, eax test eax, eax
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
lea esi, [edi+(not tss._io_map_0)+1]; -tss._io_map_0 lea esi, [edi+(not tss._io_map_0)+1]; -tss._io_map_0
mov ebx, esi mov ebx, esi
shr ebx, 12 shr ebx, 12
mov edx, [current_slot] mov edx, [current_slot]
or eax, PG_SW or eax, PG_SW
mov [edx+APPDATA.io_map+ebx*4], eax mov [edx+APPDATA.io_map+ebx*4], eax
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
;íå îáðàáàòûâàåì. Îøèáêà
.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

View File

@ -15,321 +15,229 @@ $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]
mov eax, [timer_ticks]
; cmp dword[CURRENT_TASK], 1 call playNote ; <<<--- Speaker driver
; jnz @f sub eax,[next_usage_update]
; mov eax, [esp + 32] cmp eax,100
; cmp eax, idle_loop + 1 jb .nocounter
; jz @f add [next_usage_update],100
; DEBUGF 1, "K : OOOPS! EAX = 0x%x\n", eax call updatecputimes
; @@: .nocounter:
mov al,0x20 ; send End Of Interrupt signal
inc dword [timer_ticks] out 0x20,al
btr dword[DONT_SWITCH], 0
mov eax, [timer_ticks] jc .return
call playNote ; <<<--- Speaker driver call find_next_task
jz .return ; if there is only one running process
cmp eax,[next_usage_update] call do_change_task
jb .nocounter .return:
add eax,100 popad
mov [next_usage_update],eax iretd
call updatecputimes
.nocounter:
cmp [DONT_SWITCH], byte 1
jne .change_task
mov al,0x20 ; send End Of Interrupt signal
mov dx,0x20
out dx,al
mov [DONT_SWITCH], byte 0
popad
iretd
.change_task:
call update_counters
call find_next_task
mov ecx, eax
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
.return:
popad
; popfd
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 mov ebx, [dma_process]
mov ebx, [dma_process] cmp [CURRENT_TASK], ebx
cmp [CURRENT_TASK], ebx je .return
je .return mov edi, [dma_slot_ptr]
mov edi, [dma_slot_ptr] mov [CURRENT_TASK], ebx
mov [CURRENT_TASK], ebx mov [TASK_BASE], edi
mov [TASK_BASE], edi 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 jz .return ; the same task -> skip switch
test eax, eax ; the same task -> skip switch @@: mov byte[DONT_SWITCH], 1
jnz .return call do_change_task
@@: .return:
mov [DONT_SWITCH],byte 1 popad
call do_change_task popfd
ret
.return:
popad
popfd
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, [edi+TASKDATA.counter_add] ; time stamp counter add
sub eax, ebx add [edi+TASKDATA.counter_sum], eax ; counter sum
add eax, [edi+TASKDATA.counter_sum] ; counter sum ret
mov [edi+TASKDATA.counter_sum], eax
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
xchg eax,[idleuse]
mov [idleusesec],eax
mov ecx, [TASK_COUNT]
mov edi, TASK_DATA
.newupdate:
xor eax,eax
xchg eax,[edi+TASKDATA.counter_sum]
mov [edi+TASKDATA.cpu_usage],eax
add edi,0x20
loop .newupdate
ret
mov eax,[idleuse] align 4
mov [idleusesec],eax find_next_task:
mov [idleuse],dword 0 ;info:
mov ecx, [TASK_COUNT] ; Find next task to execute
mov edi, TASK_DATA ;retval:
.newupdate: ; ebx = address of the APPDATA for the selected task (slot-base)
mov ebx,[edi+TASKDATA.counter_sum] ; esi = previous slot-base ([current_slot] at the begin)
mov [edi+TASKDATA.cpu_usage],ebx ; edi = address of the TASKDATA for the selected task
mov [edi+TASKDATA.counter_sum],dword 0 ; ZF = 1 if the task is the same
add edi,0x20 ;warning:
dec ecx ; [CURRENT_TASK] = bh , [TASK_BASE] = edi -- as result
jnz .newupdate ; [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: Íàäî áû óáðàòü èñïîëüçîâàíèå do_change_task èç V86...
; è ïîñëå ýòîãî ïåðåíåñòè îáðàáîòêó TASKDATA.counter_add/sum â do_change_task
ret 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 ?
.exp_time dd ? .exp_time dd ?
.func dd ? .func dd ?
.arg dd ? .arg dd ?
} }
MAX_PROIRITY 0 ; highest, used for kernel tasks
MAX_USER_PRIORITY 0 ; highest priority for user processes
USER_PRIORITY 7 ; default (should correspond to nice 0)
MIN_USER_PRIORITY 14 ; minimum priority for user processes
IDLE_PRIORITY 15 ; lowest, only IDLE process goes here
NR_SCHED_QUEUES 16 ; MUST equal IDLE_PRIORYTY + 1
MAX_PROIRITY 0 ; highest, used for kernel tasks
MAX_USER_PRIORITY 0 ; highest priority for user processes
USER_PRIORITY 7 ; default (should correspond to nice 0)
MIN_USER_PRIORITY 14 ; minimum priority for user processes
IDLE_PRIORITY 15 ; lowest, only IDLE process goes here
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:
xor eax, eax xor eax, eax
.pick: .pick:
mov ebx, [rdy_head+eax*4] mov ebx, [rdy_head+eax*4]
test ebx, ebx test ebx, ebx
jz .next jz .next
mov [next_task], ebx
test [ebx+flags.billable]
jz @F
mov [bill_task], ebx
@@:
ret
.next:
inc eax
jmp .pick
mov [next_task], ebx
test [ebx+flags.billable]
jz @F
mov [bill_task], ebx
@@:
ret
.next:
inc eax
jmp .pick
; param ; param
; eax= task ; eax= task
@ -338,51 +246,48 @@ 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
mov ebx, [eax+.priority] mov ebx, [eax+.priority]
setg ecx setg ecx
jg @F jg @F
mov edx, [eax+.tics_quantum] mov edx, [eax+.tics_quantum]
mov [eax+.ticks_left], edx mov [eax+.ticks_left], edx
cmp ebx, (IDLE_PRIORITY-1) cmp ebx, (IDLE_PRIORITY-1)
je @F je @F
inc ebx inc ebx
@@: @@:
ret ret
; param ; param
; eax= task ; eax= task
align 4 align 4
enqueue: enqueue:
call shed ;eax call shed ;eax
cmp [rdy_head+ebx*4],0 cmp [rdy_head+ebx*4],0
jnz @F jnz @F
mov [rdy_head+ebx*4], eax mov [rdy_head+ebx*4], eax
mov [rdy_tail+ebx*4], eax mov [rdy_tail+ebx*4], eax
mov [eax+.next_ready], 0 mov [eax+.next_ready], 0
jmp .pick jmp .pick
@@: @@:
test ecx, ecx test ecx, ecx
jz .back jz .back
mov ecx, [rdy_head+ebx*4] mov ecx, [rdy_head+ebx*4]
mov [eax+.next_ready], ecx mov [eax+.next_ready], ecx
mov [rdy_head+ebx*4], eax mov [rdy_head+ebx*4], eax
jmp .pick jmp .pick
.back: .back:
mov ecx, [rdy_tail+ebx*4] mov ecx, [rdy_tail+ebx*4]
mov [ecx+.next_ready], eax mov [ecx+.next_ready], eax
mov [rdy_tail+ebx*4], eax mov [rdy_tail+ebx*4], eax
mov [eax+.next_ready], 0 mov [eax+.next_ready], 0
.pick: .pick:
call pick_proc ;select next task call pick_proc ;select next task
ret ret
end if end if

File diff suppressed because it is too large Load Diff

View File

@ -10,33 +10,17 @@ $Revision: 940 $
; Old style system call converter ; Old style system call converter
align 16 align 16
cross_order: cross_order:
; load all registers in crossed order ; load all registers in crossed order
mov eax, ebx mov eax, ebx
mov ebx, ecx mov ebx, ecx
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 ;;
@ -45,28 +29,43 @@ i40:
align 32 align 32
sysenter_entry: sysenter_entry:
; Íàñòðàèâàåì ñòåê ; Íàñòðàèâàåì ñòåê
mov esp, [ss:tss._esp0] mov esp, [ss:tss._esp0]
sti sti
push ebp ; save app esp + 4 push ebp ; save app esp + 4
mov ebp, [ebp] ; ebp - original ebp mov ebp, [ebp] ; ebp - original ebp
;------------------ ;------------------
pushad pushad
cld cld
movzx eax, al movzx eax, al
call dword [servetable2 + eax * 4] call dword [servetable2 + eax * 4]
popad popad
;------------------ ;------------------
xchg ecx, [ss:esp] ; â âåðøèí ñòåêà - app ecx, ecx - app esp + 4 xchg ecx, [ss:esp] ; â âåðøèí ñòåêà - app ecx, ecx - app esp + 4
sub ecx, 4 sub ecx, 4
xchg edx, [ecx] ; edx - return point, & save original edx xchg edx, [ecx] ; edx - return point, & save original edx
push edx push edx
mov edx, [ss:esp + 4] mov edx, [ss:esp + 4]
mov [ecx + 4], edx ; save original ecx mov [ecx + 4], edx ; save original ecx
pop edx pop edx
sysexit sysexit
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; SYSTEM CALL ENTRY ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
align 16
i40:
pushad
cld
movzx eax, al
call dword [servetable2 + eax * 4]
popad
iretd
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
@ -76,25 +75,26 @@ sysenter_entry:
align 32 align 32
syscall_entry: syscall_entry:
; cli syscall clear IF ; cli syscall clear IF
xchg esp, [ss:tss._esp0] xchg esp, [ss:tss._esp0]
push ecx push ecx
lea ecx, [esp+4] lea ecx, [esp+4]
xchg ecx, [ss:tss._esp0] xchg ecx, [ss:tss._esp0]
sti sti
push ecx push ecx
mov ecx, [ecx] mov ecx, [ecx]
;------------------ ;------------------
pushad pushad
cld cld
movzx eax, al movzx eax, al
call dword [servetable2 + eax * 4] call dword [servetable2 + eax * 4]
popad
;------------------
mov ecx, [ss:esp+4]
pop esp
sysret
popad
;------------------
mov ecx, [ss:esp+4]
pop esp
sysret
iglobal iglobal
;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; SYSTEM FUNCTIONS TABLE ;; ;; SYSTEM FUNCTIONS TABLE ;;
@ -133,7 +133,7 @@ iglobal
dd 0 dd 0
dd 0 ; dd 0 ;
dd 0 dd 0
dd sys_current_directory ; 30-Get/SetCurrentDirectory dd sys_current_directory ; 30-Get/SetCurrentDirectory
dd 0 dd 0
dd 0 dd 0
dd 0 dd 0
@ -153,7 +153,7 @@ iglobal
dd display_number ; 47-WriteNum dd display_number ; 47-WriteNum
dd display_settings ; 48-SetRedrawType and SetButtonType dd display_settings ; 48-SetRedrawType and SetButtonType
dd sys_apm ; 49-Advanced Power Management (APM) dd sys_apm ; 49-Advanced Power Management (APM)
dd random_shaped_window ; 50-Window shape & scale dd random_shaped_window ; 50-Window shape & scale
dd syscall_threads ; 51-Threads dd syscall_threads ; 51-Threads
dd 0 dd 0
dd 0 dd 0
@ -167,7 +167,7 @@ iglobal
dd sys_gs ; 61-Direct graphics access dd sys_gs ; 61-Direct graphics access
dd sys_pci ; 62-PCI functions dd sys_pci ; 62-PCI functions
dd sys_msg_board ; 63-System message board dd sys_msg_board ; 63-System message board
dd sys_resize_app_memory ; 64-Resize application memory usage dd sys_resize_app_memory ; 64-Resize application memory usage
dd syscall_putimage_palette; 65-PutImagePalette dd syscall_putimage_palette; 65-PutImagePalette
dd sys_process_def ; 66-Process definitions - keyboard dd sys_process_def ; 66-Process definitions - keyboard
dd sys_window_move ; 67-Window move or resize dd sys_window_move ; 67-Window move or resize
@ -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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -198,9 +197,9 @@ iglobal
dd sys_getevent ; 11-CheckForEvent dd sys_getevent ; 11-CheckForEvent
dd sys_redrawstat ; 12-BeginDraw and EndDraw dd sys_redrawstat ; 12-BeginDraw and EndDraw
dd syscall_drawrect ; 13-DrawRect dd syscall_drawrect ; 13-DrawRect
dd syscall_getscreensize ; 14-GetScreenSize dd syscall_getscreensize ; 14-GetScreenSize
dd sys_background ; 15-bgr dd sys_background ; 15-bgr
dd sys_cachetodiskette ; 16-FlushFloppyCache dd sys_cachetodiskette ; 16-FlushFloppyCache
dd sys_getbutton ; 17-GetButton dd sys_getbutton ; 17-GetButton
dd sys_system ; 18-System Services dd sys_system ; 18-System Services
dd paleholder ; 19-reserved dd paleholder ; 19-reserved
@ -225,7 +224,7 @@ iglobal
dd syscall_drawline ; 38-DrawLine dd syscall_drawline ; 38-DrawLine
dd cross_order ; 39-GetBackgroundSize,ReadBgrData,. dd cross_order ; 39-GetBackgroundSize,ReadBgrData,.
dd set_app_param ; 40-WantEvents dd set_app_param ; 40-WantEvents
dd syscall_getirqowner ; 41-GetIrqOwner dd syscall_getirqowner ; 41-GetIrqOwner
dd get_irq_data ; 42-ReadIrqData dd get_irq_data ; 42-ReadIrqData
dd cross_order ; 43-SendDeviceData dd cross_order ; 43-SendDeviceData
dd sys_programirq ; 44-ProgramIrqs dd sys_programirq ; 44-ProgramIrqs
@ -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

File diff suppressed because it is too large Load Diff

View File

@ -203,7 +203,7 @@ v86_set_page:
; add edx, ecx ; add edx, ecx
; cmp dword [edx], 0 ; free block? ; cmp dword [edx], 0 ; free block?
; jnz .n ; jnz .n
; cmp dword [edx+4], ; cmp dword [edx+4],
; and [esi+V86_machine.mutex], 0 ; and [esi+V86_machine.mutex], 0
; pop edi edx ecx ebx ; pop edi edx ecx ebx
; ret ; ret
@ -351,47 +351,27 @@ 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
v86_exc_str3 db ':',0 v86_exc_str3 db ':',0
v86_exc_str4 db 13,10,'V86 : faulted code:',0 v86_exc_str4 db 13,10,'V86 : faulted code:',0
v86_exc_str5 db ' (unavailable)',0 v86_exc_str5 db ' (unavailable)',0
v86_newline db 13,10,0 v86_newline db 13,10,0
v86_io_str1 db 'V86 : access to disabled i/o port ',0 v86_io_str1 db 'V86 : access to disabled i/o port ',0
v86_io_byte db ' (byte)',13,10,0 v86_io_byte db ' (byte)',13,10,0
v86_io_word db ' (word)',13,10,0 v86_io_word db ' (word)',13,10,0
v86_io_dword db ' (dword)',13,10,0 v86_io_dword db ' (dword)',13,10,0
v86_irqerr db 'V86 : IRQ already hooked',13,10,0 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

View File

@ -48,38 +48,39 @@ keymap_alt:
boot_memdetect db 'Determining amount of memory',0 boot_memdetect db 'Determining amount of memory',0
boot_fonts db 'Fonts loaded',0 boot_fonts db 'Fonts loaded',0
boot_tss db 'Setting TSSs',0 boot_tss db 'Setting TSSs',0
boot_cpuid db 'Reading CPUIDs',0 boot_cpuid db 'Reading CPUIDs',0
boot_devices db 'Detecting devices',0 boot_devices db 'Detecting devices',0
boot_timer db 'Setting timer',0 boot_timer db 'Setting timer',0
boot_irqs db 'Reprogramming IRQs',0 boot_irqs db 'Reprogramming IRQs',0
boot_setmouse db 'Setting mouse',0 boot_setmouse db 'Setting mouse',0
boot_windefs db 'Setting window defaults',0 boot_windefs db 'Setting window defaults',0
boot_bgr db 'Calculating background',0 boot_bgr db 'Calculating background',0
boot_resirqports db 'Reserving IRQs & ports',0 boot_resirqports db 'Reserving IRQs & ports',0
boot_setrports db 'Setting addresses for IRQs',0 boot_setrports db 'Setting addresses for IRQs',0
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_pal_ega db 'Setting EGA/CGA 320x200 palette',0 boot_cpufreq db 'CPU frequency is ',' ',' MHz',0
boot_pal_vga db 'Setting VGA 640x480 palette',0 boot_pal_ega db 'Setting EGA/CGA 320x200 palette',0
boot_failed db 'Failed to start first app',0 boot_pal_vga db 'Setting VGA 640x480 palette',0
boot_mtrr db 'Setting MTRR',0 boot_failed db 'Failed to start first app',0
boot_mtrr db 'Setting MTRR',0
if preboot_blogesc 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
msg_module db 'in module ',0 msg_module db 'in module ',0
msg_version db 'incompatible driver version',13,10,0 msg_version db 'incompatible driver version',13,10,0
msg_www db 'please visit www.kolibrios.org',13,10,0 msg_www db 'please visit www.kolibrios.org',13,10,0
msg_CR db 13,10,0 msg_CR db 13,10,0
aSis db 'SIS',0 aSis db 'SIS',0
intel_str db "GenuineIntel",0 intel_str db "GenuineIntel",0
@ -87,11 +88,11 @@ AMD_str db "AuthenticAMD",0
;szSound db 'SOUND',0 ;szSound db 'SOUND',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
szSTART db 'START',0 szSTART db 'START',0
szEXPORTS db 'EXPORTS',0 szEXPORTS db 'EXPORTS',0
@ -102,13 +103,13 @@ szIMPORTS db 'IMPORTS',0
read_firstapp db '/sys/' read_firstapp db '/sys/'
firstapp db 'LAUNCHER',0 firstapp db 'LAUNCHER',0
char db '/sys/FONTS/CHAR.MT',0 char db '/sys/FONTS/CHAR.MT',0
char2 db '/sys/FONTS/CHAR2.MT',0 char2 db '/sys/FONTS/CHAR2.MT',0
bootpath db '/KOLIBRI ' bootpath db '/KOLIBRI '
bootpath2 db 0 bootpath2 db 0
vmode db '/sys/drivers/VMODE.MDR',0 vmode db '/sys/drivers/VMODE.MDR',0
vrr_m db 'VRR_M',0 vrr_m db 'VRR_M',0
kernel_file db 'KERNEL MNT' kernel_file db 'KERNEL MNT'
@ -144,14 +145,14 @@ mode_320_240_8:
; mike.dld { ; mike.dld {
db 0 db 0
dd servetable-0x10000 dd servetable-0x10000
draw_line dd __sys_draw_line draw_line dd __sys_draw_line
disable_mouse dd __sys_disable_mouse disable_mouse dd __sys_disable_mouse
draw_pointer dd __sys_draw_pointer draw_pointer dd __sys_draw_pointer
;//mike.dld, 2006-08-02 [ ;//mike.dld, 2006-08-02 [
;drawbar dd __sys_drawbar ;drawbar dd __sys_drawbar
drawbar dd __sys_drawbar.forced drawbar dd __sys_drawbar.forced
;//mike.dld, 2006-08-02 ] ;//mike.dld, 2006-08-02 ]
putpixel dd __sys_putpixel putpixel dd __sys_putpixel
; } mike.dld ; } mike.dld
@ -159,10 +160,10 @@ align 4
keyboard dd 1 keyboard dd 1
syslang dd 1 syslang dd 1
boot_y dd 10 boot_y dd 10
pci_bios_entry dd 0 pci_bios_entry dd 0
dw pci_code_sel dw pci_code_sel
if __DEBUG__ eq 1 if __DEBUG__ eq 1
include_debug_strings include_debug_strings
@ -173,136 +174,135 @@ IncludeIGlobals
align 16 align 16
gdts: gdts:
dw gdte-$-1 dw gdte-$-1
dd gdts dd gdts
dw 0 dw 0
; Attention! Do not change the order of the first four selectors. They are used in Fast System Call ; Attention! Do not change the order of the first four selectors. They are used in Fast System Call
; must be : os_code, os_data, app_code, app_data, .... ; must be : os_code, os_data, app_code, app_data, ....
int_code_l: int_code_l:
os_code_l: os_code_l:
dw 0xffff dw 0xffff
dw 0x0000 dw 0x0000
db 0x00 db 0x00
dw 11011111b *256 +10011010b dw 11011111b *256 +10011010b
db 0x00 db 0x00
int_data_l: int_data_l:
os_data_l: os_data_l:
dw 0xffff dw 0xffff
dw 0x0000 dw 0x0000
db 0x00 db 0x00
dw 11011111b *256 +10010010b dw 11011111b *256 +10010010b
db 0x00 db 0x00
app_code_l: app_code_l:
dw 0xFFFF dw 0xFFFF
dw 0 dw 0
db 0 db 0
db cpl3 db cpl3
dw G32+D32+(new_app_base shr 16)+0xF; dw G32+D32+(new_app_base shr 16)+0xF;
app_data_l: app_data_l:
dw 0xFFFF dw 0xFFFF
dw 0 dw 0
db 0 db 0
db drw3 db drw3
dw G32+D32+(new_app_base shr 16)+0xF; dw G32+D32+(new_app_base shr 16)+0xF;
; ------------- PCI BIOS ------------------ ; ------------- PCI BIOS ------------------
pci_code_32: pci_code_32:
dw 0 ;lim 0-15 dw 0 ;lim 0-15
dw 0 ;base 0-15 dw 0 ;base 0-15
db 0 ;base 16-23 db 0 ;base 16-23
db cpl0 ;type db cpl0 ;type
db D32 ;lim 16-19+props db D32 ;lim 16-19+props
db 0 ;base 24-31 db 0 ;base 24-31
pci_data_32: pci_data_32:
dw 0 ;lim 0-15 dw 0 ;lim 0-15
dw 0 ;base 0-15 dw 0 ;base 0-15
db 0 ;base 16-23 db 0 ;base 16-23
db dpl0 ;type db dpl0 ;type
db D32 ;lim 16-19+props db D32 ;lim 16-19+props
db 0 ;base 24-31 db 0 ;base 24-31
; --------------- APM --------------------- ; --------------- APM ---------------------
apm_code_32: apm_code_32:
dw 0x0f ; limit 64kb dw 0x0f ; limit 64kb
db 0, 0, 0 db 0, 0, 0
dw 11010000b *256 +10011010b dw 11010000b *256 +10011010b
db 0x00 db 0x00
apm_code_16: apm_code_16:
dw 0x0f dw 0x0f
db 0, 0, 0 db 0, 0, 0
dw 10010000b *256 +10011010b dw 10010000b *256 +10011010b
db 0x00 db 0x00
apm_data_16: apm_data_16:
dw 0x0f dw 0x0f
db 0, 0, 0 db 0, 0, 0
dw 10010000b *256 +10010010b dw 10010000b *256 +10010010b
db 0x00 db 0x00
; ----------------------------------------- ; -----------------------------------------
graph_data_l: graph_data_l:
dw 0x7ff dw 0x7ff
dw 0x0000 dw 0x0000
db 0x00 db 0x00
dw 11010000b *256 +11110010b dw 11010000b *256 +11110010b
db 0x00 db 0x00
tss0_l: tss0_l:
dw TSS_SIZE-1 dw TSS_SIZE-1
dw tss and 0xFFFF dw tss and 0xFFFF
db (tss shr 16) and 0xFF db (tss shr 16) and 0xFF
db 10001001b db 10001001b
dw (tss shr 16) and 0xFF00 dw (tss shr 16) and 0xFF00
endofcode: endofcode:
gdte: gdte:
align 16 align 16
cur_saved_data rb 4096 cur_saved_data rb 4096
fpu_data: rb 512 fpu_data: rb 512
; device irq owners ; device irq owners
irq_owner rd 16 ; process id irq_owner rd 16 ; process id
; on irq read ports ; on irq read ports
irq00read rd 16 irq00read rd 16
irq01read rd 16 irq01read rd 16
irq02read rd 16 irq02read rd 16
irq03read rd 16 irq03read rd 16
irq04read rd 16 irq04read rd 16
irq05read rd 16 irq05read rd 16
irq06read rd 16 irq06read rd 16
irq07read rd 16 irq07read rd 16
irq08read rd 16 irq08read rd 16
irq09read rd 16 irq09read rd 16
irq10read rd 16 irq10read rd 16
irq11read rd 16 irq11read rd 16
irq12read rd 16 irq12read rd 16
irq13read rd 16 irq13read rd 16
irq14read rd 16 irq14read rd 16
irq15read rd 16 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
large_block_mask rd 1 large_block_mask rd 1
mem_used.fd rd 1 mem_used.fd rd 1
mem_used.bk rd 1 mem_used.bk rd 1
mem_block_arr rd 1 mem_block_arr rd 1
mem_block_start rd 1 mem_block_start rd 1
mem_block_end rd 1 mem_block_end rd 1
heap_mutex rd 1 heap_mutex rd 1
heap_size rd 1 heap_size rd 1
@ -314,143 +314,139 @@ mst MEM_STATE
page_start rd 1 page_start rd 1
page_end rd 1 page_end rd 1
events rd 1 sys_page_map rd 1
event_start rd 1 os_stack_seg rd 1
event_end rd 1
event_uid rd 1
sys_page_map rd 1
os_stack_seg rd 1
srv.fd rd 1 srv.fd rd 1
srv.bk rd 1 srv.bk rd 1
scr_width rd 1 scr_width rd 1
scr_height rd 1 scr_height rd 1
create_cursor rd 1 create_cursor rd 1
select_hw_cursor rd 1 select_hw_cursor rd 1
set_hw_cursor rd 1 set_hw_cursor rd 1
hw_restore rd 1 hw_restore rd 1
def_cursor rd 1 def_cursor rd 1
current_cursor rd 1 current_cursor rd 1
hw_cursor rd 1 hw_cursor rd 1
cur_def_interl rd 1 cur_def_interl rd 1
cur_saved_base rd 1 cur_saved_base rd 1
cur_saved_interl rd 1 cur_saved_interl rd 1
cur_saved_w rd 1 cur_saved_w rd 1
cur_saved_h rd 1 cur_saved_h rd 1
ipc_tmp rd 1 ipc_tmp rd 1
ipc_pdir rd 1 ipc_pdir rd 1
ipc_ptab rd 1 ipc_ptab rd 1
proc_mem_map rd 1 proc_mem_map rd 1
proc_mem_pdir rd 1 proc_mem_pdir rd 1
proc_mem_tab rd 1 proc_mem_tab rd 1
tmp_task_pdir rd 1 tmp_task_pdir rd 1
tmp_task_ptab rd 1 tmp_task_ptab rd 1
default_io_map rd 1 default_io_map rd 1
LFBSize rd 1 LFBSize rd 1
stall_mcs rd 1 stall_mcs rd 1
current_slot rd 1 current_slot rd 1
; status ; status
hd1_status rd 1 ; 0 - free : other - pid hd1_status rd 1 ; 0 - free : other - pid
application_table_status rd 1 ; 0 - free : other - pid application_table_status rd 1 ; 0 - free : other - pid
; device addresses ; device addresses
mididp rd 1 mididp rd 1
midisp rd 1 midisp rd 1
cdbase rd 1 cdbase rd 1
cdid rd 1 cdid rd 1
hdbase rd 1 ; for boot 0x1f0 hdbase rd 1 ; for boot 0x1f0
hdid rd 1 hdid rd 1
hdpos rd 1 ; for boot 0x1 hdpos rd 1 ; for boot 0x1
fat32part rd 1 ; for boot 0x1 fat32part rd 1 ; for boot 0x1
cdpos rd 1 cdpos rd 1
;CPUID information ;CPUID information
cpu_vendor rd 3 cpu_vendor rd 3
cpu_sign rd 1 cpu_sign rd 1
cpu_info rd 1 cpu_info rd 1
cpu_caps rd 4 cpu_caps rd 4
pg_data PG_DATA pg_data PG_DATA
heap_test rd 1 heap_test rd 1
buttontype rd 1 buttontype rd 1
windowtypechanged rd 1 windowtypechanged rd 1
hd_entries rd 1 ;unused ? 0xfe10 hd_entries rd 1 ;unused ? 0xfe10
;* start code - Mario79 ;* start code - Mario79
mouse_active rd 1 mouse_active rd 1
mouse_pause rd 1 mouse_pause rd 1
MouseTickCounter rd 1 MouseTickCounter rd 1
;* end code - Mario79 ;* end code - Mario79
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
cache_ide0_size rd 1 ; not use cache_ide0_size rd 1 ; not use
cache_ide0_data_pointer rd 1 cache_ide0_data_pointer rd 1
cache_ide0_system_data_size rd 1 ; not use cache_ide0_system_data_size rd 1 ; not use
cache_ide0_appl_data_size rd 1 ; not use cache_ide0_appl_data_size rd 1 ; not use
cache_ide0_system_data rd 1 cache_ide0_system_data rd 1
cache_ide0_appl_data rd 1 cache_ide0_appl_data rd 1
cache_ide0_system_sad_size rd 1 cache_ide0_system_sad_size rd 1
cache_ide0_appl_sad_size rd 1 cache_ide0_appl_sad_size rd 1
cache_ide0_search_start rd 1 cache_ide0_search_start rd 1
cache_ide0_appl_search_start rd 1 cache_ide0_appl_search_start rd 1
cache_ide1: cache_ide1:
cache_ide1_pointer rd 1 cache_ide1_pointer rd 1
cache_ide1_size rd 1 ; not use cache_ide1_size rd 1 ; not use
cache_ide1_data_pointer rd 1 cache_ide1_data_pointer rd 1
cache_ide1_system_data_size rd 1 ; not use cache_ide1_system_data_size rd 1 ; not use
cache_ide1_appl_data_size rd 1 ; not use cache_ide1_appl_data_size rd 1 ; not use
cache_ide1_system_data rd 1 cache_ide1_system_data rd 1
cache_ide1_appl_data rd 1 cache_ide1_appl_data rd 1
cache_ide1_system_sad_size rd 1 cache_ide1_system_sad_size rd 1
cache_ide1_appl_sad_size rd 1 cache_ide1_appl_sad_size rd 1
cache_ide1_search_start rd 1 cache_ide1_search_start rd 1
cache_ide1_appl_search_start rd 1 cache_ide1_appl_search_start rd 1
cache_ide2: cache_ide2:
cache_ide2_pointer rd 1 cache_ide2_pointer rd 1
cache_ide2_size rd 1 ; not use cache_ide2_size rd 1 ; not use
cache_ide2_data_pointer rd 1 cache_ide2_data_pointer rd 1
cache_ide2_system_data_size rd 1 ; not use cache_ide2_system_data_size rd 1 ; not use
cache_ide2_appl_data_size rd 1 ; not use cache_ide2_appl_data_size rd 1 ; not use
cache_ide2_system_data rd 1 cache_ide2_system_data rd 1
cache_ide2_appl_data rd 1 cache_ide2_appl_data rd 1
cache_ide2_system_sad_size rd 1 cache_ide2_system_sad_size rd 1
cache_ide2_appl_sad_size rd 1 cache_ide2_appl_sad_size rd 1
cache_ide2_search_start rd 1 cache_ide2_search_start rd 1
cache_ide2_appl_search_start rd 1 cache_ide2_appl_search_start rd 1
cache_ide3: cache_ide3:
cache_ide3_pointer rd 1 cache_ide3_pointer rd 1
cache_ide3_size rd 1 ; not use cache_ide3_size rd 1 ; not use
cache_ide3_data_pointer rd 1 cache_ide3_data_pointer rd 1
cache_ide3_system_data_size rd 1 ; not use cache_ide3_system_data_size rd 1 ; not use
cache_ide3_appl_data_size rd 1 ; not use cache_ide3_appl_data_size rd 1 ; not use
cache_ide3_system_data rd 1 cache_ide3_system_data rd 1
cache_ide3_appl_data rd 1 cache_ide3_appl_data rd 1
cache_ide3_system_sad_size rd 1 cache_ide3_system_sad_size rd 1
cache_ide3_appl_sad_size rd 1 cache_ide3_appl_sad_size rd 1
cache_ide3_search_start rd 1 cache_ide3_search_start rd 1
@ -462,12 +458,11 @@ cd_appl_data rb 1 ; 0 = system cache, 1 - application cache
lba_read_enabled rd 1 ; 0 = disabled , 1 = enabled lba_read_enabled rd 1 ; 0 = disabled , 1 = enabled
pci_access_enabled rd 1 ; 0 = disabled , 1 = enabled pci_access_enabled rd 1 ; 0 = disabled , 1 = enabled
timer_ticks_enable rb 1 ; for cd driver timer_ticks_enable rb 1 ; for cd driver
NumBiosDisks rd 1 NumBiosDisks rd 1
BiosDisksData rb 200h BiosDisksData rb 200h
BiosDiskCaches rb 80h*(cache_ide1-cache_ide0) BiosDiskCaches rb 80h*(cache_ide1-cache_ide0)
BiosDiskPartitions rd 80h BiosDiskPartitions rd 80h
IncludeUGlobals IncludeUGlobals

View 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

View File

@ -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]

View File

@ -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>

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -69,103 +69,103 @@ incecx2:
drawbuttonframes: drawbuttonframes:
push esi push esi
push edi push edi
push eax push eax
push ebx push ebx
push ecx push ecx
push edx push edx
shr ebx,16 shr ebx,16
shr ecx,16 shr ecx,16
mov eax,[TASK_BASE] mov eax,[TASK_BASE]
add ebx,[eax-twdw + WDATA.box.left] add ebx,[eax-twdw + WDATA.box.left]
add ecx,[eax-twdw + WDATA.box.top] add ecx,[eax-twdw + WDATA.box.top]
mov eax, ebx mov eax, ebx
shl eax, 16 shl eax, 16
mov ax, bx mov ax, bx
add ax, word [esp+8] add ax, word [esp+8]
mov ebx, ecx mov ebx, ecx
shl ebx, 16 shl ebx, 16
mov bx, cx mov bx, cx
push ebx push ebx
xor edi, edi xor edi, edi
mov ecx, esi mov ecx, esi
call incecx call incecx
call [draw_line] call [draw_line]
movzx edx,word [esp+4+4] movzx edx,word [esp+4+4]
add ebx,edx add ebx,edx
shl edx,16 shl edx,16
add ebx,edx add ebx,edx
mov ecx,esi mov ecx,esi
call dececx call dececx
call [draw_line] call [draw_line]
pop ebx pop ebx
push edx push edx
mov edx,eax mov edx,eax
shr edx,16 shr edx,16
mov ax,dx mov ax,dx
mov edx,ebx mov edx,ebx
shr edx,16 shr edx,16
mov bx,dx mov bx,dx
mov dx,[esp+4+4] mov dx,[esp+4+4]
add bx,dx add bx,dx
pop edx pop edx
mov ecx,esi mov ecx,esi
call incecx call incecx
call [draw_line] call [draw_line]
mov dx,[esp+8] mov dx,[esp+8]
add ax,dx add ax,dx
shl edx,16 shl edx,16
add eax,edx add eax,edx
add ebx,1*65536 add ebx,1*65536
mov ecx,esi mov ecx,esi
call dececx call dececx
call [draw_line] call [draw_line]
pop edx pop edx
pop ecx pop ecx
pop ebx pop ebx
pop eax pop eax
pop edi pop edi
pop esi pop esi
ret ret
button_dececx: button_dececx:
cmp [buttontype],dword 1 cmp [buttontype],dword 1
jne .finish jne .finish
; je bdece ; je bdece
; ret ; ret
; bdece: ; bdece:
push eax push eax
mov eax,0x01 mov eax,0x01
cmp edi,20 cmp edi,20
jg @f jg @f
mov eax,0x02 mov eax,0x02
@@: @@:
test ecx,0xff test ecx,0xff
jz @f jz @f
sub ecx,eax sub ecx,eax
@@: @@:
shl eax,8 shl eax,8
test ecx,0xff00 test ecx,0xff00
jz @f jz @f
sub ecx,eax sub ecx,eax
@@: @@:
shl eax,8 shl eax,8
test ecx,0xff0000 test ecx,0xff0000
jz @f jz @f
sub ecx,eax sub ecx,eax
@@: @@:
pop eax pop eax
.finish: .finish:
ret ret
sys_button: sys_button:
@ -190,7 +190,7 @@ sys_button:
test edx, 0x40000000 test edx, 0x40000000
jnz button_no_draw jnz button_no_draw
pushad ; button body pushad ; button body
movzx edi, cx movzx edi, cx
shr ebx, 16 shr ebx, 16
shr ecx, 16 shr ecx, 16
@ -293,44 +293,44 @@ rnmba:
find_pressed_button_frames: find_pressed_button_frames:
pushad pushad
movzx ebx,word [eax+0] movzx ebx,word [eax+0]
shl ebx,5 shl ebx,5
add ebx,window_data add ebx,window_data
mov ecx, [ebx+ WDATA.box.left] ; window x start mov ecx, [ebx+ WDATA.box.left] ; window x start
movzx edx,word [eax+4] ; button x start movzx edx,word [eax+4] ; button x start
add ecx,edx add ecx,edx
push ecx push ecx
mov dx,[eax+6] ; button x size mov dx,[eax+6] ; button x size
add cx,dx add cx,dx
mov esi,ecx mov esi,ecx
inc esi inc esi
mov ecx, [ebx+WDATA.box.top] ; window y start mov ecx, [ebx+WDATA.box.top] ; window y start
mov dx,[eax+8] ; button y start mov dx,[eax+8] ; button y start
add ecx,edx add ecx,edx
mov ebx,ecx mov ebx,ecx
mov dx,[eax+10] ; button y size mov dx,[eax+10] ; button y size
add dx,cx add dx,cx
inc dx inc dx
pop eax pop eax
; eax x beginning ; eax x beginning
; ebx y beginning ; ebx y beginning
; esi x end ; esi x end
; edx y end ; edx y end
; ecx color ; ecx color
mov [pressed_button_eax],eax mov [pressed_button_eax],eax
mov [pressed_button_ebx],ebx mov [pressed_button_ebx],ebx
mov [pressed_button_ecx],ecx mov [pressed_button_ecx],ecx
mov [pressed_button_edx],edx mov [pressed_button_edx],edx
mov [pressed_button_esi],esi mov [pressed_button_esi],esi
popad popad
ret ret
uglobal uglobal
pressed_button_eax dd 0 pressed_button_eax dd 0
@ -343,70 +343,70 @@ endg
; negative button image ; negative button image
negativebutton: negativebutton:
; If requested, do not display button ; If requested, do not display button
; boarder on press. ; boarder on press.
test ebx,0x20000000 test ebx,0x20000000
jz draw_negative_button jz draw_negative_button
ret ret
draw_negative_button: draw_negative_button:
pushad pushad
mov eax,[pressed_button_eax] mov eax,[pressed_button_eax]
mov ebx,[pressed_button_ebx] mov ebx,[pressed_button_ebx]
mov ecx,[pressed_button_ecx] mov ecx,[pressed_button_ecx]
mov edx,[pressed_button_edx] mov edx,[pressed_button_edx]
mov esi,[pressed_button_esi] mov esi,[pressed_button_esi]
mov ecx,0x01000000 mov ecx,0x01000000
dec edx dec edx
push edx push edx
inc edx inc edx
dec esi dec esi
push esi push esi
inc esi inc esi
push eax push eax
push ebx push ebx
push ecx push ecx
push edx push edx
push edi push edi
call [disable_mouse] call [disable_mouse]
bdbnewline: bdbnewline:
mov edi,1 ; force mov edi,1 ; force
cmp eax,[esp+16] cmp eax,[esp+16]
jz bneg jz bneg
cmp eax,[esp+20] cmp eax,[esp+20]
jz bneg jz bneg
cmp ebx,[esp+12] cmp ebx,[esp+12]
jz bneg jz bneg
cmp ebx,[esp+24] cmp ebx,[esp+24]
jnz nbneg jnz nbneg
; jz bneg ; jz bneg
; jmp nbneg ; jmp nbneg
bneg: bneg:
;;;call [disable_mouse] ;;;call [disable_mouse]
call [putpixel] call [putpixel]
nbneg: nbneg:
inc eax inc eax
cmp eax,esi cmp eax,esi
jnz bdbnewline jnz bdbnewline
mov eax,[esp+16] mov eax,[esp+16]
inc ebx inc ebx
cmp ebx,edx cmp ebx,edx
jnz bdbnewline jnz bdbnewline
add esp,28 add esp,28
popad popad
ret ret
; check buttons ; check buttons
@ -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
@ -455,7 +455,7 @@ checkbuttons:
mov ax,[MOUSE_Y] mov ax,[MOUSE_Y]
mov [my],ax mov [my],ax
@@: @@:
pop ax pop ax
;and it is only refreshed after the mouse's button release ;and it is only refreshed after the mouse's button release
;..................................... end 2/5 : modified by vhanla ............................. ;..................................... end 2/5 : modified by vhanla .............................
@ -471,7 +471,7 @@ checkbuttons:
cmp edx,esi cmp edx,esi
jge bch jge bch
popad ; no button pressed popad ; no button pressed
ret ret
bch: bch:
@ -494,8 +494,8 @@ checkbuttons:
movzx ebx,word [eax+0] movzx ebx,word [eax+0]
shl ebx,5 shl ebx,5
test [ebx+window_data+WDATA.fl_wstate],WSTATE_MINIMIZED test [ebx+window_data+WDATA.fl_wstate],WSTATE_MINIMIZED
jnz buttonnewcheck jnz buttonnewcheck
; add ebx,window_data ; add ebx,window_data
; mov ecx,[window_data+ebx+8] ; window end X ; mov ecx,[window_data+ebx+8] ; window end X
@ -509,50 +509,50 @@ checkbuttons:
jge buttonnewcheck jge buttonnewcheck
; check coordinates ; check coordinates
; mouse x >= button x ? ; mouse x >= button x ?
movzx ebx,word [eax+0] movzx ebx,word [eax+0]
shl ebx,5 shl ebx,5
add ebx,window_data add ebx,window_data
mov ecx, [ebx+WDATA.box.left] ; window x start mov ecx, [ebx+WDATA.box.left] ; window x start
movzx edx,word [eax+4] ; button x start movzx edx,word [eax+4] ; button x start
add edx,ecx add edx,ecx
;..................................... start 3/5 : modified by vhanla ............................. ;..................................... start 3/5 : modified by vhanla .............................
mov cx,[mx] ;mov cx,[MOUSE_X] mov cx,[mx] ;mov cx,[MOUSE_X]
;..................................... end 3/5 : modified by vhanla ............................. ;..................................... end 3/5 : modified by vhanla .............................
cmp edx,ecx cmp edx,ecx
jg buttonnewcheck jg buttonnewcheck
movzx ebx,word [eax+6] ; button x size movzx ebx,word [eax+6] ; button x size
add edx,ebx add edx,ebx
cmp ecx,edx cmp ecx,edx
jg buttonnewcheck jg buttonnewcheck
; mouse y >= button y ? ; mouse y >= button y ?
movzx ebx,word [eax+0] movzx ebx,word [eax+0]
shl ebx,5 shl ebx,5
add ebx,window_data add ebx,window_data
mov ecx, [ebx+WDATA.box.top] ; window y start mov ecx, [ebx+WDATA.box.top] ; window y start
movzx edx,word [eax+8] ; button y start movzx edx,word [eax+8] ; button y start
add edx,ecx add edx,ecx
;..................................... start 4/5 : modified by vhanla ............................. ;..................................... start 4/5 : modified by vhanla .............................
mov cx,[my] ;mov cx,[MOUSE_Y] mov cx,[my] ;mov cx,[MOUSE_Y]
;..................................... start 4/5 : modified by vhanla ............................. ;..................................... start 4/5 : modified by vhanla .............................
cmp edx,ecx cmp edx,ecx
jg buttonnewcheck jg buttonnewcheck
movzx ebx,word [eax+10] ; button y size movzx ebx,word [eax+10] ; button y size
add edx,ebx add edx,ebx
cmp ecx,edx cmp ecx,edx
jg buttonnewcheck jg buttonnewcheck
; mouse on button ; mouse on button
pop edx pop edx
pop esi pop esi
mov bx,[eax+0xc] ; button id : bits 16-31 mov bx,[eax+0xc] ; button id : bits 16-31
shl ebx,16 shl ebx,16
mov bx,[eax+2] ; button id : bits 00-16 mov bx,[eax+2] ; button id : bits 00-16
push ebx push ebx
mov [MOUSE_DOWN],byte 1 ; no mouse down checks mov [MOUSE_DOWN],byte 1 ; no mouse down checks
@ -596,46 +596,46 @@ endg
pusha pusha
; mouse x >= button x ? ; mouse x >= button x ?
movzx ebx,word [eax+0] movzx ebx,word [eax+0]
shl ebx,5 shl ebx,5
add ebx,window_data add ebx,window_data
mov ecx, [ebx+WDATA.box.left] ; window x start mov ecx, [ebx+WDATA.box.left] ; window x start
movzx edx,word [eax+4] ; button x start movzx edx,word [eax+4] ; button x start
add edx,ecx add edx,ecx
mov cx,[MOUSE_X] mov cx,[MOUSE_X]
cmp edx,ecx cmp edx,ecx
jg no_on_button ;if we release the pointer out of the button area jg no_on_button ;if we release the pointer out of the button area
movzx ebx,word [eax+6] ; button x size movzx ebx,word [eax+6] ; button x size
add edx,ebx add edx,ebx
cmp ecx,edx cmp ecx,edx
jg no_on_button jg no_on_button
; mouse y >= button y ? ; mouse y >= button y ?
movzx ebx,word [eax+0] movzx ebx,word [eax+0]
shl ebx,5 shl ebx,5
add ebx,window_data add ebx,window_data
mov ecx, [ebx+WDATA.box.top] ; window y start mov ecx, [ebx+WDATA.box.top] ; window y start
movzx edx,word [eax+8] ; button y start movzx edx,word [eax+8] ; button y start
add edx,ecx add edx,ecx
mov cx,[MOUSE_Y] mov cx,[MOUSE_Y]
cmp edx,ecx cmp edx,ecx
jg no_on_button jg no_on_button
movzx ebx,word [eax+10] ; button y size movzx ebx,word [eax+10] ; button y size
add edx,ebx add edx,ebx
cmp ecx,edx cmp ecx,edx
jg no_on_button jg no_on_button
popa popa
mov [BTN_COUNT],byte 1 ; no of buttons in buffer mov [BTN_COUNT],byte 1 ; no of buttons in buffer
pop ebx pop ebx
mov [BTN_BUFF],ebx ; lets put the button id in buffer mov [BTN_BUFF],ebx ; lets put the button id in buffer
push ebx push ebx
pusha pusha
jmp yes_on_button jmp yes_on_button
no_on_button: no_on_button:
mov [BTN_COUNT],byte 0 ; no of buttons in buffer mov [BTN_COUNT],byte 0 ; no of buttons in buffer
yes_on_button: yes_on_button:
mov [MOUSE_DOWN],byte 0 ; mouse down -> do not draw mov [MOUSE_DOWN],byte 0 ; mouse down -> do not draw
popa popa
pop ebx pop ebx
popa popa

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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;

File diff suppressed because it is too large Load Diff

View File

@ -74,7 +74,7 @@ WSTATE_MAXIMIZED = 00000001b
WSTATE_MINIMIZED = 00000010b WSTATE_MINIMIZED = 00000010b
WSTATE_ROLLEDUP = 00000100b WSTATE_ROLLEDUP = 00000100b
WSTATE_REDRAW = 00000001b WSTATE_REDRAW = 00000001b
WSTATE_WNDDRAWN = 00000010b WSTATE_WNDDRAWN = 00000010b
WSTYLE_HASCAPTION = 00010000b WSTYLE_HASCAPTION = 00010000b
@ -83,13 +83,13 @@ WSTYLE_CLIENTRELATIVE = 00100000b
struc TASKDATA struc TASKDATA
{ {
.event_mask dd ? .event_mask dd ?
.pid dd ? .pid dd ?
dw ? dw ?
.state db ? .state db ?
db ? db ?
dw ? dw ?
.wnd_number db ? .wnd_number db ?
db ? db ?
.mem_start dd ? .mem_start dd ?
.counter_sum dd ? .counter_sum dd ?
.counter_add dd ? .counter_add dd ?
@ -101,14 +101,14 @@ end virtual
; structures definition ; structures definition
struc WDATA { struc WDATA {
.box BOX .box BOX
.cl_workarea dd ? .cl_workarea dd ?
.cl_titlebar dd ? .cl_titlebar dd ?
.cl_frames dd ? .cl_frames dd ?
.reserved db ? .reserved db ?
.fl_wstate db ? .fl_wstate db ?
.fl_wdrawn db ? .fl_wdrawn db ?
.fl_redraw db ? .fl_redraw db ?
} }
virtual at 0 virtual at 0
WDATA WDATA WDATA WDATA
@ -117,13 +117,13 @@ label WDATA.fl_wstyle byte at 0x13
struc APPDATA struc APPDATA
{ {
.app_name db 11 dup(?) .app_name db 11 dup(?)
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,22 +138,24 @@ 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
dd ? ;+136 dd ? ;+136
.mem_size dd ? ;+140 .mem_size dd ? ;+140
.saved_box BOX .saved_box BOX
.ipc_start dd ? .ipc_start dd ?
.ipc_size dd ? .ipc_size dd ?
.event_mask dd ? .event_mask dd ?
.debugger_slot dd ? .debugger_slot dd ?
dd ? dd ?
.keyboard_mode db ? .keyboard_mode db ?
db 3 dup(?) db 3 dup(?)
.dir_table dd ? .dir_table dd ?
.dbg_event_mem dd ? .dbg_event_mem dd ?
.dbg_regs: .dbg_regs:
.dbg_regs.dr0 dd ? .dbg_regs.dr0 dd ?
@ -161,7 +163,7 @@ struc APPDATA
.dbg_regs.dr2 dd ? .dbg_regs.dr2 dd ?
.dbg_regs.dr3 dd ? .dbg_regs.dr3 dd ?
.dbg_regs.dr7 dd ? .dbg_regs.dr7 dd ?
.wnd_caption dd ? .wnd_caption dd ?
.wnd_clientbox BOX .wnd_clientbox BOX
} }
virtual at 0 virtual at 0

View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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