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:
cmp [fdd_motor_status],0
je end_check_fdd_motor_status_1

View File

@ -815,9 +815,12 @@ end if
dec al
mov [boot_dev], al
; GET MEMORY MAP
include 'detect/biosmem.inc'
; READ DISKETTE TO MEMORY
; cmp [boot_dev],0
cmp [boot_dev],0
jne no_sys_on_floppy
mov si,diskload
call print

View File

@ -104,7 +104,7 @@ _rs db 186,'
_bt db 186,' ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÙ',13,10,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
remarks dw remark1, remark2, remark3
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
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
remarks dw remark1, remark2, remark3
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
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
remarks dw remark1, remark2, remark3
num_remarks = 3

View File

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

View File

@ -1,5 +1,5 @@
@echo off
cls
set languages=en ru ge et
set drivers=sound sis infinity ensoniq ps2mouse com_mouse uart ati2d vmode
set targets=all kernel drivers skins clean
@ -74,6 +74,33 @@ goto :eof
)
cd ..
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
@ -95,11 +122,21 @@ goto :Exit_OK
:Error_FasmFailed
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
exit 1
:Exit_OK
echo all operations has been done
echo.
echo all operations have been done
pause
exit 0

View File

@ -95,11 +95,11 @@ CAPS_SVM equ 73 ;secure virual machine
CAPS_ALTMOVCR8 equ 74 ;
; CPU MSR names
MSR_SYSENTER_CS equ 0x174
MSR_SYSENTER_ESP equ 0x175
MSR_SYSENTER_EIP equ 0x176
MSR_AMD_EFER equ 0xC0000080 ; Extended Feature Enable Register
MSR_AMD_STAR equ 0xC0000081 ; SYSCALL/SYSRET Target Address Register
MSR_SYSENTER_CS equ 0x174
MSR_SYSENTER_ESP equ 0x175
MSR_SYSENTER_EIP equ 0x176
MSR_AMD_EFER equ 0xC0000080 ; Extended Feature Enable Register
MSR_AMD_STAR equ 0xC0000081 ; SYSCALL/SYSRET Target Address Register
CR0_PE equ 0x00000001 ;protected mode
CR0_MP equ 0x00000002 ;monitor fpu
@ -186,7 +186,7 @@ TSS_SIZE equ (128+8192)
OS_BASE equ 0x80000000
window_data equ OS_BASE
window_data equ (OS_BASE+0x0001000)
CURRENT_TASK equ (OS_BASE+0x0003000)
TASK_COUNT equ (OS_BASE+0x0003004)
@ -331,7 +331,7 @@ LFB_BASE equ 0xFE000000
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
RING0_STACK_SIZE equ (0x2000 - 512) ;512 áàéò äëÿ êîíòåêñòà FPU
@ -469,8 +469,9 @@ struc EVENT
.state dd ? ;internal flags
.code dd ?
rd 5
.size = $ - .magic
.codesize = $ - .code
}
EVENT_SIZE equ 52
virtual at 0
EVENT EVENT
@ -687,4 +688,3 @@ end virtual
virtual at 0
CSYM COFF_SYM
end virtual

View File

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

View File

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

View File

@ -142,7 +142,7 @@ fpu_restore:
ret
align 4
e7: ;#NM exception handler
except_7: ;#NM exception handler
save_ring3_context
clts
mov ax, app_data ;
@ -180,109 +180,4 @@ e7: ;#NM exception handler
iglobal
fpu_owner dd 0
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
endg

View File

@ -91,11 +91,11 @@ macro remove_from_used op
align 4
proc init_kernel_heap
mov ecx, 64/4
mov edi, mem_block_list
xor eax, eax
cld
rep stosd
mov ecx, 64
mov edi, mem_block_list
xor eax, eax
cld
rep stosd
mov ecx, 512/4
mov edi, mem_block_map
@ -138,22 +138,23 @@ proc init_kernel_heap
mov [ebx+list_bk], eax
mov [ebx+block_base], HEAP_BASE+4096*MEM_BLOCK_SIZE
mov ecx, [MEM_AMOUNT]
sub ecx, (HEAP_BASE - OS_BASE + 4096*MEM_BLOCK_SIZE)
mov [heap_size], ecx
mov [heap_free], ecx
mov [ebx+block_size], ecx
mov [ebx+block_flags], FREE_BLOCK
mov ecx, [pg_data.kernel_pages]
shl ecx, 12
sub ecx, HEAP_BASE+4096*MEM_BLOCK_SIZE
mov [heap_size], ecx
mov [heap_free], ecx
mov [ebx+block_size], ecx
mov [ebx+block_flags], FREE_BLOCK
mov [mem_block_mask], eax
mov [mem_block_mask+4],0x80000000
mov [mem_block_list+63*4], ebx
mov byte [mem_block_map], 0xFC
and [heap_mutex], 0
mov [heap_blocks], 4095
mov [free_blocks], 4095
ret
mov [mem_block_list+63*4], ebx
mov byte [mem_block_map], 0xFC
and [heap_mutex], 0
mov [heap_blocks], 4095
mov [free_blocks], 4094
ret
endp
; param

View File

