New organization of irq buffer, now its ring buffer. Its faster about 4.5 times.

*Warning! its debug version which can have many bugs, because I cannot test it all. I tested byte's receive on little size of data. If you can test it on big data size, and word's receive - do it! :)

git-svn-id: svn://kolibrios.org@759 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Rus 2008-02-27 18:05:09 +00:00
parent 6094221d05
commit 064055e18f
2 changed files with 377 additions and 365 deletions

View File

@ -21,28 +21,28 @@ idtreg:
build_interrupt_table: build_interrupt_table:
mov edi, idts+8 mov edi, idts+8
mov esi, sys_int mov esi, sys_int
mov ecx, 0x40 mov ecx, 0x40
@@: @@:
lodsd lodsd
mov [edi], ax ; lower part of offset mov [edi], ax ; lower part of offset
mov [edi+2], word os_code ; segment selector mov [edi+2], word os_code ; segment selector
mov ax, word 10001110b shl 8 ; type: interrupt gate mov ax, word 10001110b shl 8 ; type: interrupt gate
mov [edi+4], eax mov [edi+4], eax
add edi, 8 add edi, 8
loop @b loop @b
;mov edi,8*0x40+idts+8 ;mov edi,8*0x40+idts+8
mov dword [edi], (i40 and 0xFFFF) or (os_code shl 16) mov dword [edi], (i40 and 0xFFFF) or (os_code shl 16)
mov dword [edi+4], (11101111b shl 8) or (i40 and 0xFFFF0000) mov dword [edi+4], (11101111b shl 8) or (i40 and 0xFFFF0000)
; type: trap gate ; type: trap gate
ret ret
iglobal iglobal
msg_sel_ker db "kernel", 0 msg_sel_ker db "kernel", 0
msg_sel_app db "application", 0 msg_sel_app db "application", 0
sys_int: sys_int:
dd e0,debug_exc,e2,e3 dd e0,debug_exc,e2,e3
@ -53,19 +53,19 @@ iglobal
dd except_16, e17,e18, except_19 dd except_16, e17,e18, except_19
times 12 dd unknown_interrupt times 12 dd unknown_interrupt
dd irq0, irq_serv.irq_1, p_irq2 dd irq0, irq_serv.irq_1, p_irq2
if USE_COM_IRQ if USE_COM_IRQ
dd irq_serv.irq_3, irq_serv.irq_4 dd irq_serv.irq_3, irq_serv.irq_4
else else
dd p_irq3, p_irq4 dd p_irq3, p_irq4
end if end if
dd irq_serv.irq_5, p_irq6, irq_serv.irq_7 dd irq_serv.irq_5, p_irq6, irq_serv.irq_7
dd irq_serv.irq_8, irq_serv.irq_9, irq_serv.irq_10 dd irq_serv.irq_8, irq_serv.irq_9, irq_serv.irq_10
dd irq_serv.irq_11, irq_serv.irq_12,irqD ,p_irq14,p_irq15 dd irq_serv.irq_11, irq_serv.irq_12,irqD ,p_irq14,p_irq15
times 16 dd unknown_interrupt times 16 dd unknown_interrupt
dd i40 dd i40
endg endg
macro save_ring3_context macro save_ring3_context
@ -104,55 +104,55 @@ exc_wo_code 0, 2, 3, 4, 5, 6, 9, 15, 18
exc_w_code 8, 10, 11, 12, 13, 14, 17 exc_w_code 8, 10, 11, 12, 13, 14, 17
exc_c: exc_c:
mov ax, app_data ;èñêëþ÷åíèå mov ax, app_data ;èñêëþ÷åíèå
mov ds, ax ;çàãðóçèì ïðàâèëüíûå çíà÷åíè mov ds, ax ;çàãðóçèì ïðàâèëüíûå çíà÷åíè
mov es, ax ;â ðåãèñòðû mov es, ax ;â ðåãèñòðû
; redirect to V86 manager? (EFLAGS & 0x20000) != 0? ; redirect to V86 manager? (EFLAGS & 0x20000) != 0?
test byte [esp+20h+8+2], 2 test byte [esp+20h+8+2], 2
jnz v86_exc_c jnz v86_exc_c
; test if debugging ; test if debugging
cli cli
mov eax, [current_slot] mov eax, [current_slot]
mov eax, [eax+APPDATA.debugger_slot] mov eax, [eax+APPDATA.debugger_slot]
test eax, eax test eax, eax
jnz .debug jnz .debug
sti sti
; not debuggee => say error and terminate ; not debuggee => say error and terminate
movzx eax, bl movzx eax, bl
mov [error_interrupt], eax mov [error_interrupt], eax
call show_error_parameters call show_error_parameters
add esp, 0x20 add esp, 0x20
mov edx, [TASK_BASE] mov edx, [TASK_BASE]
mov [edx + TASKDATA.state], byte 4 mov [edx + TASKDATA.state], byte 4
jmp change_task jmp change_task
.debug: .debug:
; we are debugged process, notify debugger and suspend ourself ; we are debugged process, notify debugger and suspend ourself
; eax=debugger PID ; eax=debugger PID
cld cld
movzx ecx, bl movzx ecx, bl
push ecx push ecx
mov ecx, [TASK_BASE] mov ecx, [TASK_BASE]
push dword [ecx+TASKDATA.pid] ; PID of current process push dword [ecx+TASKDATA.pid] ; PID of current process
push 12 push 12
pop ecx pop ecx
push 1 ; 1=exception push 1 ; 1=exception
call debugger_notify call debugger_notify
pop ecx pop ecx
pop ecx pop ecx
pop ecx pop ecx
mov edx, [TASK_BASE] mov edx, [TASK_BASE]
mov byte [edx+TASKDATA.state], 1 ; suspended mov byte [edx+TASKDATA.state], 1 ; suspended
call change_task call change_task
restore_ring3_context restore_ring3_context
iretd iretd
iglobal iglobal
hexletters db '0123456789ABCDEF' hexletters db '0123456789ABCDEF'
error_interrupt dd -1 error_interrupt dd -1
endg endg
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
@ -169,7 +169,7 @@ show_error_parameters:
mov edi, msg_sel_app mov edi, msg_sel_app
mov ebx, [esp + 16 + 0x20] mov ebx, [esp + 16 + 0x20]
cmp eax, app_code cmp eax, app_code
je @f je @f
mov edi, msg_sel_ker mov edi, msg_sel_ker
mov ebx, [esp - 16 + 0x20] mov ebx, [esp - 16 + 0x20]
@@: @@:
@ -216,7 +216,7 @@ p_irq3:
cmp [com2_mouse_detected],0 cmp [com2_mouse_detected],0
je old_irq3_handler je old_irq3_handler
mov esi, com2_mouse mov esi, com2_mouse
mov dx, 2F8h ;[COMPortBaseAddr] mov dx, 2F8h ;[COMPortBaseAddr]
call check_mouse_data_com call check_mouse_data_com
jmp p_irq3_1 jmp p_irq3_1
old_irq3_handler: old_irq3_handler:
@ -234,7 +234,7 @@ p_irq4:
cmp [com1_mouse_detected],0 cmp [com1_mouse_detected],0
je old_irq4_handler je old_irq4_handler
mov esi, com1_mouse mov esi, com1_mouse
mov dx, 3F8h ;[COMPortBaseAddr] mov dx, 3F8h ;[COMPortBaseAddr]
call check_mouse_data_com call check_mouse_data_com
jmp p_irq4_1 jmp p_irq4_1
old_irq4_handler: old_irq4_handler:
@ -245,25 +245,25 @@ p_irq4:
iret iret
p_irq14: p_irq14:
save_ring3_context save_ring3_context
mov ax, app_data ;os_data mov ax, app_data ;os_data
mov ds, ax mov ds, ax
mov es, ax mov es, ax
mov byte [BOOT_VAR + 0x48E], 0xFF mov byte [BOOT_VAR + 0x48E], 0xFF
call [irq14_func] call [irq14_func]
call ready_for_next_irq_1 call ready_for_next_irq_1
restore_ring3_context restore_ring3_context
iret iret
p_irq15: p_irq15:
save_ring3_context save_ring3_context
mov ax, app_data ;os_data mov ax, app_data ;os_data
mov ds, ax mov ds, ax
mov es, ax mov es, ax
mov byte [BOOT_VAR + 0x48E], 0xFF mov byte [BOOT_VAR + 0x48E], 0xFF
call [irq15_func] call [irq15_func]
call ready_for_next_irq_1 call ready_for_next_irq_1
restore_ring3_context restore_ring3_context
iret iret
ready_for_next_irq: ready_for_next_irq:
mov [check_idle_semaphore],5 mov [check_idle_semaphore],5
@ -300,15 +300,15 @@ irqD:
irqhandler: irqhandler:
cmp [v86_irqhooks+edi*8], 0 cmp [v86_irqhooks+edi*8], 0
jnz v86_irq2 jnz v86_irq2
push edi push edi
mov esi,edi ; 1 mov esi,edi ; 1
shl esi,6 ; 1 shl esi,6 ; 1
add esi,irq00read ; 1 add esi,irq00read ; 1
shl edi,12 ; 1 shl edi,12 ; 1
add edi,IRQ_SAVE add edi,IRQ_SAVE
mov ecx,16 mov ecx,16
@ -318,53 +318,57 @@ irqhandler:
dec ecx dec ecx
js irqover js irqover
mov dx,[esi] ; 2+ movzx edx, word [esi] ; 2+
cmp dx,0 ; 1 test edx, edx ; 1
jz irqover jz irqover
cmp [esi+3],byte 1 ; 2 ; byte read
jne noirqbyte ; 4-11
in al,dx
mov edx,[edi] mov ebx, [edi] ; address of begin of buffer in edi ; + 0x0 dword - data size
cmp edx,4000 mov eax, 4000 ; + 0x4 dword - data begin offset
cmp ebx, eax
je irqfull je irqfull
mov ebx,edi add ebx, [edi + 0x4] ; add data size to data begin offset
add ebx,0x10 cmp ebx, eax ; if end of buffer, begin cycle again
add ebx,edx jb @f
mov [ebx],al
inc edx
mov [edi],edx
add esi,4 xor ebx, ebx
jmp irqnewread
noirqbyte: @@:
add ebx, edi
movzx eax, byte[esi + 3] ; get type of data being received 1 - byte, 2 - word
cmp [esi+3],byte 2 ; word read dec eax
jne noirqword jz irqbyte
dec eax
jnz noirqword
in ax,dx in ax,dx
cmp ebx, 3999 ; check for address odd in the end of buffer
jne .odd
mov [ebx + 0x10], ax
jmp .add_size
.odd:
mov [ebx + 0x10], al ; I could make mistake here :)
mov [edi + 0x10], ah
.add_size:
add dword [edi], 2
jmp nextport
mov edx,[edi]
cmp edx,4000 irqbyte:
je irqfull in al,dx
mov ebx,edi mov [ebx + 0x10],al
add ebx,0x10 inc dword [edi]
add ebx,edx nextport:
mov [ebx],ax
add edx,2
mov [edi],edx
add esi,4 add esi,4
jmp irqnewread jmp irqnewread
noirqword: noirqword:
irqfull: irqfull:
irqover: irqover:
mov al,0x20 ; ready for next irq mov al,0x20 ; ready for next irq
out 0x20,al out 0x20,al
pop ebx pop ebx
@ -378,50 +382,50 @@ irqhandler:
set_application_table_status: set_application_table_status:
push eax push eax
mov eax,[CURRENT_TASK] mov eax,[CURRENT_TASK]
shl eax, 5 shl eax, 5
add eax,CURRENT_TASK+TASKDATA.pid add eax,CURRENT_TASK+TASKDATA.pid
mov eax,[eax] mov eax,[eax]
mov [application_table_status],eax mov [application_table_status],eax
pop eax pop eax
ret ret
clear_application_table_status: clear_application_table_status:
push eax push eax
mov eax,[CURRENT_TASK] mov eax,[CURRENT_TASK]
shl eax, 5 shl eax, 5
add eax,CURRENT_TASK+TASKDATA.pid add eax,CURRENT_TASK+TASKDATA.pid
mov eax,[eax] mov eax,[eax]
cmp eax,[application_table_status] cmp eax,[application_table_status]
jne apptsl1 jne apptsl1
mov [application_table_status],0 mov [application_table_status],0
apptsl1: apptsl1:
pop eax pop eax
ret ret
sys_resize_app_memory: sys_resize_app_memory:
; eax = 1 - resize ; eax = 1 - resize
; ebx = new amount of memory ; ebx = new amount of memory
cmp eax,1 cmp eax,1
jne .no_application_mem_resize jne .no_application_mem_resize
stdcall new_mem_resize, ebx stdcall new_mem_resize, ebx
mov [esp+36], eax mov [esp+36], eax
ret ret
.no_application_mem_resize: .no_application_mem_resize:
ret ret
sys_threads: sys_threads:
@ -434,9 +438,9 @@ sys_threads:
jmp new_sys_threads jmp new_sys_threads
iglobal iglobal
process_terminating db 'K : Process - terminating',13,10,0 process_terminating db 'K : Process - terminating',13,10,0
process_terminated db 'K : Process - done',13,10,0 process_terminated db 'K : Process - done',13,10,0
msg_obj_destroy db 'K : destroy app object',13,10,0 msg_obj_destroy db 'K : destroy app object',13,10,0
endg endg
; param ; param
@ -444,126 +448,126 @@ endg
terminate: ; terminate application terminate: ; terminate application
.slot equ esp ;locals .slot equ esp ;locals
push esi ;save .slot push esi ;save .slot
shl esi, 8 shl esi, 8
cmp [SLOT_BASE+esi+APPDATA.dir_table], 0 cmp [SLOT_BASE+esi+APPDATA.dir_table], 0
jne @F jne @F
pop esi pop esi
shl esi, 5 shl esi, 5
mov [CURRENT_TASK+esi+TASKDATA.state], 9 mov [CURRENT_TASK+esi+TASKDATA.state], 9
ret ret
@@: @@:
;mov esi,process_terminating ;mov esi,process_terminating
;call sys_msg_board_str ;call sys_msg_board_str
DEBUGF 1,"%s",process_terminating DEBUGF 1,"%s",process_terminating
@@: @@:
cli cli
cmp [application_table_status],0 cmp [application_table_status],0
je term9 je term9
sti sti
call change_task call change_task
jmp @b jmp @b
term9: term9:
call set_application_table_status call set_application_table_status
; if the process is in V86 mode... ; if the process is in V86 mode...
mov eax, [.slot] mov eax, [.slot]
shl eax, 8 shl eax, 8
mov esi, [eax+SLOT_BASE+APPDATA.pl0_stack] mov esi, [eax+SLOT_BASE+APPDATA.pl0_stack]
add esi, RING0_STACK_SIZE add esi, RING0_STACK_SIZE
cmp [eax+SLOT_BASE+APPDATA.saved_esp0], esi cmp [eax+SLOT_BASE+APPDATA.saved_esp0], esi
jz .nov86 jz .nov86
; ...it has page directory for V86 mode ; ...it has page directory for V86 mode
mov esi, [eax+SLOT_BASE+APPDATA.saved_esp0] mov esi, [eax+SLOT_BASE+APPDATA.saved_esp0]
mov ecx, [esi+4] mov ecx, [esi+4]
mov [eax+SLOT_BASE+APPDATA.dir_table], ecx mov [eax+SLOT_BASE+APPDATA.dir_table], ecx
; ...and I/O permission map for V86 mode ; ...and I/O permission map for V86 mode
mov ecx, [esi+12] mov ecx, [esi+12]
mov [eax+SLOT_BASE+APPDATA.io_map], ecx mov [eax+SLOT_BASE+APPDATA.io_map], ecx
mov ecx, [esi+8] mov ecx, [esi+8]
mov [eax+SLOT_BASE+APPDATA.io_map+4], ecx mov [eax+SLOT_BASE+APPDATA.io_map+4], ecx
.nov86: .nov86:
mov esi, [.slot] mov esi, [.slot]
shl esi,8 shl esi,8
add esi, SLOT_BASE+APP_OBJ_OFFSET add esi, SLOT_BASE+APP_OBJ_OFFSET
@@: @@:
mov eax, [esi+APPOBJ.fd] mov eax, [esi+APPOBJ.fd]
test eax, eax test eax, eax
jz @F jz @F
cmp eax, esi cmp eax, esi
je @F je @F
push esi push esi
call [eax+APPOBJ.destroy] call [eax+APPOBJ.destroy]
DEBUGF 1,"%s",msg_obj_destroy DEBUGF 1,"%s",msg_obj_destroy
pop esi pop esi
jmp @B jmp @B
@@: @@:
mov eax, [.slot] mov eax, [.slot]
shl eax, 8 shl eax, 8
mov eax,[SLOT_BASE+eax+APPDATA.dir_table] mov eax,[SLOT_BASE+eax+APPDATA.dir_table]
stdcall destroy_app_space, eax stdcall destroy_app_space, eax
mov esi, [.slot] mov esi, [.slot]
cmp [fpu_owner],esi ; if user fpu last -> fpu user = 1 cmp [fpu_owner],esi ; if user fpu last -> fpu user = 1
jne @F jne @F
mov [fpu_owner],1 mov [fpu_owner],1
mov eax, [256+SLOT_BASE+APPDATA.fpu_state] mov eax, [256+SLOT_BASE+APPDATA.fpu_state]
clts clts
bt [cpu_caps], CAPS_SSE bt [cpu_caps], CAPS_SSE
jnc .no_SSE jnc .no_SSE
fxrstor [eax] fxrstor [eax]
jmp @F jmp @F
.no_SSE: .no_SSE:
fnclex fnclex
frstor [eax] frstor [eax]
@@: @@:
mov [KEY_COUNT],byte 0 ; empty keyboard buffer mov [KEY_COUNT],byte 0 ; empty keyboard buffer
mov [BTN_COUNT],byte 0 ; empty button buffer mov [BTN_COUNT],byte 0 ; empty button buffer
; remove defined hotkeys ; remove defined hotkeys
mov eax, hotkey_list mov eax, hotkey_list
.loop: .loop:
cmp [eax+8], esi cmp [eax+8], esi
jnz .cont jnz .cont
mov ecx, [eax] mov ecx, [eax]
jecxz @f jecxz @f
push dword [eax+12] push dword [eax+12]
pop dword [ecx+12] pop dword [ecx+12]
@@: @@:
mov ecx, [eax+12] mov ecx, [eax+12]
push dword [eax] push dword [eax]
pop dword [ecx] pop dword [ecx]
xor ecx, ecx xor ecx, ecx
mov [eax], ecx mov [eax], ecx
mov [eax+4], ecx mov [eax+4], ecx
mov [eax+8], ecx mov [eax+8], ecx
mov [eax+12], ecx mov [eax+12], ecx
.cont: .cont:
add eax, 16 add eax, 16
cmp eax, hotkey_list+256*16 cmp eax, hotkey_list+256*16
jb .loop jb .loop
; remove hotkeys in buffer ; remove hotkeys in buffer
mov eax, hotkey_buffer mov eax, hotkey_buffer
.loop2: .loop2:
cmp [eax], esi cmp [eax], esi
jnz .cont2 jnz .cont2
and dword [eax+4], 0 and dword [eax+4], 0
and dword [eax], 0 and dword [eax], 0
.cont2: .cont2:
add eax, 8 add eax, 8
cmp eax, hotkey_buffer+120*8 cmp eax, hotkey_buffer+120*8
jb .loop2 jb .loop2
mov ecx,esi ; remove buttons mov ecx,esi ; remove buttons
bnewba2: bnewba2:
mov edi,[BTN_ADDR] mov edi,[BTN_ADDR]
mov eax,edi mov eax,edi
@ -572,7 +576,7 @@ term9:
inc bx inc bx
bnewba: bnewba:
dec bx dec bx
jz bnmba jz bnmba
add eax,0x10 add eax,0x10
cmp cx,[eax] cmp cx,[eax]
jnz bnewba jnz bnewba
@ -621,10 +625,10 @@ term9:
shl edi, 5 shl edi, 5
mov eax, [SLOT_BASE+edi*8+APPDATA.debugger_slot] mov eax, [SLOT_BASE+edi*8+APPDATA.debugger_slot]
test eax, eax test eax, eax
jz .nodebug jz .nodebug
push 8 push 8
pop ecx pop ecx
push dword [CURRENT_TASK+edi+TASKDATA.pid] ; PID push dword [CURRENT_TASK+edi+TASKDATA.pid] ; PID
push 2 push 2
call debugger_notify call debugger_notify
pop ecx pop ecx
@ -632,86 +636,86 @@ term9:
.nodebug: .nodebug:
popad popad
mov ebx, [.slot] mov ebx, [.slot]
shl ebx, 8 shl ebx, 8
push ebx push ebx
mov ebx,[SLOT_BASE+ebx+APPDATA.pl0_stack] mov ebx,[SLOT_BASE+ebx+APPDATA.pl0_stack]
stdcall kernel_free, ebx stdcall kernel_free, ebx
pop ebx pop ebx
mov ebx,[SLOT_BASE+ebx+APPDATA.cur_dir] mov ebx,[SLOT_BASE+ebx+APPDATA.cur_dir]
stdcall kernel_free, ebx stdcall kernel_free, ebx
mov edi, [.slot] mov edi, [.slot]
shl edi,8 shl edi,8
add edi,SLOT_BASE add edi,SLOT_BASE
mov eax, [edi+APPDATA.io_map] mov eax, [edi+APPDATA.io_map]
cmp eax, (tss._io_map_0-OS_BASE+PG_MAP) cmp eax, (tss._io_map_0-OS_BASE+PG_MAP)
je @F je @F
call free_page call free_page
@@: @@:
mov eax, [edi+APPDATA.io_map+4] mov eax, [edi+APPDATA.io_map+4]
cmp eax, (tss._io_map_1-OS_BASE+PG_MAP) cmp eax, (tss._io_map_1-OS_BASE+PG_MAP)
je @F je @F
call free_page call free_page
@@: @@:
mov eax, 0x20202020 mov eax, 0x20202020
stosd stosd
stosd stosd
stosd stosd
mov ecx,244/4 mov ecx,244/4
xor eax, eax xor eax, eax
rep stosd rep stosd
; activate window ; activate window
movzx eax, word [WIN_STACK + esi*2] movzx eax, word [WIN_STACK + esi*2]
cmp eax, [TASK_COUNT] cmp eax, [TASK_COUNT]
jne .dont_activate jne .dont_activate
pushad pushad
.check_next_window: .check_next_window:
dec eax dec eax
cmp eax, 1 cmp eax, 1
jbe .nothing_to_activate jbe .nothing_to_activate
lea esi, [WIN_POS+eax*2] lea esi, [WIN_POS+eax*2]
movzx edi, word [esi] ; edi = process movzx edi, word [esi] ; edi = process
shl edi, 5 shl edi, 5
cmp [CURRENT_TASK + edi + TASKDATA.state], byte 9 ; skip dead slots cmp [CURRENT_TASK + edi + TASKDATA.state], byte 9 ; skip dead slots
je .check_next_window je .check_next_window
add edi, window_data add edi, window_data
; \begin{diamond}[19.09.2006] ; \begin{diamond}[19.09.2006]
; skip minimized windows ; skip minimized windows
test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
jnz .check_next_window jnz .check_next_window
; \end{diamond} ; \end{diamond}
call waredraw call waredraw
.nothing_to_activate: .nothing_to_activate:
popad popad
.dont_activate: .dont_activate:
push esi ; remove hd1 & cd & flp reservation push esi ; remove hd1 & cd & flp reservation
shl esi, 5 shl esi, 5
mov esi, [esi+CURRENT_TASK+TASKDATA.pid] mov esi, [esi+CURRENT_TASK+TASKDATA.pid]
cmp [hd1_status], esi cmp [hd1_status], esi
jnz @f jnz @f
call free_hd_channel call free_hd_channel
mov [hd1_status], 0 mov [hd1_status], 0
@@: @@:
cmp [cd_status], esi cmp [cd_status], esi
jnz @f jnz @f
call free_cd_channel call free_cd_channel
mov [cd_status], 0 mov [cd_status], 0
@@: @@:
cmp [flp_status], esi cmp [flp_status], esi
jnz @f jnz @f
mov [flp_status], 0 mov [flp_status], 0
@@: @@:
pop esi pop esi
cmp [bgrlockpid], esi cmp [bgrlockpid], esi
jnz @f jnz @f
and [bgrlockpid], 0 and [bgrlockpid], 0
mov [bgrlock], 0 mov [bgrlock], 0
@@: @@:
pusha ; remove all irq reservations pusha ; remove all irq reservations
@ -728,7 +732,7 @@ term9:
loop newirqfree loop newirqfree
popa popa
pusha ; remove all port reservations pusha ; remove all port reservations
mov edx,esi mov edx,esi
shl edx, 5 shl edx, 5
add edx,CURRENT_TASK add edx,CURRENT_TASK
@ -739,7 +743,7 @@ term9:
mov esi,[RESERVED_PORTS] mov esi,[RESERVED_PORTS]
cmp esi,0 cmp esi,0
je rmpr9 je rmpr9
rmpr3: rmpr3:
@ -748,7 +752,7 @@ term9:
add edi,RESERVED_PORTS add edi,RESERVED_PORTS
cmp edx,[edi] cmp edx,[edi]
je rmpr4 je rmpr4
dec esi dec esi
jnz rmpr3 jnz rmpr3
@ -773,7 +777,7 @@ term9:
rmpr9: rmpr9:
popa popa
mov edi,esi ; do not run this process slot mov edi,esi ; do not run this process slot
shl edi, 5 shl edi, 5
mov [edi+CURRENT_TASK + TASKDATA.state],byte 9 mov [edi+CURRENT_TASK + TASKDATA.state],byte 9
; debugger test - terminate all debuggees ; debugger test - terminate all debuggees
@ -781,7 +785,7 @@ term9:
mov ecx, SLOT_BASE+2*0x100+APPDATA.debugger_slot mov ecx, SLOT_BASE+2*0x100+APPDATA.debugger_slot
.xd0: .xd0:
cmp eax, [TASK_COUNT] cmp eax, [TASK_COUNT]
ja .xd1 ja .xd1
cmp dword [ecx], esi cmp dword [ecx], esi
jnz @f jnz @f
and dword [ecx], 0 and dword [ecx], 0
@ -819,18 +823,18 @@ term9:
restore .slot restore .slot
iglobal iglobal
boot_sched_1 db 'Building gdt tss pointer',0 boot_sched_1 db 'Building gdt tss pointer',0
boot_sched_2 db 'Building IDT table',0 boot_sched_2 db 'Building IDT table',0
endg endg
build_scheduler: build_scheduler:
mov esi,boot_sched_1 mov esi,boot_sched_1
call boot_log call boot_log
; call build_process_gdt_tss_pointer ; call build_process_gdt_tss_pointer
; mov esi,boot_sched_2 ; mov esi,boot_sched_2
; call boot_log ; call boot_log
ret ret

