forked from KolibriOS/kolibrios
kolibri-process:use [current_process] instead of [APPDATA.process]
git-svn-id: svn://kolibrios.org@4432 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
5fa7166ae5
commit
a7414ad7ff
@ -565,8 +565,7 @@ HEAP_TOP equ 0x80000000
|
|||||||
align 4
|
align 4
|
||||||
proc init_heap
|
proc init_heap
|
||||||
|
|
||||||
mov ebx, [current_slot]
|
mov ebx, [current_process]
|
||||||
mov ebx, [ebx+APPDATA.process]
|
|
||||||
mov eax, [ebx+PROC.heap_top]
|
mov eax, [ebx+PROC.heap_top]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz @F
|
jz @F
|
||||||
@ -602,8 +601,7 @@ proc user_alloc stdcall, alloc_size:dword
|
|||||||
add ecx, (4095+PAGE_SIZE)
|
add ecx, (4095+PAGE_SIZE)
|
||||||
and ecx, not 4095
|
and ecx, not 4095
|
||||||
|
|
||||||
mov ebx, [current_slot]
|
mov ebx, [current_process]
|
||||||
mov ebx, [ebx+APPDATA.process]
|
|
||||||
mov esi, dword [ebx+PROC.heap_base] ; heap_base
|
mov esi, dword [ebx+PROC.heap_base] ; heap_base
|
||||||
mov edi, dword [ebx+PROC.heap_top] ; heap_top
|
mov edi, dword [ebx+PROC.heap_top] ; heap_top
|
||||||
.scan:
|
.scan:
|
||||||
@ -639,9 +637,7 @@ proc user_alloc stdcall, alloc_size:dword
|
|||||||
jnz @B
|
jnz @B
|
||||||
.no:
|
.no:
|
||||||
|
|
||||||
mov edx, [current_slot]
|
mov edx, [current_process]
|
||||||
mov edx, [edx+APPDATA.process]
|
|
||||||
|
|
||||||
mov ebx, [alloc_size]
|
mov ebx, [alloc_size]
|
||||||
add ebx, 0xFFF
|
add ebx, 0xFFF
|
||||||
and ebx, not 0xFFF
|
and ebx, not 0xFFF
|
||||||
@ -676,8 +672,7 @@ proc user_alloc_at stdcall, address:dword, alloc_size:dword
|
|||||||
push esi
|
push esi
|
||||||
push edi
|
push edi
|
||||||
|
|
||||||
mov ebx, [current_slot]
|
mov ebx, [current_process]
|
||||||
mov ebx, [ebx+APPDATA.process]
|
|
||||||
|
|
||||||
mov edx, [address]
|
mov edx, [address]
|
||||||
and edx, not 0xFFF
|
and edx, not 0xFFF
|
||||||
@ -753,9 +748,7 @@ proc user_alloc_at stdcall, address:dword, alloc_size:dword
|
|||||||
mov [page_tabs+ebx*4], ecx
|
mov [page_tabs+ebx*4], ecx
|
||||||
|
|
||||||
.nothird:
|
.nothird:
|
||||||
mov edx, [current_slot]
|
mov edx, [current_process]
|
||||||
mov edx, [edx+APPDATA.process]
|
|
||||||
|
|
||||||
mov ebx, [alloc_size]
|
mov ebx, [alloc_size]
|
||||||
add ebx, 0xFFF
|
add ebx, 0xFFF
|
||||||
and ebx, not 0xFFF
|
and ebx, not 0xFFF
|
||||||
@ -815,8 +808,7 @@ proc user_free stdcall, base:dword
|
|||||||
.released:
|
.released:
|
||||||
push edi
|
push edi
|
||||||
|
|
||||||
mov edx, [current_slot]
|
mov edx, [current_process]
|
||||||
mov edx, [edx+APPDATA.process]
|
|
||||||
mov esi, dword [edx+PROC.heap_base]
|
mov esi, dword [edx+PROC.heap_base]
|
||||||
mov edi, dword [edx+PROC.heap_top]
|
mov edi, dword [edx+PROC.heap_top]
|
||||||
sub ebx, [edx+PROC.mem_used]
|
sub ebx, [edx+PROC.mem_used]
|
||||||
@ -1004,8 +996,7 @@ user_realloc:
|
|||||||
jnz .nofreeall
|
jnz .nofreeall
|
||||||
mov eax, [page_tabs+ecx*4]
|
mov eax, [page_tabs+ecx*4]
|
||||||
and eax, not 0xFFF
|
and eax, not 0xFFF
|
||||||
mov edx, [current_slot]
|
mov edx, [current_process]
|
||||||
mov edx, [edx+APPDATA.process]
|
|
||||||
mov ebx, [edx+PROC.mem_used]
|
mov ebx, [edx+PROC.mem_used]
|
||||||
sub ebx, eax
|
sub ebx, eax
|
||||||
add ebx, 0x1000
|
add ebx, 0x1000
|
||||||
@ -1026,8 +1017,7 @@ user_realloc:
|
|||||||
shr ebx, 12
|
shr ebx, 12
|
||||||
sub ebx, edx
|
sub ebx, edx
|
||||||
push ebx ecx edx
|
push ebx ecx edx
|
||||||
mov edx, [current_slot]
|
mov edx, [current_process]
|
||||||
mov edx, [edx+APPDATA.process]
|
|
||||||
shl ebx, 12
|
shl ebx, 12
|
||||||
sub ebx, [edx+PROC.mem_used]
|
sub ebx, [edx+PROC.mem_used]
|
||||||
neg ebx
|
neg ebx
|
||||||
@ -1041,8 +1031,7 @@ user_realloc:
|
|||||||
shl ebx, 12
|
shl ebx, 12
|
||||||
jz .ret
|
jz .ret
|
||||||
push esi
|
push esi
|
||||||
mov esi, [current_slot]
|
mov esi, [current_process]
|
||||||
mov esi, [esi+APPDATA.process]
|
|
||||||
mov esi, [esi+PROC.heap_top]
|
mov esi, [esi+PROC.heap_top]
|
||||||
shr esi, 12
|
shr esi, 12
|
||||||
@@:
|
@@:
|
||||||
@ -1066,8 +1055,7 @@ user_realloc:
|
|||||||
ret
|
ret
|
||||||
.realloc_add:
|
.realloc_add:
|
||||||
; get some additional memory
|
; get some additional memory
|
||||||
mov eax, [current_slot]
|
mov eax, [current_process]
|
||||||
mov eax, [eax+APPDATA.process]
|
|
||||||
mov eax, [eax+PROC.heap_top]
|
mov eax, [eax+PROC.heap_top]
|
||||||
shr eax, 12
|
shr eax, 12
|
||||||
cmp edx, eax
|
cmp edx, eax
|
||||||
@ -1100,16 +1088,14 @@ user_realloc:
|
|||||||
cld
|
cld
|
||||||
rep stosd
|
rep stosd
|
||||||
pop edi
|
pop edi
|
||||||
mov edx, [current_slot]
|
mov edx, [current_process]
|
||||||
mov edx, [edx+APPDATA.process]
|
|
||||||
shl ebx, 12
|
shl ebx, 12
|
||||||
add [edx+PROC.mem_used], ebx
|
add [edx+PROC.mem_used], ebx
|
||||||
pop eax edx ecx
|
pop eax edx ecx
|
||||||
ret
|
ret
|
||||||
.cant_inplace:
|
.cant_inplace:
|
||||||
push esi edi
|
push esi edi
|
||||||
mov eax, [current_slot]
|
mov eax, [current_process]
|
||||||
mov eax, [eax+APPDATA.process]
|
|
||||||
mov esi, [eax+PROC.heap_base]
|
mov esi, [eax+PROC.heap_base]
|
||||||
mov edi, [eax+PROC.heap_top]
|
mov edi, [eax+PROC.heap_top]
|
||||||
shr esi, 12
|
shr esi, 12
|
||||||
@ -1174,8 +1160,7 @@ user_realloc:
|
|||||||
jnz @b
|
jnz @b
|
||||||
.no:
|
.no:
|
||||||
push ebx
|
push ebx
|
||||||
mov edx, [current_slot]
|
mov edx, [current_process]
|
||||||
mov edx, [eax+APPDATA.process]
|
|
||||||
shl ebx, 12
|
shl ebx, 12
|
||||||
add [edx+PROC.mem_used], ebx
|
add [edx+PROC.mem_used], ebx
|
||||||
pop ebx
|
pop ebx
|
||||||
|
@ -121,10 +121,10 @@ do_change_task:
|
|||||||
Mov dword [page_tabs+((tss._io_map_0 and -4096) shr 10)],eax,[ebx+APPDATA.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]
|
Mov dword [page_tabs+((tss._io_map_1 and -4096) shr 10)],eax,[ebx+APPDATA.io_map+4]
|
||||||
; set new thread memory-map
|
; set new thread memory-map
|
||||||
mov ecx, APPDATA.process
|
mov eax, [ebx+APPDATA.process]
|
||||||
mov eax, [ebx+ecx] ;offset>0x7F
|
cmp eax, [current_process]
|
||||||
cmp eax, [esi+ecx] ;offset>0x7F
|
|
||||||
je @f
|
je @f
|
||||||
|
mov [current_process], eax
|
||||||
mov eax, [eax+PROC.pdt_0_phys]
|
mov eax, [eax+PROC.pdt_0_phys]
|
||||||
mov cr3, eax
|
mov cr3, eax
|
||||||
@@:
|
@@:
|
||||||
|
@ -248,8 +248,7 @@ proc fs_execute
|
|||||||
loop .copy_process_name_loop
|
loop .copy_process_name_loop
|
||||||
.copy_process_name_done:
|
.copy_process_name_done:
|
||||||
|
|
||||||
mov ebx, [current_slot]
|
mov ebx, [current_process]
|
||||||
mov ebx, [ebx+APPDATA.process]
|
|
||||||
mov [save_proc], ebx
|
mov [save_proc], ebx
|
||||||
|
|
||||||
stdcall create_process, [hdr_mem], [file_base], [file_size]
|
stdcall create_process, [hdr_mem], [file_base], [file_size]
|
||||||
@ -431,8 +430,6 @@ proc create_process stdcall, app_size:dword,img_base:dword,img_size:dword
|
|||||||
mov ecx, pg_data.mutex
|
mov ecx, pg_data.mutex
|
||||||
call mutex_lock
|
call mutex_lock
|
||||||
|
|
||||||
xchg bx, bx
|
|
||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov [process], eax
|
mov [process], eax
|
||||||
|
|
||||||
@ -565,11 +562,14 @@ endp
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
set_cr3:
|
set_cr3:
|
||||||
|
pushfd
|
||||||
|
cli
|
||||||
mov ebx, [current_slot]
|
mov ebx, [current_slot]
|
||||||
|
mov [current_process], eax
|
||||||
mov [ebx+APPDATA.process], eax
|
mov [ebx+APPDATA.process], eax
|
||||||
mov eax, [eax+PROC.pdt_0_phys]
|
mov eax, [eax+PROC.pdt_0_phys]
|
||||||
mov cr3, eax
|
mov cr3, eax
|
||||||
|
popfd
|
||||||
ret
|
ret
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
|
@ -446,7 +446,9 @@ default_io_map rd 1
|
|||||||
|
|
||||||
LFBSize rd 1
|
LFBSize rd 1
|
||||||
|
|
||||||
current_slot rd 1
|
current_process rd 1
|
||||||
|
current_slot rd 1 ; i.e. cureent thread
|
||||||
|
|
||||||
|
|
||||||
; status
|
; status
|
||||||
hd1_status rd 1 ; 0 - free : other - pid
|
hd1_status rd 1 ; 0 - free : other - pid
|
||||||
|
@ -730,6 +730,8 @@ no_mode_0x12:
|
|||||||
stosd
|
stosd
|
||||||
stosd
|
stosd
|
||||||
|
|
||||||
|
mov [current_process], sys_proc
|
||||||
|
|
||||||
mov edx, SLOT_BASE+256*1
|
mov edx, SLOT_BASE+256*1
|
||||||
mov ebx, [os_stack_seg]
|
mov ebx, [os_stack_seg]
|
||||||
add ebx, 0x2000
|
add ebx, 0x2000
|
||||||
|
Loading…
Reference in New Issue
Block a user