forked from KolibriOS/kolibrios
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:
parent
9de1536468
commit
8304dbb5d4
@ -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 ;;
|
;; 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_INVALID_CALL = 1 ; invalid input parameters
|
||||||
DISK_STATUS_NO_MEDIA = 2 ; no media present
|
DISK_STATUS_NO_MEDIA = 2 ; no media present
|
||||||
DISK_STATUS_END_OF_MEDIA = 3 ; end of media while reading/writing data
|
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.
|
; Driver flags. Represent bits in DISK.DriverFlags.
|
||||||
DISK_NO_INSERT_NOTIFICATION = 1
|
DISK_NO_INSERT_NOTIFICATION = 1
|
||||||
; Media flags. Represent bits in DISKMEDIAINFO.Flags.
|
; 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
|
; there are two distinct caches for a disk, one for "system" data,and the other
|
||||||
; for "application" data.
|
; for "application" data.
|
||||||
struct DISKCACHE
|
struct DISKCACHE
|
||||||
mutex MUTEX
|
|
||||||
; Lock to protect the cache.
|
|
||||||
; The following fields are inherited from data32.inc:cache_ideX.
|
; The following fields are inherited from data32.inc:cache_ideX.
|
||||||
pointer dd ?
|
pointer dd ?
|
||||||
data_size dd ? ; unused
|
data_size dd ? ; unused
|
||||||
@ -169,6 +168,8 @@ struct DISK
|
|||||||
; Pointer to array of .NumPartitions pointers to PARTITION structures.
|
; Pointer to array of .NumPartitions pointers to PARTITION structures.
|
||||||
cache_size dd ?
|
cache_size dd ?
|
||||||
; inherited from cache_ideX_size
|
; inherited from cache_ideX_size
|
||||||
|
CacheLock MUTEX
|
||||||
|
; Lock to protect both caches.
|
||||||
SysCache DISKCACHE
|
SysCache DISKCACHE
|
||||||
AppCache DISKCACHE
|
AppCache DISKCACHE
|
||||||
; Two caches for the disk.
|
; Two caches for the disk.
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -415,18 +415,21 @@ align 4
|
|||||||
terminate: ; terminate application
|
terminate: ; terminate application
|
||||||
destroy_thread:
|
destroy_thread:
|
||||||
|
|
||||||
.slot equ esp ;locals
|
.slot equ esp+4 ;locals
|
||||||
|
.process equ esp ;ptr to parent process
|
||||||
|
|
||||||
push esi ;save .slot
|
push esi ;save .slot
|
||||||
|
|
||||||
shl esi, 8
|
shl esi, 8
|
||||||
cmp [SLOT_BASE+esi+APPDATA.process], 0
|
mov edx, [SLOT_BASE+esi+APPDATA.process]
|
||||||
jne @F
|
test edx, edx
|
||||||
|
jnz @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
|
||||||
@@:
|
@@:
|
||||||
|
push edx ;save .process
|
||||||
lea edx, [SLOT_BASE+esi]
|
lea edx, [SLOT_BASE+esi]
|
||||||
call scheduler_remove_thread
|
call scheduler_remove_thread
|
||||||
call lock_application_table
|
call lock_application_table
|
||||||
@ -624,6 +627,9 @@ destroy_thread:
|
|||||||
je @F
|
je @F
|
||||||
call free_page
|
call free_page
|
||||||
@@:
|
@@:
|
||||||
|
lea ebx, [edi+APPDATA.list]
|
||||||
|
list_del ebx ;destroys edx, ecx
|
||||||
|
|
||||||
mov eax, 0x20202020
|
mov eax, 0x20202020
|
||||||
stosd
|
stosd
|
||||||
stosd
|
stosd
|
||||||
@ -740,8 +746,19 @@ destroy_thread:
|
|||||||
jmp .xd0
|
jmp .xd0
|
||||||
.xd1:
|
.xd1:
|
||||||
;release slot
|
;release slot
|
||||||
|
|
||||||
|
xchg bx, bx
|
||||||
|
|
||||||
bts [thr_slot_map], esi
|
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
|
sti ; .. and life goes on
|
||||||
|
|
||||||
mov eax, [draw_limits.left]
|
mov eax, [draw_limits.left]
|
||||||
@ -756,9 +773,12 @@ destroy_thread:
|
|||||||
call unlock_application_table
|
call unlock_application_table
|
||||||
;mov esi,process_terminated
|
;mov esi,process_terminated
|
||||||
;call sys_msg_board_str
|
;call sys_msg_board_str
|
||||||
add esp, 4
|
add esp, 8
|
||||||
ret
|
ret
|
||||||
restore .slot
|
restore .slot
|
||||||
|
restore .process
|
||||||
|
|
||||||
|
msg_process_destroy: db 'K: destroy process', 0x0d, 0x0a,0
|
||||||
|
|
||||||
|
|
||||||
; Three following procedures are used to guarantee that
|
; Three following procedures are used to guarantee that
|
||||||
|
@ -262,6 +262,10 @@ proc fs_execute
|
|||||||
mov ebx, [slot_base]
|
mov ebx, [slot_base]
|
||||||
mov [ebx+APPDATA.process], eax
|
mov [ebx+APPDATA.process], eax
|
||||||
|
|
||||||
|
lea edx, [ebx+APPDATA.list]
|
||||||
|
lea ecx, [eax+PROC.thr_list]
|
||||||
|
list_add_tail edx, ecx
|
||||||
|
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
cmp word [6], '02'
|
cmp word [6], '02'
|
||||||
jne @f
|
jne @f
|
||||||
@ -980,6 +984,10 @@ proc new_sys_threads
|
|||||||
mov eax, [ebx+APPDATA.process]
|
mov eax, [ebx+APPDATA.process]
|
||||||
mov [edx+APPDATA.process], eax
|
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]
|
mov eax, [ebx+APPDATA.tls_base]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz @F
|
jz @F
|
||||||
|
@ -74,6 +74,8 @@ include 'struct.inc'
|
|||||||
$Revision: 4381 $
|
$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
|
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
|
VESA_1_2_VIDEO equ 0 ; enable vesa 1.2 bank switch functions
|
||||||
|
|
||||||
|
@ -119,13 +119,12 @@ struct APPDATA
|
|||||||
app_name rb 11
|
app_name rb 11
|
||||||
rb 5
|
rb 5
|
||||||
|
|
||||||
process dd ? ;+16
|
list LHEAD ;+16
|
||||||
fpu_state dd ? ;+20
|
process dd ? ;+24
|
||||||
exc_handler dd ? ;+24
|
fpu_state dd ? ;+28
|
||||||
except_mask dd ? ;+28
|
exc_handler dd ? ;+32
|
||||||
pl0_stack dd ? ;+32
|
except_mask dd ? ;+36
|
||||||
dd ? ;+36
|
pl0_stack dd ? ;+40
|
||||||
dd ? ;+40
|
|
||||||
cursor dd ? ;+44
|
cursor dd ? ;+44
|
||||||
fd_ev dd ? ;+48
|
fd_ev dd ? ;+48
|
||||||
bk_ev dd ? ;+52
|
bk_ev dd ? ;+52
|
||||||
|
@ -117,10 +117,10 @@ macro list_add_tail new, head
|
|||||||
|
|
||||||
macro list_del entry
|
macro list_del entry
|
||||||
{
|
{
|
||||||
mov edx, [entry+list_fd]
|
mov edx, [entry+LHEAD.next]
|
||||||
mov ecx, [entry+list_bk]
|
mov ecx, [entry+LHEAD.prev]
|
||||||
mov [edx+list_bk], ecx
|
mov [edx+LHEAD.prev], ecx
|
||||||
mov [ecx+list_fd], edx
|
mov [ecx+LHEAD.next], edx
|
||||||
}
|
}
|
||||||
|
|
||||||
; MOV Immediate.
|
; MOV Immediate.
|
||||||
|
@ -2210,6 +2210,8 @@ SOCKET_check_owner:
|
|||||||
align 4
|
align 4
|
||||||
SOCKET_process_end:
|
SOCKET_process_end:
|
||||||
|
|
||||||
|
ret ; FIXME
|
||||||
|
|
||||||
cmp [net_sockets + SOCKET.NextPtr], 0 ; Are there any active sockets at all?
|
cmp [net_sockets + SOCKET.NextPtr], 0 ; Are there any active sockets at all?
|
||||||
je .quickret ; nope, exit immediately
|
je .quickret ; nope, exit immediately
|
||||||
|
|
||||||
|
@ -206,7 +206,13 @@ blit_32:
|
|||||||
push edi
|
push edi
|
||||||
push esi
|
push esi
|
||||||
push ebx
|
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 eax, [TASK_BASE]
|
||||||
mov ebx, [eax-twdw + WDATA.box.width]
|
mov ebx, [eax-twdw + WDATA.box.width]
|
||||||
@ -246,9 +252,9 @@ blit_32:
|
|||||||
|
|
||||||
|
|
||||||
mov eax, [ecx+32]
|
mov eax, [ecx+32]
|
||||||
mov [esp+56], eax
|
mov [esp+BLITTER.bitmap], eax
|
||||||
mov eax, [ecx+36]
|
mov eax, [ecx+36]
|
||||||
mov [esp+60], eax
|
mov [esp+BLITTER.stride], eax
|
||||||
|
|
||||||
mov ecx, esp
|
mov ecx, esp
|
||||||
call blit_clip
|
call blit_clip
|
||||||
@ -268,6 +274,11 @@ blit_32:
|
|||||||
mov cx, bp
|
mov cx, bp
|
||||||
add ecx, [esp+BLITTER.h]
|
add ecx, [esp+BLITTER.h]
|
||||||
|
|
||||||
|
mov eax, ebx
|
||||||
|
shl eax, 16
|
||||||
|
mov ax, bp
|
||||||
|
mov [esp+.position], eax
|
||||||
|
|
||||||
mov edi, ebp
|
mov edi, ebp
|
||||||
|
|
||||||
; imul edi, [_display.pitch]
|
; imul edi, [_display.pitch]
|
||||||
@ -300,47 +311,37 @@ blit_32:
|
|||||||
lea edi, [edi+ebx*4]
|
lea edi, [edi+ebx*4]
|
||||||
|
|
||||||
mov ebx, [CURRENT_TASK]
|
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
|
align 4
|
||||||
.outer32:
|
.outer32:
|
||||||
xor ecx, ecx
|
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
.inner32:
|
.inner32:
|
||||||
cmp [ebp+ecx], bl
|
cmp [ebp], bl
|
||||||
jne .skip
|
jne .skip
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
push eax
|
mov eax, [esi]
|
||||||
mov eax, [esi+ecx*4]
|
|
||||||
|
|
||||||
; check for hardware cursor
|
mov ecx, [esp+.position]
|
||||||
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]
|
|
||||||
|
|
||||||
; check mouse area for putpixel
|
; check mouse area for putpixel
|
||||||
call [_display.check_mouse]
|
call [_display.check_mouse]
|
||||||
pop ecx
|
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
|
||||||
.no_mouseunder:
|
|
||||||
; store to real LFB
|
; store to real LFB
|
||||||
mov [LFB_BASE+edi+ecx*4], eax
|
mov [LFB_BASE+edi], eax
|
||||||
pop eax
|
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
.skip:
|
.skip:
|
||||||
inc ecx
|
add esi, 4
|
||||||
|
add edi, 4
|
||||||
|
inc ebp
|
||||||
|
add [esp+.position], 1 shl 16
|
||||||
dec edx
|
dec edx
|
||||||
jnz .inner32
|
jnz .inner32
|
||||||
|
|
||||||
@ -349,14 +350,48 @@ align 4
|
|||||||
add ebp, [_display.width]
|
add ebp, [_display.width]
|
||||||
|
|
||||||
mov edx, [esp+BLITTER.w]
|
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]
|
dec [esp+BLITTER.h]
|
||||||
jnz .outer32
|
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:
|
.done:
|
||||||
; call [draw_pointer]
|
; call [draw_pointer]
|
||||||
; call __sys_draw_pointer
|
; call __sys_draw_pointer
|
||||||
.L57:
|
.L57:
|
||||||
add esp, 72
|
add esp, .local_vars_size
|
||||||
pop ebx
|
pop ebx
|
||||||
pop esi
|
pop esi
|
||||||
pop edi
|
pop edi
|
||||||
@ -370,7 +405,7 @@ align 4
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
.outer24:
|
.outer24:
|
||||||
mov [esp+64], edi
|
mov [esp+.extra_var1], edi
|
||||||
xor ecx, ecx
|
xor ecx, ecx
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
@ -413,7 +448,7 @@ align 4
|
|||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
.skip_1:
|
.skip_1:
|
||||||
mov edi, [esp+64]
|
mov edi, [esp+.extra_var1]
|
||||||
inc ecx
|
inc ecx
|
||||||
dec edx
|
dec edx
|
||||||
jnz .inner24
|
jnz .inner24
|
||||||
|
@ -23,13 +23,6 @@ $Revision: 3606 $
|
|||||||
; If you're planning to write your own video driver I suggest
|
; If you're planning to write your own video driver I suggest
|
||||||
; you replace the VESA12.INC file and see those instructions.
|
; 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
|
; getpixel
|
||||||
|
Loading…
Reference in New Issue
Block a user