View File

@ -345,15 +345,15 @@ high_code:
mov al,[BOOT_VAR+0x9000] ; bpp mov al,[BOOT_VAR+0x9000] ; bpp
mov [ScreenBPP],al mov [ScreenBPP],al
xchg bx, bx xchg bx, bx
movzx eax,word [BOOT_VAR+0x900A] ; X max movzx eax,word [BOOT_VAR+0x900A] ; X max
dec eax dec eax
mov [Screen_Max_X],eax mov [Screen_Max_X],eax
mov [screen_workarea.right],eax mov [screen_workarea.right],eax
movzx eax,word [BOOT_VAR+0x900C] ; Y max movzx eax,word [BOOT_VAR+0x900C] ; Y max
dec eax dec eax
mov [Screen_Max_Y],eax mov [Screen_Max_Y],eax
mov [screen_workarea.bottom],eax mov [screen_workarea.bottom],eax
movzx eax,word [BOOT_VAR+0x9008] ; screen mode movzx eax,word [BOOT_VAR+0x9008] ; screen mode
mov [SCR_MODE],eax mov [SCR_MODE],eax
@ -1129,10 +1129,10 @@ set_variables:
;* mouse centered - start code- Mario79 ;* mouse centered - start code- Mario79
mouse_centered: mouse_centered:
push eax push eax
mov eax,[Screen_Max_X] mov eax,[Screen_Max_X]
shr eax,1 shr eax,1
mov [MOUSE_X],ax mov [MOUSE_X],ax
mov eax,[Screen_Max_Y] mov eax,[Screen_Max_Y]
shr eax,1 shr eax,1
mov [MOUSE_Y],ax mov [MOUSE_Y],ax
pop eax pop eax
@ -2029,7 +2029,7 @@ sys_end:
iglobal iglobal
align 4 align 4
sys_system_table: sys_system_table:
dd exit_for_anyone ; 1 = obsolete dd exit_for_anyone ; 1 = obsolete
dd sysfn_terminate ; 2 = terminate thread dd sysfn_terminate ; 2 = terminate thread
dd sysfn_activate ; 3 = activate window dd sysfn_activate ; 3 = activate window
dd sysfn_getidletime ; 4 = get idle time dd sysfn_getidletime ; 4 = get idle time
@ -2064,7 +2064,7 @@ sys_system:
ret ret
sysfn_shutdown: ; 18.9 = system shutdown sysfn_shutdown: ; 18.9 = system shutdown
cmp ecx,1 cmp ecx,1
jl exit_for_anyone jl exit_for_anyone
cmp ecx,4 cmp ecx,4
@ -2883,9 +2883,9 @@ sys_redrawstat:
add edx, draw_data - CURRENT_TASK add edx, draw_data - CURRENT_TASK
mov [edx + RECT.left], 0 mov [edx + RECT.left], 0
mov [edx + RECT.top], 0 mov [edx + RECT.top], 0
mov eax, [Screen_Max_X] mov eax, [Screen_Max_X]
mov [edx + RECT.right], eax mov [edx + RECT.right], eax
mov eax, [Screen_Max_Y] mov eax, [Screen_Max_Y]
mov [edx + RECT.bottom], eax mov [edx + RECT.bottom], eax
mov edi, [TASK_BASE] mov edi, [TASK_BASE]
@ -3486,7 +3486,7 @@ ret
checkpixel: checkpixel:
push eax edx push eax edx
mov edx,[Screen_Max_X] ; screen x size mov edx,[Screen_Max_X] ; screen x size
inc edx inc edx
imul edx, ebx imul edx, ebx
mov dl, [eax+edx+display_data] ; lea eax, [...] mov dl, [eax+edx+display_data] ; lea eax, [...]
@ -3948,25 +3948,33 @@ get_irq_data:
gidril1: gidril1:
shl ebx,12 shl ebx,12
mov ecx,1 xor ecx, ecx
lea eax,[ebx + IRQ_SAVE + 0x10] inc ecx
mov edx,[eax - 0x10] lea eax,[ebx + IRQ_SAVE]
mov edx,[eax]
test edx,edx test edx,edx
jz gid1 jz gid1
dec dword [eax - 0x10]
movzx ebx,byte [eax]
mov edi, eax
xchg esi, eax
inc esi
mov ecx,4000 / 4
cld
rep movsd
; xor ecx,ecx ; as result of 'rep' ecx=0
dec edx dec edx
mov [eax], edx
mov ecx, [eax + 0x4]
cmp ecx, 4000
jb @f
xor ecx, ecx
@@:
inc ecx
mov [eax + 0x4], ecx
dec ecx
add eax, ecx
movzx ebx,byte [eax + 0x10]
xor ecx, ecx
gid1: gid1:
mov [esp+32],edx mov [esp+32],edx
mov [esp+28],ecx mov [esp+28],ecx
@ -4973,9 +4981,9 @@ syscall_drawrect: ; DrawRect
align 4 align 4
syscall_getscreensize: ; GetScreenSize syscall_getscreensize: ; GetScreenSize
mov ax, [Screen_Max_X] mov ax, [Screen_Max_X]
shl eax, 16 shl eax, 16
mov ax, [Screen_Max_Y] mov ax, [Screen_Max_Y]
mov [esp + 32], eax mov [esp + 32], eax
ret ret
@ -5092,7 +5100,7 @@ syscall_drawline: ; DrawLine
mov ebp, ebx mov ebp, ebx
add ebp, [esi+APPDATA.wnd_clientbox.top] add ebp, [esi+APPDATA.wnd_clientbox.top]
add bx, word[esi+APPDATA.wnd_clientbox.top] add bx, word[esi+APPDATA.wnd_clientbox.top]
add ebp, ecx add ebp, ecx
shl ebx, 16 shl ebx, 16
xor edi, edi xor edi, edi
add ebx, ebp add ebx, ebp
@ -5175,39 +5183,39 @@ paleholder:
align 4 align 4
set_screen: set_screen:
cmp eax, [Screen_Max_X] cmp eax, [Screen_Max_X]
jne .set jne .set
cmp edx, [Screen_Max_Y] cmp edx, [Screen_Max_Y]
jne .set jne .set
ret ret
.set: .set:
pushfd pushfd
cli cli
mov [Screen_Max_X], eax mov [Screen_Max_X], eax
mov [Screen_Max_Y], edx mov [Screen_Max_Y], edx
mov [screen_workarea.right],eax mov [screen_workarea.right],eax
mov [screen_workarea.bottom], edx mov [screen_workarea.bottom], edx
inc eax inc eax
shl eax, 2 ;32 bpp shl eax, 2 ;32 bpp
mov [BytesPerScanLine], eax mov [BytesPerScanLine], eax
push ebx push ebx
push esi push esi
push edi push edi
call repos_windows call repos_windows
mov eax, 0 mov eax, 0
mov ebx, 0 mov ebx, 0
mov ecx, [Screen_Max_X] mov ecx, [Screen_Max_X]
mov edx, [Screen_Max_Y] mov edx, [Screen_Max_Y]
call calculatescreen call calculatescreen
pop edi pop edi
pop esi pop esi
pop ebx pop ebx
popfd popfd
ret ret
; --------------- APM --------------------- ; --------------- APM ---------------------
apm_entry dp 0 apm_entry dp 0