forked from KolibriOS/kolibrios
Introduced APPDATA, TASKDATA, WNDDATA, RECT, BOX structures.
git-svn-id: svn://kolibrios.org@115 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -21,7 +21,7 @@ debug_set_event_data:
|
||||
; destroys eax
|
||||
mov eax, [0x3000]
|
||||
shl eax, 8
|
||||
mov [eax+0x80000+0xBC], ebx
|
||||
mov [eax+0x80000+APPDATA.dbg_event_mem], ebx
|
||||
ret
|
||||
|
||||
get_debuggee_slot:
|
||||
@@ -37,7 +37,7 @@ get_debuggee_slot:
|
||||
shl eax, 5
|
||||
push ebx
|
||||
mov ebx, [0x3000]
|
||||
cmp [0x80000+eax*8+0xAC], ebx
|
||||
cmp [0x80000+eax*8+APPDATA.debugger_slot], ebx
|
||||
pop ebx
|
||||
jnz .ret_bad
|
||||
; clc ; automatically
|
||||
@@ -51,7 +51,7 @@ debug_detach:
|
||||
; destroys eax,ebx
|
||||
call get_debuggee_slot
|
||||
jc .ret
|
||||
and dword [eax*8+0x80000+0xAC], 0
|
||||
and dword [eax*8+0x80000+APPDATA.debugger_slot], 0
|
||||
call do_resume
|
||||
.ret:
|
||||
sti
|
||||
@@ -72,13 +72,13 @@ debug_suspend:
|
||||
; destroys eax,ebx
|
||||
call get_debuggee_slot
|
||||
jc .ret
|
||||
mov bl, [0x3000+eax+0xA] ; process state
|
||||
mov bl, [0x3000+eax+TASKDATA.state] ; process state
|
||||
test bl, bl
|
||||
jz .1
|
||||
cmp bl, 5
|
||||
jnz .ret
|
||||
mov bl, 2
|
||||
.2: mov [0x3000+eax+0xA], bl
|
||||
.2: mov [0x3000+eax+TASKDATA.state], bl
|
||||
.ret:
|
||||
sti
|
||||
ret
|
||||
@@ -87,13 +87,13 @@ debug_suspend:
|
||||
jmp .2
|
||||
|
||||
do_resume:
|
||||
mov bl, [0x3000+eax+0xA]
|
||||
mov bl, [0x3000+eax+TASKDATA.state]
|
||||
cmp bl, 1
|
||||
jz .1
|
||||
cmp bl, 2
|
||||
jnz .ret
|
||||
mov bl, 5
|
||||
.2: mov [0x3000+eax+0xA], bl
|
||||
.2: mov [0x3000+eax+TASKDATA.state], bl
|
||||
.ret: ret
|
||||
.1: dec ebx
|
||||
jmp .2
|
||||
@@ -227,7 +227,7 @@ debug_set_drx:
|
||||
call get_debuggee_slot
|
||||
jc .errret
|
||||
mov ebp, eax
|
||||
lea eax, [eax*8+0x80000+0xC0]
|
||||
lea eax, [eax*8+0x80000+APPDATA.dbg_regs]
|
||||
; [eax]=dr0, [eax+4]=dr1, [eax+8]=dr2, [eax+C]=dr3
|
||||
; [eax+10]=dr7
|
||||
add edx, std_application_base_address
|
||||
@@ -358,7 +358,7 @@ debugger_notify:
|
||||
.1:
|
||||
mov eax, ebp
|
||||
shl eax, 8
|
||||
mov edx, [0x80000+eax+0xBC]
|
||||
mov edx, [0x80000+eax+APPDATA.dbg_event_mem]
|
||||
test edx, edx
|
||||
jz .ret
|
||||
; read buffer header
|
||||
@@ -414,7 +414,7 @@ debugger_notify:
|
||||
; new debug event
|
||||
mov eax, ebp
|
||||
shl eax, 8
|
||||
or byte [0x80000+eax+0xA8+1], 1 ; set flag 100h
|
||||
or byte [0x80000+eax+APPDATA.event_mask+1], 1 ; set flag 100h
|
||||
.ret:
|
||||
ret
|
||||
|
||||
@@ -432,7 +432,7 @@ debug_exc:
|
||||
; set DRx registers for task and continue
|
||||
mov eax, [0x3000]
|
||||
shl eax, 8
|
||||
add eax, 0x80000+0xC0
|
||||
add eax, 0x80000+APPDATA.dbg_regs
|
||||
mov ecx, [eax+0]
|
||||
mov dr0, ecx
|
||||
mov ecx, [eax+4]
|
||||
@@ -455,7 +455,7 @@ debug_exc:
|
||||
cli
|
||||
mov eax, [0x3000]
|
||||
shl eax, 8
|
||||
mov eax, [0x80000+eax+0xAC]
|
||||
mov eax, [0x80000+eax+APPDATA.debugger_slot]
|
||||
test eax, eax
|
||||
jnz .debug
|
||||
sti
|
||||
@@ -464,7 +464,7 @@ debug_exc:
|
||||
mov [error_interrupt], 1
|
||||
call show_error_parameters
|
||||
mov edx, [0x3010]
|
||||
mov byte [edx+0xA], 4
|
||||
mov byte [edx+TASKDATA.state], 4
|
||||
jmp change_task
|
||||
.debug:
|
||||
; we are debugged process, notify debugger and suspend ourself
|
||||
@@ -484,7 +484,7 @@ debug_exc:
|
||||
jnz .l1
|
||||
push edx ; DR6 image
|
||||
mov ecx, [0x3010]
|
||||
push dword [ecx+4] ; PID
|
||||
push dword [ecx+TASKDATA.pid] ; PID
|
||||
push 12
|
||||
pop ecx
|
||||
push 3 ; 3 = debug exception
|
||||
@@ -493,7 +493,7 @@ debug_exc:
|
||||
pop ecx
|
||||
pop ecx
|
||||
mov edx, [0x3010]
|
||||
mov byte [edx+0xA], 1 ; suspended
|
||||
mov byte [edx+TASKDATA.state], 1 ; suspended
|
||||
call change_task
|
||||
restore_ring3_context
|
||||
iretd
|
||||
|
@@ -188,7 +188,7 @@ create_app_cr3_table:
|
||||
mov eax,[general_page_table]
|
||||
call simple_clone_cr3_table ;clone general page table
|
||||
shl ebx,8
|
||||
mov [second_base_address+0x80000+ebx+0xB8],eax ;save address of page directory
|
||||
mov [second_base_address+0x80000+ebx+APPDATA.dir_table],eax ;save address of page directory
|
||||
|
||||
pop ebx
|
||||
ret
|
||||
@@ -199,7 +199,7 @@ get_cr3_table:
|
||||
;result:
|
||||
; eax - physical address of page directory
|
||||
shl eax,8 ;size of process extended information=256 bytes
|
||||
mov eax,[second_base_address+0x80000+eax+0xB8]
|
||||
mov eax,[second_base_address+0x80000+eax+APPDATA.dir_table]
|
||||
ret
|
||||
;-----------------------------------------------------------------------------
|
||||
dispose_app_cr3_table:
|
||||
@@ -213,7 +213,7 @@ dispose_app_cr3_table:
|
||||
mov ebp,eax
|
||||
;ebp = process slot in the procedure.
|
||||
shl eax,8
|
||||
mov eax,[second_base_address+0x80000+eax+0xB8]
|
||||
mov eax,[second_base_address+0x80000+eax+APPDATA.dir_table]
|
||||
mov ebx,eax
|
||||
;ebx = physical address of page directory
|
||||
call MEM_Get_Linear_Address
|
||||
@@ -234,10 +234,10 @@ dispose_app_cr3_table:
|
||||
;eax = current slot of process
|
||||
mov ecx,eax
|
||||
shl ecx,5
|
||||
cmp byte [second_base_address+0x3000+ecx+0xa],9 ;if process running?
|
||||
cmp byte [second_base_address+0x3000+ecx+TASKDATA.state],9 ;if process running?
|
||||
jz .next ;skip empty slots
|
||||
shl ecx,3
|
||||
cmp [second_base_address+0x80000+ecx+0xB8],ebx ;compare page directory addresses
|
||||
cmp [second_base_address+0x80000+ecx+APPDATA.dir_table],ebx ;compare page directory addresses
|
||||
jnz .next
|
||||
inc edx ;thread found
|
||||
.next:
|
||||
|
@@ -33,7 +33,7 @@ find_new_process_place:
|
||||
cmp eax,ebx
|
||||
jz .endnewprocessplace ;empty slot after high boundary
|
||||
add eax,0x20
|
||||
cmp word [eax+0xa],9 ;check process state, 9 means that process slot is empty
|
||||
cmp word [eax+TASKDATA.state],9 ;check process state, 9 means that process slot is empty
|
||||
jnz .newprocessplace
|
||||
.endnewprocessplace:
|
||||
mov ebx,eax
|
||||
@@ -41,7 +41,7 @@ find_new_process_place:
|
||||
shr eax,5 ;calculate slot index
|
||||
cmp eax,256
|
||||
jge .failed ;it should be <256
|
||||
mov word [ebx+0xa],9 ;set process state to 9 (for slot after hight boundary)
|
||||
mov word [ebx+TASKDATA.state],9 ;set process state to 9 (for slot after hight boundary)
|
||||
mov [new_process_place],eax ;save process slot
|
||||
pop ebx
|
||||
ret
|
||||
@@ -113,7 +113,7 @@ new_start_application_floppy:
|
||||
; mov eax,[esp] ;eax - pointer to file name
|
||||
mov ebx,[new_process_place]
|
||||
shl ebx,8
|
||||
add ebx,0x80000
|
||||
add ebx,0x80000 + APPDATA.app_name
|
||||
mov ecx,11
|
||||
call memmove
|
||||
|
||||
@@ -207,7 +207,7 @@ new_start_application_floppy:
|
||||
;so free directory entry
|
||||
mov eax,[new_process_place]
|
||||
shl eax,8
|
||||
mov eax,[0x80000+eax+0xB8]
|
||||
mov eax,[0x80000+eax+APPDATA.dir_table]
|
||||
call MEM_Free_Page
|
||||
.cleanfailed_mem:
|
||||
;there is no mem for directory entry, display message.
|
||||
@@ -219,7 +219,7 @@ new_start_application_floppy:
|
||||
;this avoid problems with panel application.
|
||||
mov edi,[new_process_place]
|
||||
shl edi,8
|
||||
add edi,0x80000
|
||||
add edi,0x80000 + APPDATA.app_name
|
||||
mov ecx,11
|
||||
mov eax,' '
|
||||
cld
|
||||
@@ -280,7 +280,7 @@ new_start_application_fl:
|
||||
mov eax,[esp] ;eax - pointer to file name
|
||||
mov ebx,[new_process_place]
|
||||
shl ebx,8
|
||||
add ebx,0x80000
|
||||
add ebx,0x80000 + APPDATA.app_name
|
||||
mov ecx,11
|
||||
call memmove
|
||||
|
||||
@@ -371,7 +371,7 @@ new_start_application_fl:
|
||||
;so free directory entry
|
||||
mov eax,[new_process_place]
|
||||
shl eax,8
|
||||
mov eax,[0x80000+eax+0xB8]
|
||||
mov eax,[0x80000+eax+APPDATA.dir_table]
|
||||
call MEM_Free_Page
|
||||
.cleanfailed_mem:
|
||||
;there is no mem for directory entry, display message.
|
||||
@@ -383,7 +383,7 @@ new_start_application_fl:
|
||||
;this avoid problems with panel application.
|
||||
mov edi,[new_process_place]
|
||||
shl edi,8
|
||||
add edi,0x80000
|
||||
add edi,0x80000+APPDATA.app_name
|
||||
mov ecx,11
|
||||
mov eax,' '
|
||||
cld
|
||||
@@ -417,13 +417,13 @@ new_start_application_fl:
|
||||
;(size of application memory)
|
||||
shl ebx,8
|
||||
mov eax,[app_mem]
|
||||
mov [second_base_address+0x80000+0x8c+ebx],eax
|
||||
mov [second_base_address+0x80000+APPDATA.mem_size+ebx],eax
|
||||
;set 0x10 field of information about process
|
||||
;(application base address)
|
||||
; mov ebx,[new_process_place]
|
||||
; shl ebx,5
|
||||
shr ebx,3
|
||||
mov dword [second_base_address+0x3000+ebx+0x10],std_application_base_address
|
||||
mov dword [second_base_address+0x3000+ebx+TASKDATA.mem_start],std_application_base_address
|
||||
|
||||
;add command line parameters
|
||||
.add_command_line:
|
||||
@@ -466,29 +466,29 @@ new_start_application_fl:
|
||||
mov eax,ebx
|
||||
shl ebx,5
|
||||
add ebx,0x3000 ;ebx - pointer to information about process
|
||||
mov [ebx+0xe],al ;set window number on screen = process slot
|
||||
mov [ebx+TASKDATA.wnd_number],al ;set window number on screen = process slot
|
||||
|
||||
mov [ebx],dword 1+2+4 ;set default event flags (see 40 function)
|
||||
mov [ebx+TASKDATA.event_mask],dword 1+2+4 ;set default event flags (see 40 function)
|
||||
|
||||
inc dword [process_number]
|
||||
mov eax,[process_number]
|
||||
mov [ebx+4],eax ;set PID
|
||||
mov [ebx+TASKDATA.pid],eax ;set PID
|
||||
|
||||
mov ecx,ebx
|
||||
add ecx,draw_data-0x3000 ;ecx - pointer to draw data
|
||||
;set draw data to full screen
|
||||
mov [ecx+0],dword 0
|
||||
mov [ecx+4],dword 0
|
||||
mov [ecx+RECT.left],dword 0
|
||||
mov [ecx+RECT.top],dword 0
|
||||
mov eax,[0xfe00]
|
||||
mov [ecx+8],eax
|
||||
mov [ecx+RECT.right],eax
|
||||
mov eax,[0xfe04]
|
||||
mov [ecx+12],eax
|
||||
mov [ecx+RECT.bottom],eax
|
||||
;set window state to 'normal' (non-minimized/maximized/rolled-up) state
|
||||
mov [ecx+WDATA.fl_wstate],WSTATE_NORMAL
|
||||
;set cr3 register in TSS of application
|
||||
mov ecx,[new_process_place]
|
||||
shl ecx,8
|
||||
mov eax,[0x800B8+ecx]
|
||||
mov eax,[0x80000+APPDATA.dir_table+ecx]
|
||||
add eax,8+16 ;add flags
|
||||
mov [l.cr3],eax
|
||||
|
||||
@@ -566,12 +566,12 @@ new_start_application_fl:
|
||||
; set if debuggee
|
||||
test byte [esp+28], 1
|
||||
jz .no_debug
|
||||
mov [0x3000+ebx+0xa], byte 1 ; set process state - suspended
|
||||
mov [0x3000+ebx+TASKDATA.state], 1 ; set process state - suspended
|
||||
mov eax, [0x3000]
|
||||
mov [0x80000+ebx*8+0xac], eax ;set debugger PID - current
|
||||
mov [0x80000+ebx*8+APPDATA.debugger_slot], eax ;set debugger PID - current
|
||||
jmp .debug
|
||||
.no_debug:
|
||||
mov [0x3000+ebx+0xa], byte 0 ; set process state - running
|
||||
mov [0x3000+ebx+TASKDATA.state], 0 ; set process state - running
|
||||
.debug:
|
||||
|
||||
mov esi,new_process_running
|
||||
@@ -622,22 +622,22 @@ new_sys_threads:
|
||||
|
||||
mov esi,[0x3000]
|
||||
shl esi,8
|
||||
add esi,0x80000
|
||||
add esi,0x80000+APPDATA.app_name
|
||||
mov ebx,esi ;ebx=esi - pointer to extended information about current thread
|
||||
|
||||
mov edi,[new_process_place]
|
||||
shl edi,8
|
||||
add edi,0x80000
|
||||
mov edx,edi ;edx=edi - pointer to extended infomation about new thread
|
||||
lea edx, [edi+APPDATA.app_name] ;edx=edi - pointer to extended infomation about new thread
|
||||
mov ecx,256/4
|
||||
rep stosd ;clean extended information about new thread
|
||||
mov edi,edx
|
||||
mov ecx,11
|
||||
rep movsb ;copy process name
|
||||
mov eax,[ebx+0x8c]
|
||||
mov eax,[ebx+APPDATA.mem_size]
|
||||
mov [app_mem],eax ;set memory size
|
||||
mov eax,[ebx+0xb8]
|
||||
mov [edx+0xb8],eax ;copy page directory
|
||||
mov eax,[ebx+APPDATA.dir_table]
|
||||
mov dword [edx-APPDATA.app_name+APPDATA.dir_table],eax ;copy page directory
|
||||
; mov eax,[new_process_place]
|
||||
; mov ebx,[0x3000]
|
||||
; call addreference_app_cr3_table
|
||||
@@ -669,10 +669,10 @@ new_mem_resize:
|
||||
and ebx,not (4096-1) ;round up size
|
||||
mov ecx,[0x3000]
|
||||
shl ecx,8
|
||||
mov edx,[0x8008C+ecx]
|
||||
mov edx,[0x80000 + APPDATA.mem_size +ecx]
|
||||
add edx,4095
|
||||
and edx,not (4096-1) ;old size
|
||||
mov eax,[0x800B8+ecx]
|
||||
mov eax,[0x80000 + APPDATA.dir_table+ecx]
|
||||
call MEM_Get_Linear_Address
|
||||
;eax - linear address of page directory
|
||||
call MEM_Heap_Lock ;guarantee that two threads willn't
|
||||
@@ -704,10 +704,10 @@ new_mem_resize:
|
||||
mov ebx,esi
|
||||
mov eax,[0x3000]
|
||||
shl eax,8
|
||||
mov [eax+0x8008c],ebx ;write new memory size
|
||||
mov [eax+0x80000 + APPDATA.mem_size],ebx ;write new memory size
|
||||
;search threads and update
|
||||
;application memory size infomation
|
||||
mov ecx,[eax+0x800b8]
|
||||
mov ecx,[eax+0x80000 + APPDATA.dir_table]
|
||||
mov eax,2
|
||||
|
||||
.search_threads:
|
||||
@@ -718,12 +718,12 @@ new_mem_resize:
|
||||
jg .search_threads_end
|
||||
mov edx,eax
|
||||
shl edx,5
|
||||
cmp word [0x3000+edx+0xa],9 ;if slot empty?
|
||||
cmp word [0x3000+edx+TASKDATA.state],9 ;if slot empty?
|
||||
jz .search_threads_next
|
||||
shl edx,3
|
||||
cmp [edx+0x800b8],ecx ;if it is our thread?
|
||||
cmp [edx+0x80000+APPDATA.dir_table],ecx ;if it is our thread?
|
||||
jnz .search_threads_next
|
||||
mov [edx+0x8008c],ebx ;update memory size
|
||||
mov [edx+0x80000+APPDATA.mem_size],ebx ;update memory size
|
||||
.search_threads_next:
|
||||
inc eax
|
||||
jmp .search_threads
|
||||
@@ -753,9 +753,9 @@ pid_to_slot:
|
||||
.loop:
|
||||
;ecx=offset of current process info entry
|
||||
;ebx=maximum permitted offset
|
||||
cmp byte [second_base_address+0x3000+ecx+0xa],9
|
||||
cmp byte [second_base_address+0x3000+ecx+TASKDATA.state],9
|
||||
jz .endloop ;skip empty slots
|
||||
cmp [second_base_address+0x3000+ecx+0x4],eax ;check PID
|
||||
cmp [second_base_address+0x3000+ecx+TASKDATA.pid],eax ;check PID
|
||||
jz .pid_found
|
||||
.endloop:
|
||||
add ecx,32
|
||||
@@ -801,7 +801,7 @@ write_process_memory:
|
||||
; eax - number of bytes written
|
||||
pushad
|
||||
shl eax,8
|
||||
mov eax,[0x80000+eax+0xB8]
|
||||
mov eax,[0x80000+eax+APPDATA.dir_table]
|
||||
call MEM_Get_Linear_Address
|
||||
mov ebp,eax
|
||||
;ebp=linear address of page directory of other process.
|
||||
@@ -906,7 +906,7 @@ read_process_memory:
|
||||
; eax - number of bytes read.
|
||||
pushad
|
||||
shl eax,8
|
||||
mov eax,[0x80000+eax+0xB8]
|
||||
mov eax,[0x80000+eax+APPDATA.dir_table]
|
||||
call MEM_Get_Linear_Address
|
||||
mov ebp,eax
|
||||
add edx,std_application_base_address
|
||||
@@ -1009,10 +1009,10 @@ check_process_region:
|
||||
test ecx,ecx
|
||||
jle .ok
|
||||
shl eax,5
|
||||
cmp word [0x3000+eax+0xa],0
|
||||
cmp word [0x3000+eax+TASKDATA.state],0
|
||||
jnz .failed
|
||||
shl eax,3
|
||||
mov eax,[0x80000+eax+0xb8]
|
||||
mov eax,[0x80000+eax+APPDATA.dir_table]
|
||||
test eax,eax
|
||||
jz .failed
|
||||
call MEM_Get_Linear_Address
|
||||
@@ -1081,8 +1081,8 @@ new_sys_ipc:
|
||||
shl edi,8
|
||||
add edi,0x80000
|
||||
cli
|
||||
mov [edi+0xA0],ebx ;set fields in extended information area
|
||||
mov [edi+0xA4],ecx
|
||||
mov [edi+APPDATA.ipc_start],ebx ;set fields in extended information area
|
||||
mov [edi+APPDATA.ipc_size],ecx
|
||||
sti
|
||||
mov [esp+36],dword 0 ;success
|
||||
ret
|
||||
@@ -1100,10 +1100,10 @@ new_sys_ipc:
|
||||
mov ebp,eax
|
||||
;ebp = slot of other process
|
||||
shl eax,8
|
||||
mov edi,[eax+0x80000+0xa0] ;is ipc area defined?
|
||||
mov edi,[eax+0x80000+APPDATA.ipc_start] ;is ipc area defined?
|
||||
test edi,edi
|
||||
jz .no_ipc_area
|
||||
mov esi,[eax+0x80000+0xa4] ;esi - size of buffer
|
||||
mov esi,[eax+0x80000+APPDATA.ipc_size] ;esi - size of buffer
|
||||
push dword -1 ;temp variable for read_process_memory
|
||||
mov ebx,esp
|
||||
push ecx
|
||||
@@ -1131,7 +1131,7 @@ new_sys_ipc:
|
||||
add edx,esi
|
||||
sub edx,4 ;move to beginning of place for our message
|
||||
mov eax,[second_base_address+0x3010]
|
||||
mov eax,[eax+0x4] ;eax - our PID
|
||||
mov eax,[eax+TASKDATA.pid] ;eax - our PID
|
||||
mov [esp+8],eax
|
||||
mov eax,ebp
|
||||
call write_process_memory ;write PID
|
||||
@@ -1151,7 +1151,7 @@ new_sys_ipc:
|
||||
;awake other process
|
||||
shl ebp,8
|
||||
mov eax,ebp
|
||||
or [eax+0x800A8],dword 0x40
|
||||
or [eax+0x80000+APPDATA.event_mask],dword 0x40
|
||||
|
||||
cmp dword [check_idle_semaphore],20
|
||||
jge .ipc_no_cis
|
||||
@@ -1237,7 +1237,7 @@ new_start_application_hd:
|
||||
lea esi,[eax-11] ;last 11 bytes = application name
|
||||
mov edi,[new_process_place]
|
||||
shl edi,8
|
||||
add edi,0x80000
|
||||
add edi,0x80000+APPDATA.app_name
|
||||
mov ecx,11
|
||||
cld
|
||||
rep movsb ;copy name to extended information about process
|
||||
@@ -1366,7 +1366,7 @@ new_start_application_hd:
|
||||
;so free directory entry
|
||||
mov eax,[new_process_place]
|
||||
shl eax,8
|
||||
mov eax,[0x80000+eax+0xB8]
|
||||
mov eax,[0x80000+eax+APPDATA.dir_table]
|
||||
call MEM_Free_Page
|
||||
.cleanfailed_mem:
|
||||
;there is no mem for directory entry, display message.
|
||||
@@ -1378,7 +1378,7 @@ new_start_application_hd:
|
||||
;this avoid problems with panel application.
|
||||
mov edi,[new_process_place]
|
||||
shl edi,8
|
||||
add edi,0x80000
|
||||
add edi,0x80000+APPDATA.app_name
|
||||
mov ecx,11
|
||||
mov eax,' '
|
||||
cld
|
||||
@@ -1455,7 +1455,7 @@ fs_execute:
|
||||
mov ecx, 8 ; 8 chars for name
|
||||
mov edi, [new_process_place]
|
||||
shl edi, cl
|
||||
add edi, 0x80000
|
||||
add edi, 0x80000+APPDATA.app_name
|
||||
.copy_process_name_loop:
|
||||
lodsb
|
||||
cmp al, '.'
|
||||
@@ -1600,7 +1600,7 @@ fs_execute:
|
||||
; clean process name, this avoid problems with @panel
|
||||
mov edi, [new_process_place]
|
||||
shl edi, 8
|
||||
add edi, 0x80000
|
||||
add edi, 0x80000+APPDATA.app_name
|
||||
mov ecx, 11
|
||||
mov al, ' '
|
||||
rep stosb
|
||||
|
@@ -95,7 +95,7 @@ Allocate_Physical_Block:
|
||||
mov eax,[esi+physical_mem_block.start]
|
||||
mov [esp+28],eax
|
||||
mov eax,[0x3010]
|
||||
mov eax,[eax+0x4]
|
||||
mov eax,[eax+TASKDATA.pid]
|
||||
mov [esi+physical_mem_block.flags],eax
|
||||
popad
|
||||
ret
|
||||
@@ -105,7 +105,7 @@ Allocate_Physical_Block:
|
||||
mov eax,[esi+physical_mem_block.start]
|
||||
mov [esp+28],eax
|
||||
mov ecx,[0x3010]
|
||||
mov ecx,[ecx+0x4]
|
||||
mov ecx,[ecx+TASKDATA.pid]
|
||||
mov [esi+physical_mem_block.flags],ecx
|
||||
mov ecx,[esi+physical_mem_block.size]
|
||||
mov [esi+physical_mem_block.size],ebx
|
||||
|
@@ -91,11 +91,11 @@ endg
|
||||
|
||||
update_counters:
|
||||
mov edi, [0x3010]
|
||||
mov ebx, [edi+0x18] ; time stamp counter add
|
||||
mov ebx, [edi+TASKDATA.counter_add] ; time stamp counter add
|
||||
call _rdtsc
|
||||
sub eax, ebx
|
||||
add eax, [edi+0x14] ; counter sum
|
||||
mov [edi+0x14], eax
|
||||
add eax, [edi+TASKDATA.counter_sum] ; counter sum
|
||||
mov [edi+TASKDATA.counter_sum], eax
|
||||
ret
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ find_next_task:
|
||||
add edi,0x20
|
||||
inc ebx
|
||||
|
||||
mov al, byte [edi+0xA]
|
||||
mov al, byte [edi+TASKDATA.state]
|
||||
test al, al
|
||||
jz .found
|
||||
cmp al, 1
|
||||
@@ -146,13 +146,13 @@ find_next_task:
|
||||
test eax, eax
|
||||
jz .waiting_for_event
|
||||
mov [event_sched], eax
|
||||
mov [edi+0xA], byte 0
|
||||
mov [edi+TASKDATA.state], byte 0
|
||||
.noevents:
|
||||
.found:
|
||||
mov [0x3000],ebx
|
||||
mov [0x3010],edi
|
||||
call _rdtsc
|
||||
mov [edi+0x18],eax
|
||||
mov [edi+TASKDATA.counter_add],eax
|
||||
|
||||
xor eax, eax
|
||||
cmp ebx, [prev_slot]
|
||||
@@ -181,9 +181,9 @@ updatecputimes:
|
||||
mov ecx, [0x3004]
|
||||
mov edi, 0x3020
|
||||
.newupdate:
|
||||
mov ebx,[edi+0x14]
|
||||
mov [edi+0x1c],ebx
|
||||
mov [edi+0x14],dword 0
|
||||
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
|
||||
|
@@ -27,7 +27,7 @@ start_wait=$
|
||||
ok=$
|
||||
push eax
|
||||
mov eax,dword [0x3010+second_base_address]
|
||||
mov eax,[eax+0x4]
|
||||
mov eax,[eax+TASKDATA.pid]
|
||||
mov [name],eax
|
||||
pop eax
|
||||
sti
|
||||
@@ -61,7 +61,7 @@ macro WaitSimpleCriticalSection name
|
||||
local start_wait,first_wait,inc_counter,end_wait
|
||||
push eax
|
||||
mov eax,[0x3010+second_base_address]
|
||||
mov eax,[eax+0x4]
|
||||
mov eax,[eax+TASKDATA.pid]
|
||||
start_wait=$
|
||||
cli
|
||||
cmp [name],dword 0
|
||||
@@ -93,7 +93,7 @@ macro TryWaitSimpleCriticalSection name ;result in eax and in flags
|
||||
{
|
||||
local ok,try_end
|
||||
mov eax,[0x3000+second_base_address]
|
||||
mov eax,[eax+0x4]
|
||||
mov eax,[eax+TASKDATA.pid]
|
||||
cmp [name],eax
|
||||
jz ok
|
||||
cmp [name],0
|
||||
|
@@ -228,7 +228,7 @@ exc_c:
|
||||
cli
|
||||
mov eax, [0x3000]
|
||||
shl eax, 8
|
||||
mov eax, [0x80000+eax+0xAC]
|
||||
mov eax, [0x80000+eax+APPDATA.debugger_slot]
|
||||
test eax, eax
|
||||
jnz .debug
|
||||
sti
|
||||
@@ -239,7 +239,7 @@ exc_c:
|
||||
call show_error_parameters
|
||||
|
||||
mov edx, [0x3010]
|
||||
mov [edx + 0xA], byte 4
|
||||
mov [edx + TASKDATA.state], byte 4
|
||||
|
||||
jmp change_task
|
||||
|
||||
@@ -250,7 +250,7 @@ exc_c:
|
||||
movzx ecx, bl
|
||||
push ecx
|
||||
mov ecx, [0x3010]
|
||||
push dword [ecx+4] ; PID of current process
|
||||
push dword [ecx+TASKDATA.pid] ; PID of current process
|
||||
push 12
|
||||
pop ecx
|
||||
push 1 ; 1=exception
|
||||
@@ -259,7 +259,7 @@ exc_c:
|
||||
pop ecx
|
||||
pop ecx
|
||||
mov edx, [0x3010]
|
||||
mov byte [edx+0xA], 1 ; suspended
|
||||
mov byte [edx+TASKDATA.state], 1 ; suspended
|
||||
call change_task
|
||||
restore_ring3_context
|
||||
iretd
|
||||
@@ -278,18 +278,18 @@ e7:
|
||||
|
||||
mov eax, [prev_user_of_fpu]
|
||||
shl eax, 8
|
||||
add eax, 0x80000 + 0x10
|
||||
add eax, 0x80000 + APPDATA.fpu_save_area
|
||||
fsave [eax]
|
||||
|
||||
mov eax, [0x3000]
|
||||
mov [prev_user_of_fpu], eax
|
||||
shl eax, 8
|
||||
add eax, 0x80000
|
||||
cmp [eax + 0x7f], byte 0
|
||||
cmp [eax + APPDATA.is_fpu_saved], 0
|
||||
je @f
|
||||
frstor [eax+0x10]
|
||||
frstor [eax+APPDATA.fpu_save_area]
|
||||
@@:
|
||||
mov [eax + 0x7f], byte 1
|
||||
mov [eax + APPDATA.is_fpu_saved], 1
|
||||
restore_ring3_context
|
||||
iret
|
||||
|
||||
@@ -338,7 +338,7 @@ show_error_parameters:
|
||||
mov [write_error_to],process_pid+43
|
||||
mov eax,[0x3000]
|
||||
shl eax, 5
|
||||
mov eax,[0x3000+4+eax]
|
||||
mov eax,[0x3000+TASKDATA.pid+eax]
|
||||
call writehex
|
||||
|
||||
mov [write_error_to],process_error+43
|
||||
@@ -556,7 +556,7 @@ set_application_table_status:
|
||||
|
||||
mov eax,[0x3000]
|
||||
shl eax, 5
|
||||
add eax,0x3000+4
|
||||
add eax,0x3000+TASKDATA.pid
|
||||
mov eax,[eax]
|
||||
|
||||
mov [application_table_status],eax
|
||||
@@ -571,7 +571,7 @@ clear_application_table_status:
|
||||
|
||||
mov eax,[0x3000]
|
||||
shl eax, 5
|
||||
add eax,0x3000+4
|
||||
add eax,0x3000+TASKDATA.pid
|
||||
mov eax,[eax]
|
||||
|
||||
cmp eax,[application_table_status]
|
||||
@@ -676,17 +676,17 @@ uglobal
|
||||
app_esp dd 0x0
|
||||
app_i_param dd 0x0
|
||||
app_i_icon dd 0x0
|
||||
app_mem_pos dd 0x0
|
||||
;app_mem_pos dd 0x0
|
||||
appl_path dd 0x0
|
||||
appl_path_size dd 0x0
|
||||
endg
|
||||
|
||||
iglobal
|
||||
hd_app_string db 'HDAPP '
|
||||
process_loading db 'K : Process - loading ',13,10,0
|
||||
process_running db 'K : Process - done',13,10,0
|
||||
first_gdt_search dd 0x2
|
||||
endg
|
||||
;iglobal
|
||||
;hd_app_string db 'HDAPP '
|
||||
;process_loading db 'K : Process - loading ',13,10,0
|
||||
;process_running db 'K : Process - done',13,10,0
|
||||
;first_gdt_search dd 0x2
|
||||
;endg
|
||||
|
||||
|
||||
sys_threads:
|
||||
@@ -812,10 +812,10 @@ terminate: ; terminate application
|
||||
mov [esi+WDATA.box.top],eax
|
||||
mov [esi+WDATA.box.height], 5
|
||||
xor eax, eax
|
||||
mov [esi+16],eax
|
||||
mov [esi+20],eax
|
||||
mov [esi+24],eax
|
||||
mov [esi+28],eax
|
||||
mov [esi+WDATA.cl_workarea],eax
|
||||
mov [esi+WDATA.cl_titlebar],eax
|
||||
mov [esi+WDATA.cl_frames],eax
|
||||
mov dword [esi+WDATA.reserved],eax ; clear all flags: wstate, redraw, wdrawn
|
||||
lea edi, [esi-window_data+draw_data]
|
||||
mov ecx,32/4
|
||||
rep stosd
|
||||
@@ -825,12 +825,12 @@ terminate: ; terminate application
|
||||
pushad
|
||||
mov edi, esi
|
||||
shl edi, 5
|
||||
mov eax, [0x80000+edi*8+0xAC]
|
||||
mov eax, [0x80000+edi*8+APPDATA.debugger_slot]
|
||||
test eax, eax
|
||||
jz .nodebug
|
||||
push 8
|
||||
pop ecx
|
||||
push dword [0x3000+edi+0x4] ; PID
|
||||
push dword [0x3000+edi+TASKDATA.pid] ; PID
|
||||
push 2
|
||||
call debugger_notify
|
||||
pop ecx
|
||||
@@ -850,7 +850,7 @@ terminate: ; terminate application
|
||||
pusha ; name to spaces
|
||||
mov edi,esi
|
||||
shl edi,8
|
||||
add edi,0x80000
|
||||
add edi,0x80000+APPDATA.app_name
|
||||
mov ecx,11
|
||||
mov eax,' '
|
||||
rep stosb
|
||||
@@ -869,7 +869,7 @@ terminate: ; terminate application
|
||||
lea esi, [0xc400+eax*2]
|
||||
movzx edi, word [esi] ; edi = process
|
||||
shl edi, 5
|
||||
cmp [0x3000 + edi + 0xa], byte 9 ; skip dead slots
|
||||
cmp [0x3000 + edi + TASKDATA.state], byte 9 ; skip dead slots
|
||||
je .check_next_window
|
||||
add edi, window_data
|
||||
call waredraw
|
||||
@@ -896,8 +896,8 @@ terminate: ; terminate application
|
||||
|
||||
pusha ; remove all irq reservations
|
||||
mov eax,esi
|
||||
shl eax, 5 ;imul edx,0x20
|
||||
mov eax,[edx+0x3000+4]
|
||||
shl eax, 5
|
||||
mov eax,[edx+0x3000+TASKDATA.pid]
|
||||
mov edi,irq_owner
|
||||
mov ecx,16
|
||||
newirqfree:
|
||||
@@ -911,9 +911,9 @@ terminate: ; terminate application
|
||||
|
||||
pusha ; remove all port reservations
|
||||
mov edx,esi
|
||||
shl edx, 5 ;imul edx,0x20
|
||||
shl edx, 5
|
||||
add edx,0x3000
|
||||
mov edx,[edx+4]
|
||||
mov edx,[edx+TASKDATA.pid]
|
||||
|
||||
rmpr0:
|
||||
|
||||
@@ -956,10 +956,10 @@ terminate: ; terminate application
|
||||
popa
|
||||
mov edi,esi ; do not run this process slot
|
||||
shl edi, 5
|
||||
mov [edi+0x300A],byte 9
|
||||
mov [edi+0x3000 + TASKDATA.state],byte 9
|
||||
; debugger test - terminate all debuggees
|
||||
mov eax, 2
|
||||
mov ecx, 0x80000+2*0x100+0xAC
|
||||
mov ecx, 0x80000+2*0x100+APPDATA.debugger_slot
|
||||
.xd0:
|
||||
cmp eax, [0x3004]
|
||||
ja .xd1
|
||||
|
@@ -40,7 +40,7 @@ i40:
|
||||
align 4
|
||||
save_registers:
|
||||
mov esi, [0x3010]
|
||||
mov eax, [esi+0x4] ; load PID
|
||||
mov eax, [esi+TASKDATA.pid] ; load PID
|
||||
lea esi, [esp+4]
|
||||
inc [save_syscall_count]
|
||||
mov edi,[save_syscall_count]
|
||||
|
Reference in New Issue
Block a user