@ -453,7 +453,7 @@ proc new_mem_resize stdcall, new_size:dword
@@:
call alloc_page
test eax, eax
jz .exit
jz .exit_pop
stdcall map_page_table, edi, eax
@ -491,6 +491,9 @@ proc new_mem_resize stdcall, new_size:dword
jb @B
jmp .update_size
.exit_pop:
pop edi
pop esi
.exit:
xor eax, eax
inc eax
@ -544,24 +547,16 @@ get_pg_addr:
align 4
; Now it is called from core/sys32::exc_c (see stack frame there)
proc page_fault_handler
test byte [esp+12+2], 2
jnz v86_page_fault
.err_addr equ ebp-4
.err_code equ ebp+32
.err_addr equ ebp-4
pushad
mov ebp, esp
mov eax, cr2
push eax
mov ax, app_data
mov ds, ax
mov es, ax
inc [pg_data.pages_faults]
push ebx ;save exception number (#PF)
mov ebp, esp
mov ebx, cr2
push ebx ;that is locals: .err_addr = cr2
inc [pg_data.pages_faults]
; push eax
; push edx
@ -571,129 +566,115 @@ proc page_fault_handler
; pop edx
; pop eax
mov ebx, [.err_addr]
mov eax, [.err_code]
mov eax, [pf_err_code]
cmp ebx, OS_BASE
jb .user_space ;ñòðàíèöà â ïàìÿòè ïðèëîæåíèÿ ;
cmp ebx, OS_BASE ;ebx == .err_addr
jb .user_space ;ñòðàíèöà â ïàìÿòè ïðèëîæåíèÿ ;
cmp ebx, page_tabs
jb .kernel_space ;ñòðàíèöà â ïàìÿòè ÿäðà
cmp ebx, page_tabs
jb .kernel_space ;ñòðàíèöà â ïàìÿòè ÿäðà
cmp ebx, kernel_tabs
jb .alloc;.app_tabs ;òàáëèöû ñòðàíèö ïðèëîæåíèÿ ;
;ïðîñòî ñîçäàäèì îäíó
cmp ebx, kernel_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:
test eax, PG_MAP
jnz .err_access ;Ñòðàíèöà ïðèñóòñòâóåò
;Îøèáêà äîñòóïà ?
test eax, PG_MAP
jnz .err_access ;Ñòðàíèöà ïðèñóòñòâóåò
;Îøèáêà äîñòóïà ?
shr ebx, 12
mov ecx, ebx
shr ecx, 10
mov edx, [master_tab+ecx*4]
test edx, PG_MAP
jz .fail ;òàáëèöà ñòðàíèö íå ñîçäàíà
;íåâåðíûé àäðåñ â ïðîãðàììå
shr ebx, 12
mov ecx, ebx
shr ecx, 10
mov edx, [master_tab+ecx*4]
test edx, PG_MAP
jz .fail ;òàáëèöà ñòðàíèö íå ñîçäàíà
;íåâåðíûé àäðåñ â ïðîãðàììå
mov eax, [page_tabs+ebx*4]
test eax, 2
jz .fail ;àäðåñ íå çàðåçåðâèðîâàí äëÿ ;
;èñïîëüçîâàíèÿ. Îøèáêà
mov eax, [page_tabs+ebx*4]
test eax, 2
jz .fail ;àäðåñ íå çàðåçåðâèðîâàí äëÿ ;
;èñïîëüçîâàíèÿ. Îøèáêà
.alloc:
call alloc_page
test eax, eax
jz .fail
call alloc_page
test eax, eax
jz .fail
stdcall map_page,[ebp-4],eax,dword PG_UW
stdcall map_page,[.err_addr],eax,dword PG_UW
mov edi, [ebp-4]
and edi, 0xFFFFF000
mov ecx, 1024
xor eax, eax
cld
rep stosd
.exit:
mov esp, ebp
popad
add esp, 4
iretd
mov edi, [.err_addr]
and edi, 0xFFFFF000
mov ecx, 1024
xor eax, eax
;cld ;caller is duty for this
rep stosd
.exit: ;iret with repeat fault instruction
add esp,12 ;clear in stack: locals(.err_addr) + #PF + ret_to_caller
restore_ring3_context
iretd
.err_access:
.err_access = .fail
;íèêîãäà íå ïðîèñõîäèò
jmp .fail
;jmp .fail
.kernel_space:
test eax, PG_MAP
jz .fail ;ñòðàíèöà íå ïðèñóòñòâóåò
test eax, PG_MAP
jz .fail ;ñòðàíèöà íå ïðèñóòñòâóåò
test eax, 4 ;U/S
jnz .fail ;ïðèëîæåíèå îáðàòèëîñü ê ïàìÿòè
;ÿäðà
test eax, 8
jnz .fail ;óñòàíîâëåí çàðåçåðâèðîâàííûé áèò
;â òàáëèöàõ ñòðàíèö. äîáàâëåíî â P4/Xeon
test eax,12 ;U/S (+below)
jnz .fail ;ïðèëîæåíèå îáðàòèëîñü ê ïàìÿòè
;ÿäðà
;test eax, 8
;jnz .fail ;óñòàíîâëåí çàðåçåðâèðîâàííûé áèò
;â òàáëèöàõ ñòðàíèö. äîáàâëåíî â P4/Xeon
;ïîïûòêà çàïèñè â çàùèù¸ííóþ ñòðàíèöó ÿäðà
cmp ebx, tss._io_map_0
jb .fail
cmp ebx, tss._io_map_0
jb .fail
cmp ebx, tss._io_map_0+8192
jae .fail
cmp ebx, tss._io_map_0+8192
jae .fail
; io permission map
; copy-on-write protection
call alloc_page
test eax, eax
jz .fail
call alloc_page
test eax, eax
jz .fail
push eax
stdcall map_page,[ebp-4],eax,dword PG_SW
pop eax
mov edi, [.err_addr]
and edi, -4096
lea esi, [edi+(not tss._io_map_0)+1]; -tss._io_map_0
push eax
stdcall map_page,[.err_addr],eax,dword PG_SW
pop eax
mov edi, [.err_addr]
and edi, -4096
lea esi, [edi+(not tss._io_map_0)+1]; -tss._io_map_0
mov ebx, esi
shr ebx, 12
mov edx, [current_slot]
or eax, PG_SW
mov [edx+APPDATA.io_map+ebx*4], eax
mov ebx, esi
shr ebx, 12
mov edx, [current_slot]
or eax, PG_SW
mov [edx+APPDATA.io_map+ebx*4], eax
add esi, [default_io_map]
mov ecx, 4096/4
cld
rep movsd
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
add esi, [default_io_map]
mov ecx, 4096/4
;cld ;caller is duty for this
rep movsd
jmp .exit
endp
align 4
@ -983,29 +964,29 @@ endp
align 4
sysfn_meminfo:
; add ebx, new_app_base
cmp ebx, OS_BASE
; add ecx, new_app_base
cmp ecx, OS_BASE
jae .fail
mov eax, [pg_data.pages_count]
mov [ebx], eax
mov [ecx], eax
shl eax, 12
mov [esp+36], eax
mov ecx, [pg_data.pages_free]
mov [ebx+4], ecx
mov edx, [pg_data.pages_faults]
mov [ebx+8], edx
mov esi, [heap_size]
mov [ebx+12], esi
mov edi, [heap_free]
mov [ebx+16], edi
mov [esp+32], eax
mov eax, [pg_data.pages_free]
mov [ecx+4], eax
mov eax, [pg_data.pages_faults]
mov [ecx+8], eax
mov eax, [heap_size]
mov [ecx+12], eax
mov eax, [heap_free]
mov [ecx+16], eax
mov eax, [heap_blocks]
mov [ebx+20], eax
mov ecx, [free_blocks]
mov [ebx+24], ecx
mov [ecx+20], eax
mov eax, [free_blocks]
mov [ecx+24], eax
ret
.fail:
mov dword [esp+36], -1
mov dword [esp+32], -1
ret
align 4
@ -1014,15 +995,17 @@ f68call:
dd f68.12
dd f68.13
dd f68.14
dd f68.15
dd f68.fail ;moved to f68.24
dd f68.16
dd f68.17
dd f68.18
dd f68.fail ;moved to f68.25
dd f68.19
dd f68.20
dd f68.21
dd f68.22
dd f68.23
dd f68.24
dd f68.25
align 4
f68:
@ -1032,7 +1015,7 @@ f68:
cmp eax, 11
jb .fail
cmp eax, 23
cmp eax, 25
ja .fail
jmp dword [f68call+eax*4-11*4]
@ -1051,14 +1034,16 @@ f68:
.14:
cmp ebx, OS_BASE
jae .fail
stdcall get_event_ex, ebx, ecx
mov edi,ebx
call get_event_ex
mov [esp+36], eax
ret
.15:
mov ecx, [current_slot]
mov eax, [ecx+APPDATA.fpu_handler]
mov [ecx+APPDATA.fpu_handler], ebx
mov [esp+36], eax
.24:
mov eax, [current_slot]
xchg ebx, [eax+APPDATA.exc_handler]
xchg ecx, [eax+APPDATA.except_mask]
mov [esp+36], ebx ; reg_eax+8
mov [esp+24], ecx ; reg_ebx+8
ret
.16:
test ebx, ebx
@ -1072,12 +1057,15 @@ f68:
call srv_handlerEx ;ebx
mov [esp+36], eax
ret
.18:
mov ecx, [current_slot]
mov eax, [ecx+APPDATA.sse_handler]
mov [ecx+APPDATA.sse_handler], ebx
mov [esp+36], eax
ret
.25:
cmp ebx,32
jae .fail
mov eax, [current_slot]
btr [eax+APPDATA.except_mask],ebx
setc byte[esp+36]
jecxz @f
bts [eax+APPDATA.except_mask],ebx
@@: ret
.19:
cmp ebx, OS_BASE
jae .fail
@ -1318,6 +1306,3 @@ proc create_ring_buffer stdcall, size:dword, flags:dword
.fail:
ret
endp

View File

@ -15,321 +15,229 @@ $Revision: 907 $
align 32
irq0:
pushad
mov ax, app_data ;
mov ds, ax
mov es, ax
; cmp dword[CURRENT_TASK], 1
; jnz @f
; mov eax, [esp + 32]
; cmp eax, idle_loop + 1
; jz @f
; DEBUGF 1, "K : OOOPS! EAX = 0x%x\n", eax
; @@:
inc dword [timer_ticks]
mov eax, [timer_ticks]
call playNote ; <<<--- Speaker driver
cmp eax,[next_usage_update]
jb .nocounter
add eax,100
mov [next_usage_update],eax
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
pushad
Mov ds, ax, app_data
mov es, ax
inc [timer_ticks]
mov eax, [timer_ticks]
call playNote ; <<<--- Speaker driver
sub eax,[next_usage_update]
cmp eax,100
jb .nocounter
add [next_usage_update],100
call updatecputimes
.nocounter:
mov al,0x20 ; send End Of Interrupt signal
out 0x20,al
btr dword[DONT_SWITCH], 0
jc .return
call find_next_task
jz .return ; if there is only one running process
call do_change_task
.return:
popad
iretd
align 4
change_task:
pushfd
cli
pushad
call update_counters
pushfd
cli
pushad
if 0
; \begin{Mario79}
cmp [dma_task_switched], 1
jne .find_next_task
mov [dma_task_switched], 0
mov ebx, [dma_process]
cmp [CURRENT_TASK], ebx
je .return
mov edi, [dma_slot_ptr]
mov [CURRENT_TASK], ebx
mov [TASK_BASE], edi
jmp @f
; \begin{Mario79} ; <- must be refractoried, if used...
cmp [dma_task_switched], 1
jne .find_next_task
mov [dma_task_switched], 0
mov ebx, [dma_process]
cmp [CURRENT_TASK], ebx
je .return
mov edi, [dma_slot_ptr]
mov [CURRENT_TASK], ebx
mov [TASK_BASE], edi
jmp @f
.find_next_task:
; \end{Mario79}
end if
call find_next_task
test eax, eax ; the same task -> skip switch
jnz .return
@@:
mov [DONT_SWITCH],byte 1
call do_change_task
.return:
popad
popfd
ret
call find_next_task
jz .return ; the same task -> skip switch
@@: mov byte[DONT_SWITCH], 1
call do_change_task
.return:
popad
popfd
ret
uglobal
align 4
far_jump:
.offs dd ?
.sel dw ?
context_counter dd ? ;noname & halyavin
next_usage_update dd ?
timer_ticks dd ?
prev_slot dd ?
event_sched dd ?
align 4
; far_jump:
; .offs dd ?
; .sel dw ?
context_counter dd 0 ;noname & halyavin
next_usage_update dd 0
timer_ticks dd 0
; prev_slot dd ?
; event_sched dd ?
endg
align 4
update_counters:
mov edi, [TASK_BASE]
mov ebx, [edi+TASKDATA.counter_add] ; time stamp counter add
rdtsc
sub eax, ebx
add eax, [edi+TASKDATA.counter_sum] ; counter sum
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
mov edi, [TASK_BASE]
rdtsc
sub eax, [edi+TASKDATA.counter_add] ; time stamp counter add
add [edi+TASKDATA.counter_sum], eax ; counter sum
ret
align 4
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]
mov [idleusesec],eax
mov [idleuse],dword 0
mov ecx, [TASK_COUNT]
mov edi, TASK_DATA
.newupdate:
mov ebx,[edi+TASKDATA.counter_sum]
mov [edi+TASKDATA.cpu_usage],ebx
mov [edi+TASKDATA.counter_sum],dword 0
add edi,0x20
dec ecx
jnz .newupdate
align 4
find_next_task:
;info:
; Find next task to execute
;retval:
; ebx = address of the APPDATA for the selected task (slot-base)
; esi = previous slot-base ([current_slot] at the begin)
; edi = address of the TASKDATA for the selected task
; ZF = 1 if the task is the same
;warning:
; [CURRENT_TASK] = bh , [TASK_BASE] = edi -- as result
; [current_slot] is not set to new value (ebx)!!!
;scratched: eax,ecx
call update_counters ; edi := [TASK_BASE]
Mov esi, ebx, [current_slot]
.loop:
cmp bh,[TASK_COUNT]
jb @f
xor bh, bh
mov edi,CURRENT_TASK
@@: inc bh ; ebx += APPDATA.size
add edi,0x20 ; edi += TASKDATA.size
mov al, [edi+TASKDATA.state]
test al, al
jz .found ; state == 0
cmp al, 5
jne .loop ; state == 1,2,3,4,9
; state == 5
pushad ; more freedom for [APPDATA.wait_test]
call [ebx+APPDATA.wait_test]
mov [esp+28],eax
popad
or eax,eax
jnz @f
; testing for timeout
mov ecx, [timer_ticks]
sub ecx, [ebx+APPDATA.wait_begin]
cmp ecx, [ebx+APPDATA.wait_timeout]
jb .loop
@@: mov [ebx+APPDATA.wait_param], eax ; retval for wait
mov [edi+TASKDATA.state], 0
.found:
mov [CURRENT_TASK],bh
mov [TASK_BASE],edi
rdtsc ;call _rdtsc
mov [edi+TASKDATA.counter_add],eax ; for next using update_counters
cmp ebx, esi ;esi - previous slot-base
ret
;TODO: Íàäî áû óáðàòü èñïîëüçîâàíèå 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
struc TIMER
{
.next dd ?
.exp_time 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
align 4
pick_task:
xor eax, eax
.pick:
mov ebx, [rdy_head+eax*4]
test ebx, ebx
jz .next
mov [next_task], ebx
test [ebx+flags.billable]
jz @F
mov [bill_task], ebx
@@:
ret
.next:
inc eax
jmp .pick
xor eax, eax
.pick:
mov ebx, [rdy_head+eax*4]
test ebx, ebx
jz .next
mov [next_task], ebx
test [ebx+flags.billable]
jz @F
mov [bill_task], ebx
@@:
ret
.next:
inc eax
jmp .pick
; param
; eax= task
@ -338,51 +246,48 @@ pick_task:
; eax= task
; ebx= queue
; ecx= front if 1 or back if 0
align 4
shed:
cmp [eax+.tics_left], 0 ;signed compare
mov ebx, [eax+.priority]
setg ecx
jg @F
cmp [eax+.tics_left], 0 ;signed compare
mov ebx, [eax+.priority]
setg ecx
jg @F
mov edx, [eax+.tics_quantum]
mov [eax+.ticks_left], edx
cmp ebx, (IDLE_PRIORITY-1)
je @F
inc ebx
@@:
ret
mov edx, [eax+.tics_quantum]
mov [eax+.ticks_left], edx
cmp ebx, (IDLE_PRIORITY-1)
je @F
inc ebx
@@:
ret
; param
; eax= task
align 4
enqueue:
call shed ;eax
cmp [rdy_head+ebx*4],0
jnz @F
call shed ;eax
cmp [rdy_head+ebx*4],0
jnz @F
mov [rdy_head+ebx*4], eax
mov [rdy_tail+ebx*4], eax
mov [eax+.next_ready], 0
jmp .pick
@@:
test ecx, ecx
jz .back
mov [rdy_head+ebx*4], eax
mov [rdy_tail+ebx*4], eax
mov [eax+.next_ready], 0
jmp .pick
@@:
test ecx, ecx
jz .back
mov ecx, [rdy_head+ebx*4]
mov [eax+.next_ready], ecx
mov [rdy_head+ebx*4], eax
jmp .pick
.back:
mov ecx, [rdy_tail+ebx*4]
mov [ecx+.next_ready], eax
mov [rdy_tail+ebx*4], eax
mov [eax+.next_ready], 0
.pick:
call pick_proc ;select next task
ret
mov ecx, [rdy_head+ebx*4]
mov [eax+.next_ready], ecx
mov [rdy_head+ebx*4], eax
jmp .pick
.back:
mov ecx, [rdy_tail+ebx*4]
mov [ecx+.next_ready], eax
mov [rdy_tail+ebx*4], eax
mov [eax+.next_ready], 0
.pick:
call pick_proc ;select next task
ret
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
align 16
cross_order:
; load all registers in crossed order
mov eax, ebx
mov ebx, ecx
mov ecx, edx
mov edx, esi
mov esi, edi
mov edi, [esp+28 + 4]
and edi,0xff
call dword [servetable+edi*4]
ret
; load all registers in crossed order
mov eax, ebx
mov ebx, ecx
mov ecx, edx
mov edx, esi
mov esi, edi
movzx edi, byte[esp+28 + 4]
call dword [servetable+edi*4]
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; SYSTEM CALL ENTRY ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
align 16
i40:
pushad
cld
movzx eax, al
call dword [servetable2 + eax * 4]
popad
iretd
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; SYSENTER ENTRY ;;
@ -45,28 +29,43 @@ i40:
align 32
sysenter_entry:
; Íàñòðàèâàåì ñòåê
mov esp, [ss:tss._esp0]
sti
push ebp ; save app esp + 4
mov ebp, [ebp] ; ebp - original ebp
;------------------
pushad
cld
; Íàñòðàèâàåì ñòåê
mov esp, [ss:tss._esp0]
sti
push ebp ; save app esp + 4
mov ebp, [ebp] ; ebp - original ebp
;------------------
pushad
cld
movzx eax, al
call dword [servetable2 + eax * 4]
movzx eax, al
call dword [servetable2 + eax * 4]
popad
;------------------
xchg ecx, [ss:esp] ; â âåðøèí ñòåêà - app ecx, ecx - app esp + 4
sub ecx, 4
xchg edx, [ecx] ; edx - return point, & save original edx
push edx
mov edx, [ss:esp + 4]
mov [ecx + 4], edx ; save original ecx
pop edx
sysexit
popad
;------------------
xchg ecx, [ss:esp] ; â âåðøèí ñòåêà - app ecx, ecx - app esp + 4
sub ecx, 4
xchg edx, [ecx] ; edx - return point, & save original edx
push edx
mov edx, [ss:esp + 4]
mov [ecx + 4], edx ; save original ecx
pop edx
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
syscall_entry:
; cli syscall clear IF
xchg esp, [ss:tss._esp0]
push ecx
lea ecx, [esp+4]
xchg ecx, [ss:tss._esp0]
sti
push ecx
mov ecx, [ecx]
;------------------
pushad
cld
xchg esp, [ss:tss._esp0]
push ecx
lea ecx, [esp+4]
xchg ecx, [ss:tss._esp0]
sti
push ecx
mov ecx, [ecx]
;------------------
pushad
cld
movzx eax, al
call dword [servetable2 + eax * 4]
movzx eax, al
call dword [servetable2 + eax * 4]
popad
;------------------
mov ecx, [ss:esp+4]
pop esp
sysret
popad
;------------------
mov ecx, [ss:esp+4]
pop esp
sysret
iglobal
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; SYSTEM FUNCTIONS TABLE ;;
@ -133,7 +133,7 @@ iglobal
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
@ -153,7 +153,7 @@ iglobal
dd display_number ; 47-WriteNum
dd display_settings ; 48-SetRedrawType and SetButtonType
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 0
dd 0
@ -167,7 +167,7 @@ iglobal
dd sys_gs ; 61-Direct graphics access
dd sys_pci ; 62-PCI functions
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 sys_process_def ; 66-Process definitions - keyboard
dd sys_window_move ; 67-Window move or resize
@ -175,7 +175,6 @@ iglobal
dd sys_debug_services ; 69-Debug
dd file_system_lfn ; 70-Common file system interface, version 2
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_redrawstat ; 12-BeginDraw and EndDraw
dd syscall_drawrect ; 13-DrawRect
dd syscall_getscreensize ; 14-GetScreenSize
dd syscall_getscreensize ; 14-GetScreenSize
dd sys_background ; 15-bgr
dd sys_cachetodiskette ; 16-FlushFloppyCache
dd sys_cachetodiskette ; 16-FlushFloppyCache
dd sys_getbutton ; 17-GetButton
dd sys_system ; 18-System Services
dd paleholder ; 19-reserved
@ -225,7 +224,7 @@ iglobal
dd syscall_drawline ; 38-DrawLine
dd cross_order ; 39-GetBackgroundSize,ReadBgrData,.
dd set_app_param ; 40-WantEvents
dd syscall_getirqowner ; 41-GetIrqOwner
dd syscall_getirqowner ; 41-GetIrqOwner
dd get_irq_data ; 42-ReadIrqData
dd cross_order ; 43-SendDeviceData
dd sys_programirq ; 44-ProgramIrqs
@ -256,7 +255,7 @@ iglobal
dd cross_order ; 69-Debug
dd cross_order ; 70-Common file system interface, version 2
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_socket ; 74-Sockets
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
; cmp dword [edx], 0 ; free block?
; jnz .n
; cmp dword [edx+4],
; cmp dword [edx+4],
; and [esi+V86_machine.mutex], 0
; pop edi edx ecx ebx
; ret
@ -351,47 +351,27 @@ endg
; a protected-mode interrupt handler (typically the general-protection
; 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
v86_exc_str1 db 'V86 : unexpected exception ',0
v86_exc_str2 db ' at ',0
v86_exc_str3 db ':',0
v86_exc_str4 db 13,10,'V86 : faulted code:',0
v86_exc_str5 db ' (unavailable)',0
v86_newline db 13,10,0
v86_io_str1 db 'V86 : access to disabled i/o port ',0
v86_io_byte db ' (byte)',13,10,0
v86_io_word db ' (word)',13,10,0
v86_io_dword db ' (dword)',13,10,0
v86_irqerr db 'V86 : IRQ already hooked',13,10,0
v86_exc_str1 db 'V86 : unexpected exception ',0
v86_exc_str2 db ' at ',0
v86_exc_str3 db ':',0
v86_exc_str4 db 13,10,'V86 : faulted code:',0
v86_exc_str5 db ' (unavailable)',0
v86_newline db 13,10,0
v86_io_str1 db 'V86 : access to disabled i/o port ',0
v86_io_byte db ' (byte)',13,10,0
v86_io_word db ' (word)',13,10,0
v86_io_dword db ' (dword)',13,10,0
v86_irqerr db 'V86 : IRQ already hooked',13,10,0
endg
v86_exc_c:
mov ax, app_data
mov ds, ax
mov es, ax
; 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
jnz @f
shr eax, 16
@ -945,12 +925,11 @@ v86_irq2:
mov cx, [eax*4+2]
mov word [esi-v86_regs.size+v86_regs.cs], cx
and byte [esi-v86_regs.size+v86_regs.eflags+1], not 3
push ebx
call update_counters
pop ebx
sub ebx, SLOT_BASE
shr ebx, 8
mov esi, [CURRENT_TASK]
lea edi, [ebx + 0x100000000 - SLOT_BASE]
shr edi, 3
add edi, TASK_DATA
call find_next_task.found
call do_change_task
popad
iretd

View File

@ -48,38 +48,39 @@ keymap_alt:
boot_memdetect db 'Determining amount of memory',0
boot_fonts db 'Fonts loaded',0
boot_tss db 'Setting TSSs',0
boot_cpuid db 'Reading CPUIDs',0
boot_devices db 'Detecting devices',0
boot_timer db 'Setting timer',0
boot_irqs db 'Reprogramming IRQs',0
boot_setmouse db 'Setting mouse',0
boot_windefs db 'Setting window defaults',0
boot_bgr db 'Calculating background',0
boot_resirqports db 'Reserving IRQs & ports',0
boot_setrports db 'Setting addresses for IRQs',0
boot_setostask db 'Setting OS task',0
boot_allirqs db 'Unmasking all IRQs',0
boot_tsc db 'Reading TSC',0
boot_pal_ega db 'Setting EGA/CGA 320x200 palette',0
boot_pal_vga db 'Setting VGA 640x480 palette',0
boot_failed db 'Failed to start first app',0
boot_mtrr db 'Setting MTRR',0
boot_memdetect db 'Determining amount of memory',0
boot_fonts db 'Fonts loaded',0
boot_tss db 'Setting TSSs',0
boot_cpuid db 'Reading CPUIDs',0
boot_devices db 'Detecting devices',0
boot_timer db 'Setting timer',0
boot_irqs db 'Reprogramming IRQs',0
boot_setmouse db 'Setting mouse',0
boot_windefs db 'Setting window defaults',0
boot_bgr db 'Calculating background',0
boot_resirqports db 'Reserving IRQs & ports',0
boot_setrports db 'Setting addresses for IRQs',0
boot_setostask db 'Setting OS task',0
boot_allirqs db 'Unmasking all IRQs',0
boot_tsc db 'Reading TSC',0
boot_cpufreq db 'CPU frequency is ',' ',' MHz',0
boot_pal_ega db 'Setting EGA/CGA 320x200 palette',0
boot_pal_vga db 'Setting VGA 640x480 palette',0
boot_failed db 'Failed to start first app',0
boot_mtrr db 'Setting MTRR',0
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
new_process_loading db 'K : New Process - loading',13,10,0
new_process_running db 'K : New Process - done',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
start_not_enough_memory db 'K : New Process - not enough memory',13,10,0
msg_unresolved db 'unresolved ',0
msg_module db 'in module ',0
msg_version db 'incompatible driver version',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
intel_str db "GenuineIntel",0
@ -87,11 +88,11 @@ AMD_str db "AuthenticAMD",0
;szSound db 'SOUND',0
;szInfinity db 'INFINITY',0
szHwMouse db 'ATI2D',0
szPS2MDriver db 'PS2MOUSE',0
szCOM_MDriver db 'COM_MOUSE',0
szUSB db 'USB',0
szAtiHW db '/rd/1/drivers/ati2d.drv',0
szHwMouse db 'ATI2D',0
szPS2MDriver db 'PS2MOUSE',0
;szCOM_MDriver db 'COM_MOUSE',0
szUSB db 'USB',0
szAtiHW db '/rd/1/drivers/ati2d.drv',0
szSTART db 'START',0
szEXPORTS db 'EXPORTS',0
@ -102,13 +103,13 @@ szIMPORTS db 'IMPORTS',0
read_firstapp db '/sys/'
firstapp db 'LAUNCHER',0
char db '/sys/FONTS/CHAR.MT',0
char2 db '/sys/FONTS/CHAR2.MT',0
char db '/sys/FONTS/CHAR.MT',0
char2 db '/sys/FONTS/CHAR2.MT',0
bootpath db '/KOLIBRI '
bootpath2 db 0
vmode db '/sys/drivers/VMODE.MDR',0
vrr_m db 'VRR_M',0
vmode db '/sys/drivers/VMODE.MDR',0
vrr_m db 'VRR_M',0
kernel_file db 'KERNEL MNT'
@ -144,14 +145,14 @@ mode_320_240_8:
; mike.dld {
db 0
dd servetable-0x10000
draw_line dd __sys_draw_line
disable_mouse dd __sys_disable_mouse
draw_pointer dd __sys_draw_pointer
draw_line dd __sys_draw_line
disable_mouse dd __sys_disable_mouse
draw_pointer dd __sys_draw_pointer
;//mike.dld, 2006-08-02 [
;drawbar dd __sys_drawbar
drawbar dd __sys_drawbar.forced
drawbar dd __sys_drawbar.forced
;//mike.dld, 2006-08-02 ]
putpixel dd __sys_putpixel
putpixel dd __sys_putpixel
; } mike.dld
@ -159,10 +160,10 @@ align 4
keyboard dd 1
syslang dd 1
boot_y dd 10
boot_y dd 10
pci_bios_entry dd 0
dw pci_code_sel
pci_bios_entry dd 0
dw pci_code_sel
if __DEBUG__ eq 1
include_debug_strings
@ -173,136 +174,135 @@ IncludeIGlobals
align 16
gdts:
dw gdte-$-1
dd gdts
dw 0
dw gdte-$-1
dd gdts
dw 0
; 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, ....
int_code_l:
os_code_l:
dw 0xffff
dw 0x0000
db 0x00
dw 11011111b *256 +10011010b
db 0x00
dw 0xffff
dw 0x0000
db 0x00
dw 11011111b *256 +10011010b
db 0x00
int_data_l:
os_data_l:
dw 0xffff
dw 0x0000
db 0x00
dw 11011111b *256 +10010010b
db 0x00
dw 0xffff
dw 0x0000
db 0x00
dw 11011111b *256 +10010010b
db 0x00
app_code_l:
dw 0xFFFF
dw 0
db 0
db cpl3
dw G32+D32+(new_app_base shr 16)+0xF;
dw 0xFFFF
dw 0
db 0
db cpl3
dw G32+D32+(new_app_base shr 16)+0xF;
app_data_l:
dw 0xFFFF
dw 0
db 0
db drw3
dw G32+D32+(new_app_base shr 16)+0xF;
dw 0xFFFF
dw 0
db 0
db drw3
dw G32+D32+(new_app_base shr 16)+0xF;
; ------------- PCI BIOS ------------------
pci_code_32:
dw 0 ;lim 0-15
dw 0 ;base 0-15
db 0 ;base 16-23
db cpl0 ;type
db D32 ;lim 16-19+props
db 0 ;base 24-31
dw 0 ;lim 0-15
dw 0 ;base 0-15
db 0 ;base 16-23
db cpl0 ;type
db D32 ;lim 16-19+props
db 0 ;base 24-31
pci_data_32:
dw 0 ;lim 0-15
dw 0 ;base 0-15
db 0 ;base 16-23
db dpl0 ;type
db D32 ;lim 16-19+props
db 0 ;base 24-31
dw 0 ;lim 0-15
dw 0 ;base 0-15
db 0 ;base 16-23
db dpl0 ;type
db D32 ;lim 16-19+props
db 0 ;base 24-31
; --------------- APM ---------------------
apm_code_32:
dw 0x0f ; limit 64kb
db 0, 0, 0
dw 11010000b *256 +10011010b
db 0x00
dw 0x0f ; limit 64kb
db 0, 0, 0
dw 11010000b *256 +10011010b
db 0x00
apm_code_16:
dw 0x0f
db 0, 0, 0
dw 10010000b *256 +10011010b
db 0x00
dw 0x0f
db 0, 0, 0
dw 10010000b *256 +10011010b
db 0x00
apm_data_16:
dw 0x0f
db 0, 0, 0
dw 10010000b *256 +10010010b
db 0x00
dw 0x0f
db 0, 0, 0
dw 10010000b *256 +10010010b
db 0x00
; -----------------------------------------
graph_data_l:
dw 0x7ff
dw 0x0000
db 0x00
dw 11010000b *256 +11110010b
db 0x00
dw 0x7ff
dw 0x0000
db 0x00
dw 11010000b *256 +11110010b
db 0x00
tss0_l:
dw TSS_SIZE-1
dw tss and 0xFFFF
db (tss shr 16) and 0xFF
db 10001001b
dw (tss shr 16) and 0xFF00
dw TSS_SIZE-1
dw tss and 0xFFFF
db (tss shr 16) and 0xFF
db 10001001b
dw (tss shr 16) and 0xFF00
endofcode:
gdte:
align 16
cur_saved_data rb 4096
fpu_data: rb 512
cur_saved_data rb 4096
fpu_data: rb 512
; device irq owners
irq_owner rd 16 ; process id
irq_owner rd 16 ; process id
; on irq read ports
irq00read rd 16
irq01read rd 16
irq02read rd 16
irq03read rd 16
irq04read rd 16
irq05read rd 16
irq06read rd 16
irq07read rd 16
irq08read rd 16
irq09read rd 16
irq10read rd 16
irq11read rd 16
irq12read rd 16
irq13read rd 16
irq14read rd 16
irq15read rd 16
irq00read rd 16
irq01read rd 16
irq02read rd 16
irq03read rd 16
irq04read rd 16
irq05read rd 16
irq06read rd 16
irq07read rd 16
irq08read rd 16
irq09read rd 16
irq10read rd 16
irq11read rd 16
irq12read rd 16
irq13read rd 16
irq14read rd 16
irq15read rd 16
irq_tab rd 16
irq_tab rd 16
mem_block_map rb 512
event_map rb 64
mem_block_list rd 64
mem_block_map rb 512
mem_block_list rd 64
large_block_list rd 31
mem_block_mask rd 2
mem_block_mask rd 2
large_block_mask rd 1
mem_used.fd rd 1
mem_used.bk rd 1
mem_block_arr rd 1
mem_block_arr rd 1
mem_block_start rd 1
mem_block_end rd 1
mem_block_end rd 1
heap_mutex rd 1
heap_size rd 1
@ -314,143 +314,139 @@ mst MEM_STATE
page_start rd 1
page_end rd 1
events rd 1
event_start rd 1
event_end rd 1
event_uid rd 1
sys_page_map rd 1
os_stack_seg rd 1
sys_page_map rd 1
os_stack_seg rd 1
srv.fd rd 1
srv.bk rd 1
srv.fd rd 1
srv.bk rd 1
scr_width rd 1
scr_height rd 1
scr_width rd 1
scr_height rd 1
create_cursor rd 1
create_cursor rd 1
select_hw_cursor rd 1
set_hw_cursor rd 1
hw_restore rd 1
set_hw_cursor rd 1
hw_restore rd 1
def_cursor rd 1
current_cursor rd 1
hw_cursor rd 1
cur_def_interl rd 1
cur_saved_base rd 1
def_cursor rd 1
current_cursor rd 1
hw_cursor rd 1
cur_def_interl rd 1
cur_saved_base rd 1
cur_saved_interl rd 1
cur_saved_w rd 1
cur_saved_h rd 1
cur_saved_w rd 1
cur_saved_h rd 1
ipc_tmp rd 1
ipc_pdir rd 1
ipc_ptab rd 1
ipc_tmp rd 1
ipc_pdir rd 1
ipc_ptab rd 1
proc_mem_map rd 1
proc_mem_pdir rd 1
proc_mem_tab rd 1
proc_mem_map rd 1
proc_mem_pdir rd 1
proc_mem_tab rd 1
tmp_task_pdir rd 1
tmp_task_ptab rd 1
tmp_task_pdir 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
current_slot rd 1
stall_mcs rd 1
current_slot rd 1
; 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
; device addresses
mididp rd 1
midisp rd 1
mididp rd 1
midisp rd 1
cdbase rd 1
cdid rd 1
cdbase rd 1
cdid rd 1
hdbase rd 1 ; for boot 0x1f0
hdid rd 1
hdpos rd 1 ; for boot 0x1
fat32part rd 1 ; for boot 0x1
cdpos rd 1
hdbase rd 1 ; for boot 0x1f0
hdid rd 1
hdpos rd 1 ; for boot 0x1
fat32part rd 1 ; for boot 0x1
cdpos rd 1
;CPUID information
cpu_vendor rd 3
cpu_sign rd 1
cpu_info rd 1
cpu_caps rd 4
cpu_vendor rd 3
cpu_sign rd 1
cpu_info rd 1
cpu_caps rd 4
pg_data PG_DATA
heap_test rd 1
pg_data PG_DATA
heap_test rd 1
buttontype rd 1
buttontype rd 1
windowtypechanged rd 1
hd_entries rd 1 ;unused ? 0xfe10
hd_entries rd 1 ;unused ? 0xfe10
;* start code - Mario79
mouse_active rd 1
mouse_pause rd 1
mouse_active rd 1
mouse_pause rd 1
MouseTickCounter rd 1
;* end code - Mario79
img_background rd 1
mem_BACKGROUND rd 1
wraw_bacground_select rb 1
img_background rd 1
mem_BACKGROUND rd 1
static_background_data rd 1
cache_ide0:
cache_ide0_pointer rd 1
cache_ide0_size rd 1 ; not use
cache_ide0_pointer rd 1
cache_ide0_size rd 1 ; not use
cache_ide0_data_pointer rd 1
cache_ide0_system_data_size rd 1 ; not use
cache_ide0_appl_data_size rd 1 ; not use
cache_ide0_system_data rd 1
cache_ide0_appl_data rd 1
cache_ide0_system_data rd 1
cache_ide0_appl_data rd 1
cache_ide0_system_sad_size rd 1
cache_ide0_appl_sad_size rd 1
cache_ide0_search_start rd 1
cache_ide0_appl_search_start rd 1
cache_ide1:
cache_ide1_pointer rd 1
cache_ide1_size rd 1 ; not use
cache_ide1_pointer rd 1
cache_ide1_size rd 1 ; not use
cache_ide1_data_pointer rd 1
cache_ide1_system_data_size rd 1 ; not use
cache_ide1_appl_data_size rd 1 ; not use
cache_ide1_system_data rd 1
cache_ide1_appl_data rd 1
cache_ide1_system_data rd 1
cache_ide1_appl_data rd 1
cache_ide1_system_sad_size rd 1
cache_ide1_appl_sad_size rd 1
cache_ide1_search_start rd 1
cache_ide1_appl_search_start rd 1
cache_ide2:
cache_ide2_pointer rd 1
cache_ide2_size rd 1 ; not use
cache_ide2_pointer rd 1
cache_ide2_size rd 1 ; not use
cache_ide2_data_pointer rd 1
cache_ide2_system_data_size rd 1 ; not use
cache_ide2_appl_data_size rd 1 ; not use
cache_ide2_system_data rd 1
cache_ide2_appl_data rd 1
cache_ide2_system_data rd 1
cache_ide2_appl_data rd 1
cache_ide2_system_sad_size rd 1
cache_ide2_appl_sad_size rd 1
cache_ide2_search_start rd 1
cache_ide2_appl_search_start rd 1
cache_ide3:
cache_ide3_pointer rd 1
cache_ide3_size rd 1 ; not use
cache_ide3_pointer rd 1
cache_ide3_size rd 1 ; not use
cache_ide3_data_pointer rd 1
cache_ide3_system_data_size rd 1 ; not use
cache_ide3_appl_data_size rd 1 ; not use
cache_ide3_system_data rd 1
cache_ide3_appl_data rd 1
cache_ide3_system_data rd 1
cache_ide3_appl_data rd 1
cache_ide3_system_sad_size rd 1
cache_ide3_appl_sad_size 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
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
BiosDisksData rb 200h
BiosDiskCaches rb 80h*(cache_ide1-cache_ide0)
NumBiosDisks rd 1
BiosDisksData rb 200h
BiosDiskCaches rb 80h*(cache_ide1-cache_ide0)
BiosDiskPartitions rd 80h
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
mov esi,BiosDiskCaches
.loopbd:
cmp byte [BiosDisksData+ecx*4+2],-1
jnz .contbd
push ecx
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 [esi+cache_ide0_size-cache_ide0],eax
push ecx
mov cl,1
call get_cache_ide
pop ecx
.contbd:
pop ecx
add esi,cache_ide1-cache_ide0
inc ecx
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
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>

View File

@ -201,7 +201,6 @@ macro DEBUGH_N _sign,_num,_hex {
if ~_hex eq ax
movzx eax,_hex
end if
shl eax,16
if (_num eq)
mov edx,4
end if
@ -209,7 +208,6 @@ macro DEBUGH_N _sign,_num,_hex {
if ~_hex eq al
movzx eax,_hex
end if
shl eax,24
if (_num eq)
mov edx,2
end if

View File

@ -1062,14 +1062,6 @@ fs_HdRead:
mov eax, ERROR_ACCESS_DENIED
ret
.noaccess_3:
add esp,4
.noaccess_1:
add esp,4
.noaccess_4:
add esp,4*5
jmp .noaccess_2
@@:
call hd_find_lfn
jnc .found
@ -1133,9 +1125,9 @@ fs_HdRead:
push ebx
mov ebx, edx
call hd_read
pop ebx
cmp [hd_error],0
jne .noaccess_1
pop ebx
add edx, 512
sub ecx, 512
jmp .skip
@ -1144,11 +1136,10 @@ fs_HdRead:
push eax ebx
mov ebx, buffer
call hd_read
cmp [hd_error],0
jne .noaccess_3
mov eax, ebx
pop ebx
cmp [hd_error],0
jne .noaccess_3
add eax, ebx
push ecx
add ecx, ebx
@ -1171,9 +1162,14 @@ fs_HdRead:
mov eax, [cluster_tmp]
call get_FAT
cmp [hd_error],0
jne .noaccess_4
jne .noaccess_1
jmp .new_cluster
.noaccess_3:
pop eax
.noaccess_1:
pop eax
push 11
.done:
mov ebx, edx
pop eax edx ecx edi

View File

@ -383,9 +383,13 @@ boot_read_ok:
mov [FAT_START],eax ; fat_start = partition_start + reserved
movzx eax,byte [ebx+0xd] ; sectors per cluster
test eax,eax
jz problem_fat_dec_count
mov [SECTORS_PER_CLUSTER],eax
movzx ecx,word [ebx+0xb] ; bytes per sector
cmp ecx,0x200
jnz problem_fat_dec_count
mov [BYTES_PER_SECTOR],ecx
movzx eax,word [ebx+0x11] ; count of rootdir entries (=0 fat32)

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -1166,10 +1166,10 @@ restore_minimized_window:
ret
iglobal
window_moving db 'K : Window - move/resize',13,10,0
window_moved db 'K : Window - done',13,10,0
endg
;iglobal
; window_moving db 'K : Window - move/resize',13,10,0
; window_moved db 'K : Window - done',13,10,0
;endg
; check window touch
align 4
@ -1316,10 +1316,10 @@ endg
.continue:
push esi
mov esi, window_moving
call sys_msg_board_str
pop esi
; push esi
; mov esi, window_moving
; call sys_msg_board_str
; pop esi
mov ecx, [timer_ticks] ; double-click ?
mov edx, ecx
@ -1684,8 +1684,8 @@ endg
mov [MOUSE_BACKGROUND],byte 0 ; no mouse under
mov [MOUSE_DOWN],byte 0 ; react to mouse up/down
mov esi,window_moved
call sys_msg_board_str
; mov esi,window_moved
; call sys_msg_board_str
popad

View File

@ -14,6 +14,9 @@ MEM_UC equ 0 ;uncached memory
align 4
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
and eax, not (CR0_CD+CR0_NW)
@ -29,37 +32,91 @@ proc mem_test
cmp dword [edi], 'TEST'
xchg ebx, dword [edi]
je @b
mov [MEM_AMOUNT-OS_BASE], edi
and eax, not (CR0_CD+CR0_NW) ;enable caching
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
endp
align 4
proc init_mem
mov eax, [MEM_AMOUNT-OS_BASE]
mov [pg_data.mem_amount-OS_BASE], eax
shr eax, 12
; calculate maximum allocatable address and number of allocatable pages
mov edi, BOOT_VAR-OS_BASE + 0x9104
mov ecx, [edi-4]
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 [pg_data.pages_count-OS_BASE], eax
shr eax, 3
mov [pg_data.pagemap_size-OS_BASE], eax
@@:
sub eax, [edi]
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
and eax, not 4095
mov [tmp_page_tabs], eax
shr edx, 12
add edx, 31
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)
jbe @F
mov edx, (OS_BASE/4096)
jmp .set
@@:
cmp edx, (HEAP_MIN_SIZE/4096)
cmp edx, (HEAP_BASE+HEAP_MIN_SIZE)/4096
jae .set
mov edx, (HEAP_MIN_SIZE/4096)
mov edx, (HEAP_BASE+HEAP_MIN_SIZE)/4096
.set:
mov [pg_data.kernel_pages-OS_BASE], edx
shr edx, 10
@ -130,14 +187,63 @@ endp
align 4
proc init_page_map
; mark all memory as unavailable
mov edi, sys_pgmap-OS_BASE
mov ecx, [pg_data.pagemap_size-OS_BASE]
shr ecx, 2
or eax, -1
xor eax, eax
cld
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 edx, [pg_data.pages_count-OS_BASE]
shr ecx, 12
@ -155,7 +261,7 @@ proc init_page_map
mov ecx, ebx
and ecx, 31
shl eax, cl
mov [edi], eax
and [edi], eax
add edi, OS_BASE
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_ROLLEDUP = 00000100b
WSTATE_REDRAW = 00000001b
WSTATE_REDRAW = 00000001b
WSTATE_WNDDRAWN = 00000010b
WSTYLE_HASCAPTION = 00010000b
@ -83,13 +83,13 @@ WSTYLE_CLIENTRELATIVE = 00100000b
struc TASKDATA
{
.event_mask dd ?
.pid dd ?
dw ?
.pid dd ?
dw ?
.state db ?
db ?
dw ?
dw ?
.wnd_number db ?
db ?
db ?
.mem_start dd ?
.counter_sum dd ?
.counter_add dd ?
@ -101,14 +101,14 @@ end virtual
; structures definition
struc WDATA {
.box BOX
.cl_workarea dd ?
.cl_titlebar dd ?
.cl_frames dd ?
.reserved db ?
.fl_wstate db ?
.fl_wdrawn db ?
.fl_redraw db ?
.box BOX
.cl_workarea dd ?
.cl_titlebar dd ?
.cl_frames dd ?
.reserved db ?
.fl_wstate db ?
.fl_wdrawn db ?
.fl_redraw db ?
}
virtual at 0
WDATA WDATA
@ -117,13 +117,13 @@ label WDATA.fl_wstyle byte at 0x13
struc APPDATA
{
.app_name db 11 dup(?)
db 5 dup(?)
.app_name db 11 dup(?)
db 5 dup(?)
.fpu_state dd ? ;+16
.ev_count dd ? ;+20
.fpu_handler dd ? ;+24
.sse_handler dd ? ;+28
.ev_count_ dd ? ;unused ;+20
.exc_handler dd ? ;+24
.except_mask dd ? ;+28
.pl0_stack dd ? ;unused ;+32
.heap_base dd ? ;+36
.heap_top dd ? ;+40
@ -138,22 +138,24 @@ struc APPDATA
.cur_dir dd ? ;+80
.wait_timeout dd ? ;+84
.saved_esp0 dd ? ;+88
db 36 dup(?) ;+92
.wait_begin dd ? ;+92 +++
.wait_test dd ? ;+96 +++
.wait_param dd ? ;+100 +++
db 24 dup(?) ;+104
.wnd_shape dd ? ;+128
.wnd_shape_scale dd ? ;+132
dd ? ;+136
.mem_size dd ? ;+140
.saved_box BOX
.ipc_start dd ?
.ipc_size dd ?
.event_mask dd ?
.saved_box BOX
.ipc_start dd ?
.ipc_size dd ?
.event_mask dd ?
.debugger_slot dd ?
dd ?
dd ?
.keyboard_mode db ?
db 3 dup(?)
.dir_table dd ?
db 3 dup(?)
.dir_table dd ?
.dbg_event_mem dd ?
.dbg_regs:
.dbg_regs.dr0 dd ?
@ -161,7 +163,7 @@ struc APPDATA
.dbg_regs.dr2 dd ?
.dbg_regs.dr3 dd ?
.dbg_regs.dr7 dd ?
.wnd_caption dd ?
.wnd_caption dd ?
.wnd_clientbox BOX
}
virtual at 0

View File

@ -98,3 +98,9 @@ if ~ f eq
end if
}
; \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
FLAGS=-m 65536
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
.PHONY: all kernel drivers skins clean

View File

@ -23,12 +23,17 @@
; 0x9046 - word - flags
; 0:907F byte number of 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:
;
; 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
; 0004 dword y start
@ -39,8 +44,6 @@
; 0018 dword color of frames
; 001C dword window flags, +30 = window drawn, +31 redraw flag
;
; 2000 -> 2FFF free
;
; 3000 -> 4FFF task list - 256 entries
;
; 00 dword process count
@ -70,9 +73,9 @@
;
; 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
; C402 -> C7FF window position in stack

View File

@ -113,7 +113,7 @@ palette320x200:
loop palnew
ret
align 4
uglobal
novesachecksum dd 0x0
EGA_counter db 0
@ -123,7 +123,7 @@ uglobal
temp:
.cx dd 0
endg
align 4
checkVga_N13:
cmp [SCR_MODE],dword 0x13