kolibri-process: add child thread's to doubly linked list

git-svn-id: svn://kolibrios.org@4457 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2014-01-15 12:12:52 +00:00
parent 9de1536468
commit 8304dbb5d4
10 changed files with 1182 additions and 389 deletions

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2011-2012. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2011-2014. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -16,6 +16,7 @@ DISK_STATUS_GENERAL_ERROR = -1; if no other code is suitable
DISK_STATUS_INVALID_CALL = 1 ; invalid input parameters
DISK_STATUS_NO_MEDIA = 2 ; no media present
DISK_STATUS_END_OF_MEDIA = 3 ; end of media while reading/writing data
DISK_STATUS_NO_MEMORY = 4 ; insufficient memory for driver operation
; Driver flags. Represent bits in DISK.DriverFlags.
DISK_NO_INSERT_NOTIFICATION = 1
; Media flags. Represent bits in DISKMEDIAINFO.Flags.
@ -101,8 +102,6 @@ ends
; there are two distinct caches for a disk, one for "system" data,and the other
; for "application" data.
struct DISKCACHE
mutex MUTEX
; Lock to protect the cache.
; The following fields are inherited from data32.inc:cache_ideX.
pointer dd ?
data_size dd ? ; unused
@ -169,6 +168,8 @@ struct DISK
; Pointer to array of .NumPartitions pointers to PARTITION structures.
cache_size dd ?
; inherited from cache_ideX_size
CacheLock MUTEX
; Lock to protect both caches.
SysCache DISKCACHE
AppCache DISKCACHE
; Two caches for the disk.

File diff suppressed because it is too large Load Diff

View File

@ -415,18 +415,21 @@ align 4
terminate: ; terminate application
destroy_thread:
.slot equ esp ;locals
.slot equ esp+4 ;locals
.process equ esp ;ptr to parent process
push esi ;save .slot
shl esi, 8
cmp [SLOT_BASE+esi+APPDATA.process], 0
jne @F
mov edx, [SLOT_BASE+esi+APPDATA.process]
test edx, edx
jnz @F
pop esi
shl esi, 5
mov [CURRENT_TASK+esi+TASKDATA.state], 9
ret
@@:
push edx ;save .process
lea edx, [SLOT_BASE+esi]
call scheduler_remove_thread
call lock_application_table
@ -624,6 +627,9 @@ destroy_thread:
je @F
call free_page
@@:
lea ebx, [edi+APPDATA.list]
list_del ebx ;destroys edx, ecx
mov eax, 0x20202020
stosd
stosd
@ -740,8 +746,19 @@ destroy_thread:
jmp .xd0
.xd1:
;release slot
xchg bx, bx
bts [thr_slot_map], esi
mov ebx, [.process]
add ebx, PROC.thr_list
cmp ebx, [ebx+LHEAD.next]
jne @F
DEBUGF 1,"%s",msg_process_destroy
@@:
sti ; .. and life goes on
mov eax, [draw_limits.left]
@ -756,9 +773,12 @@ destroy_thread:
call unlock_application_table
;mov esi,process_terminated
;call sys_msg_board_str
add esp, 4
add esp, 8
ret
restore .slot
restore .process
msg_process_destroy: db 'K: destroy process', 0x0d, 0x0a,0
; Three following procedures are used to guarantee that

View File

@ -262,6 +262,10 @@ proc fs_execute
mov ebx, [slot_base]
mov [ebx+APPDATA.process], eax
lea edx, [ebx+APPDATA.list]
lea ecx, [eax+PROC.thr_list]
list_add_tail edx, ecx
xor edx, edx
cmp word [6], '02'
jne @f
@ -980,6 +984,10 @@ proc new_sys_threads
mov eax, [ebx+APPDATA.process]
mov [edx+APPDATA.process], eax
lea ebx, [edx+APPDATA.list]
lea ecx, [eax+PROC.thr_list]
list_add_tail edx, ecx ;add thread to process child's list
mov eax, [ebx+APPDATA.tls_base]
test eax, eax
jz @F

View File

@ -74,6 +74,8 @@ include 'struct.inc'
$Revision: 4381 $
USE_FIX_FOR_INVALID_MS_VIRTUAL_PC_2007 equ 0
USE_COM_IRQ equ 1 ; make irq 3 and irq 4 available for PCI devices
VESA_1_2_VIDEO equ 0 ; enable vesa 1.2 bank switch functions

View File

@ -119,13 +119,12 @@ struct APPDATA
app_name rb 11
rb 5
process dd ? ;+16
fpu_state dd ? ;+20
exc_handler dd ? ;+24
except_mask dd ? ;+28
pl0_stack dd ? ;+32
dd ? ;+36
dd ? ;+40
list LHEAD ;+16
process dd ? ;+24
fpu_state dd ? ;+28
exc_handler dd ? ;+32
except_mask dd ? ;+36
pl0_stack dd ? ;+40
cursor dd ? ;+44
fd_ev dd ? ;+48
bk_ev dd ? ;+52

View File

