forked from KolibriOS/kolibrios
fix some kernel stdcall functions
git-svn-id: svn://kolibrios.org@660 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
05fad94d49
commit
0c4aa274bd
@ -93,17 +93,17 @@ kernel_export:
|
|||||||
dd szPciWrite8 , pci_write8
|
dd szPciWrite8 , pci_write8
|
||||||
dd szPciWrite16 , pci_write16
|
dd szPciWrite16 , pci_write16
|
||||||
|
|
||||||
dd szAllocPage , alloc_page
|
dd szAllocPage , alloc_page ;stdcall
|
||||||
dd szAllocPages , alloc_pages
|
dd szAllocPages , alloc_pages ;stdcall
|
||||||
dd szFreePage , free_page
|
dd szFreePage , free_page
|
||||||
dd szMapPage , map_page
|
dd szMapPage , map_page ;stdcall
|
||||||
dd szMapSpace , map_space
|
dd szMapSpace , map_space
|
||||||
dd szGetPgAddr , get_pg_addr
|
dd szGetPgAddr , get_pg_addr
|
||||||
dd szCommitPages , commit_pages ;not implemented
|
dd szCommitPages , commit_pages ;not implemented
|
||||||
dd szReleasePages , release_pages
|
dd szReleasePages , release_pages
|
||||||
|
|
||||||
dd szAllocKernelSpace, alloc_kernel_space
|
dd szAllocKernelSpace, alloc_kernel_space ;stdcall
|
||||||
dd szFreeKernelSpace , free_kernel_space
|
dd szFreeKernelSpace , free_kernel_space ;stdcall
|
||||||
dd szKernelAlloc , kernel_alloc
|
dd szKernelAlloc , kernel_alloc
|
||||||
dd szKernelFree , kernel_free
|
dd szKernelFree , kernel_free
|
||||||
dd szUserAlloc , user_alloc
|
dd szUserAlloc , user_alloc
|
||||||
|
@ -269,6 +269,10 @@ align 4
|
|||||||
proc alloc_kernel_space stdcall, size:dword
|
proc alloc_kernel_space stdcall, size:dword
|
||||||
local block_ind:DWORD
|
local block_ind:DWORD
|
||||||
|
|
||||||
|
push ebx
|
||||||
|
push esi
|
||||||
|
push edi
|
||||||
|
|
||||||
mov eax, [size]
|
mov eax, [size]
|
||||||
add eax, 4095
|
add eax, 4095
|
||||||
and eax, not 4095
|
and eax, not 4095
|
||||||
@ -356,6 +360,9 @@ proc alloc_kernel_space stdcall, size:dword
|
|||||||
mov ebx, [size]
|
mov ebx, [size]
|
||||||
sub [heap_free], ebx
|
sub [heap_free], ebx
|
||||||
and [heap_mutex], 0
|
and [heap_mutex], 0
|
||||||
|
pop edi
|
||||||
|
pop esi
|
||||||
|
pop ebx
|
||||||
ret
|
ret
|
||||||
.m_eq_size:
|
.m_eq_size:
|
||||||
remove_from_list edi
|
remove_from_list edi
|
||||||
@ -376,16 +383,24 @@ proc alloc_kernel_space stdcall, size:dword
|
|||||||
mov ebx, [size]
|
mov ebx, [size]
|
||||||
sub [heap_free], ebx
|
sub [heap_free], ebx
|
||||||
and [heap_mutex], 0
|
and [heap_mutex], 0
|
||||||
|
pop edi
|
||||||
|
pop esi
|
||||||
|
pop ebx
|
||||||
ret
|
ret
|
||||||
.error:
|
.error:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov [heap_mutex], eax
|
mov [heap_mutex], eax
|
||||||
|
pop edi
|
||||||
|
pop esi
|
||||||
|
pop ebx
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc free_kernel_space stdcall uses ebx ecx edx esi edi, base:dword
|
proc free_kernel_space stdcall uses ebx ecx edx esi edi, base:dword
|
||||||
|
push ebx
|
||||||
|
push esi
|
||||||
|
push edi
|
||||||
mov ebx, heap_mutex
|
mov ebx, heap_mutex
|
||||||
call wait_mutex ;ebx
|
call wait_mutex ;ebx
|
||||||
|
|
||||||
@ -480,6 +495,9 @@ proc free_kernel_space stdcall uses ebx ecx edx esi edi, base:dword
|
|||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov [heap_mutex], eax
|
mov [heap_mutex], eax
|
||||||
dec eax
|
dec eax
|
||||||
|
pop edi
|
||||||
|
pop esi
|
||||||
|
pop ebx
|
||||||
ret
|
ret
|
||||||
.insert:
|
.insert:
|
||||||
remove_from_used esi
|
remove_from_used esi
|
||||||
@ -499,10 +517,16 @@ proc free_kernel_space stdcall uses ebx ecx edx esi edi, base:dword
|
|||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov [heap_mutex], eax
|
mov [heap_mutex], eax
|
||||||
dec eax
|
dec eax
|
||||||
|
pop edi
|
||||||
|
pop esi
|
||||||
|
pop ebx
|
||||||
ret
|
ret
|
||||||
.fail:
|
.fail:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov [heap_mutex], eax
|
mov [heap_mutex], eax
|
||||||
|
pop edi
|
||||||
|
pop esi
|
||||||
|
pop ebx
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ proc alloc_page
|
|||||||
|
|
||||||
pushfd
|
pushfd
|
||||||
cli
|
cli
|
||||||
|
push ebx
|
||||||
mov ebx, [page_start]
|
mov ebx, [page_start]
|
||||||
mov ecx, [page_end]
|
mov ecx, [page_end]
|
||||||
.l1:
|
.l1:
|
||||||
@ -21,6 +22,7 @@ proc alloc_page
|
|||||||
add ebx,4
|
add ebx,4
|
||||||
cmp ebx, ecx
|
cmp ebx, ecx
|
||||||
jb .l1
|
jb .l1
|
||||||
|
pop ebx
|
||||||
popfd
|
popfd
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
ret
|
ret
|
||||||
@ -31,6 +33,7 @@ proc alloc_page
|
|||||||
lea eax, [eax+ebx*8]
|
lea eax, [eax+ebx*8]
|
||||||
shl eax, 12
|
shl eax, 12
|
||||||
dec [pg_data.pages_free]
|
dec [pg_data.pages_free]
|
||||||
|
pop ebx
|
||||||
popfd
|
popfd
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
@ -38,6 +41,8 @@ endp
|
|||||||
align 4
|
align 4
|
||||||
proc alloc_pages stdcall, count:dword
|
proc alloc_pages stdcall, count:dword
|
||||||
pushfd
|
pushfd
|
||||||
|
push ebx
|
||||||
|
push edi
|
||||||
cli
|
cli
|
||||||
mov eax, [count]
|
mov eax, [count]
|
||||||
add eax, 7
|
add eax, 7
|
||||||
@ -59,13 +64,18 @@ proc alloc_pages stdcall, count:dword
|
|||||||
inc ecx
|
inc ecx
|
||||||
cmp ecx,ebx
|
cmp ecx,ebx
|
||||||
jb .match
|
jb .match
|
||||||
.fail: xor eax, eax
|
.fail:
|
||||||
|
xor eax, eax
|
||||||
|
pop edi
|
||||||
|
pop ebx
|
||||||
popfd
|
popfd
|
||||||
ret
|
ret
|
||||||
.next:
|
.next:
|
||||||
inc ecx
|
inc ecx
|
||||||
cmp ecx, ebx
|
cmp ecx, ebx
|
||||||
jb .find
|
jb .find
|
||||||
|
pop edi
|
||||||
|
pop ebx
|
||||||
popfd
|
popfd
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret
|
ret
|
||||||
@ -81,6 +91,8 @@ proc alloc_pages stdcall, count:dword
|
|||||||
mov ebx, [count]
|
mov ebx, [count]
|
||||||
shl ebx, 3
|
shl ebx, 3
|
||||||
sub [pg_data.pages_free], ebx
|
sub [pg_data.pages_free], ebx
|
||||||
|
pop edi
|
||||||
|
pop ebx
|
||||||
popfd
|
popfd
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
@ -179,14 +179,6 @@ map_PE:
|
|||||||
jmp .L24
|
jmp .L24
|
||||||
.L22:
|
.L22:
|
||||||
|
|
||||||
push eax
|
|
||||||
push edx
|
|
||||||
mov edx, 0x400 ;bochs
|
|
||||||
mov al,0xff ;bochs
|
|
||||||
out dx, al ;bochs
|
|
||||||
pop edx
|
|
||||||
pop eax
|
|
||||||
|
|
||||||
mov ecx, [esp+16]
|
mov ecx, [esp+16]
|
||||||
add ebx, [ecx+40]
|
add ebx, [ecx+40]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user