@ -117,10 +117,10 @@ macro list_add_tail new, head
macro list_del entry
{
mov edx, [entry+list_fd]
mov ecx, [entry+list_bk]
mov [edx+list_bk], ecx
mov [ecx+list_fd], edx
mov edx, [entry+LHEAD.next]
mov ecx, [entry+LHEAD.prev]
mov [edx+LHEAD.prev], ecx
mov [ecx+LHEAD.next], edx
}
; MOV Immediate.

View File

@ -2210,6 +2210,8 @@ SOCKET_check_owner:
align 4
SOCKET_process_end:
ret ; FIXME
cmp [net_sockets + SOCKET.NextPtr], 0 ; Are there any active sockets at all?
je .quickret ; nope, exit immediately

View File

@ -206,7 +206,13 @@ blit_32:
push edi
push esi
push ebx
sub esp, 72
virtual at sizeof.BLITTER
.position dd ? ; (x shl 16) + y
; ???
.extra_var1 dd ?
.local_vars_size = $
end virtual
sub esp, .local_vars_size
mov eax, [TASK_BASE]
mov ebx, [eax-twdw + WDATA.box.width]
@ -246,9 +252,9 @@ blit_32:
mov eax, [ecx+32]
mov [esp+56], eax
mov [esp+BLITTER.bitmap], eax
mov eax, [ecx+36]
mov [esp+60], eax
mov [esp+BLITTER.stride], eax
mov ecx, esp
call blit_clip
@ -268,6 +274,11 @@ blit_32:
mov cx, bp
add ecx, [esp+BLITTER.h]
mov eax, ebx
shl eax, 16
mov ax, bp
mov [esp+.position], eax
mov edi, ebp
; imul edi, [_display.pitch]
@ -300,47 +311,37 @@ blit_32:
lea edi, [edi+ebx*4]
mov ebx, [CURRENT_TASK]
; check for hardware cursor
cmp [_display.select_cursor], select_cursor
je .core_32.software_cursor
cmp [_display.select_cursor], 0
jne .core_32.hardware_cursor
;--------------------------------------
.core_32.software_cursor:
align 4
.outer32:
xor ecx, ecx
align 4
.inner32:
cmp [ebp+ecx], bl
cmp [ebp], bl
jne .skip
;--------------------------------------
push eax
mov eax, [esi+ecx*4]
mov eax, [esi]
; check for hardware cursor
cmp [_display.select_cursor], select_cursor
je @f
cmp [_display.select_cursor], 0
jne .no_mouseunder
;--------------------------------------
align 4
@@:
push ecx
mov ecx, [esp+4]
ror ecx, 16
sub ecx, edx
rol ecx, 16
sub ecx, [esp+BLITTER.h + 8]
mov ecx, [esp+.position]
; check mouse area for putpixel
call [_display.check_mouse]
pop ecx
;--------------------------------------
align 4
.no_mouseunder:
; store to real LFB
mov [LFB_BASE+edi+ecx*4], eax
pop eax
mov [LFB_BASE+edi], eax
;--------------------------------------
align 4
.skip:
inc ecx
add esi, 4
add edi, 4
inc ebp
add [esp+.position], 1 shl 16
dec edx
jnz .inner32
@ -349,14 +350,48 @@ align 4
add ebp, [_display.width]
mov edx, [esp+BLITTER.w]
mov eax, edx
inc [esp+.position]
sub ebp, edx
shl eax, 2
sub esi, eax
sub edi, eax
shl eax, 16-2
sub [esp+.position], eax
dec [esp+BLITTER.h]
jnz .outer32
jmp .done
.core_32.hardware_cursor:
align 4
.hw.outer32:
xor ecx, ecx
align 4
.hw.inner32:
cmp [ebp+ecx], bl
jne .hw.skip
mov eax, [esi+ecx*4]
mov [LFB_BASE+edi+ecx*4], eax
align 4
.hw.skip:
inc ecx
dec edx
jnz .hw.inner32
add esi, [esp+BLITTER.stride]
add edi, [_display.pitch]
add ebp, [_display.width]
mov edx, [esp+BLITTER.w]
dec [esp+BLITTER.h]
jnz .hw.outer32
.done:
; call [draw_pointer]
; call __sys_draw_pointer
.L57:
add esp, 72
add esp, .local_vars_size
pop ebx
pop esi
pop edi
@ -370,7 +405,7 @@ align 4
align 4
.outer24:
mov [esp+64], edi
mov [esp+.extra_var1], edi
xor ecx, ecx
align 4
@ -413,7 +448,7 @@ align 4
;--------------------------------------
align 4
.skip_1:
mov edi, [esp+64]
mov edi, [esp+.extra_var1]
inc ecx
dec edx
jnz .inner24

View File

@ -23,13 +23,6 @@ $Revision: 3606 $
; If you're planning to write your own video driver I suggest
; you replace the VESA12.INC file and see those instructions.
;Screen_Max_X equ 0xfe00
;Screen_Max_Y equ 0xfe04
;BytesPerScanLine equ 0xfe08
;LFBAddress equ 0xfe80
;ScreenBPP equ 0xfbf1
;-----------------------------------------------------------------------------
; getpixel