fix some kernel stdcall functions

git-svn-id: svn://kolibrios.org@660 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2007-10-20 17:11:22 +00:00
parent 05fad94d49
commit 0c4aa274bd
4 changed files with 43 additions and 15 deletions

View File

@ -93,17 +93,17 @@ kernel_export:
dd szPciWrite8 , pci_write8
dd szPciWrite16 , pci_write16
dd szAllocPage , alloc_page
dd szAllocPages , alloc_pages
dd szAllocPage , alloc_page ;stdcall
dd szAllocPages , alloc_pages ;stdcall
dd szFreePage , free_page
dd szMapPage , map_page
dd szMapPage , map_page ;stdcall
dd szMapSpace , map_space
dd szGetPgAddr , get_pg_addr
dd szCommitPages , commit_pages ;not implemented
dd szReleasePages , release_pages
dd szAllocKernelSpace, alloc_kernel_space
dd szFreeKernelSpace , free_kernel_space
dd szAllocKernelSpace, alloc_kernel_space ;stdcall
dd szFreeKernelSpace , free_kernel_space ;stdcall
dd szKernelAlloc , kernel_alloc
dd szKernelFree , kernel_free
dd szUserAlloc , user_alloc

View File

@ -269,6 +269,10 @@ align 4
proc alloc_kernel_space stdcall, size:dword
local block_ind:DWORD
push ebx
push esi
push edi
mov eax, [size]
add eax, 4095
and eax, not 4095
@ -356,6 +360,9 @@ proc alloc_kernel_space stdcall, size:dword
mov ebx, [size]
sub [heap_free], ebx
and [heap_mutex], 0
pop edi
pop esi
pop ebx
ret
.m_eq_size:
remove_from_list edi
@ -376,16 +383,24 @@ proc alloc_kernel_space stdcall, size:dword
mov ebx, [size]
sub [heap_free], ebx
and [heap_mutex], 0
pop edi
pop esi
pop ebx
ret
.error:
xor eax, eax
mov [heap_mutex], eax
pop edi
pop esi
pop ebx
ret
endp
align 4
proc free_kernel_space stdcall uses ebx ecx edx esi edi, base:dword
push ebx
push esi
push edi
mov ebx, heap_mutex
call wait_mutex ;ebx
@ -480,6 +495,9 @@ proc free_kernel_space stdcall uses ebx ecx edx esi edi, base:dword
xor eax, eax
mov [heap_mutex], eax
dec eax
pop edi
pop esi
pop ebx
ret
.insert:
remove_from_used esi
@ -499,10 +517,16 @@ proc free_kernel_space stdcall uses ebx ecx edx esi edi, base:dword
xor eax, eax
mov [heap_mutex], eax
dec eax
pop edi
pop esi
pop ebx
ret
.fail:
xor eax, eax
mov [heap_mutex], eax
pop edi
pop esi
pop ebx
ret
endp

View File

@ -13,6 +13,7 @@ proc alloc_page
pushfd
cli
push ebx
mov ebx, [page_start]
mov ecx, [page_end]
.l1:
@ -21,6 +22,7 @@ proc alloc_page
add ebx,4
cmp ebx, ecx
jb .l1
pop ebx
popfd
xor eax,eax
ret
@ -31,6 +33,7 @@ proc alloc_page
lea eax, [eax+ebx*8]
shl eax, 12
dec [pg_data.pages_free]
pop ebx
popfd
ret
endp
@ -38,6 +41,8 @@ endp
align 4
proc alloc_pages stdcall, count:dword
pushfd
push ebx
push edi
cli
mov eax, [count]
add eax, 7
@ -59,13 +64,18 @@ proc alloc_pages stdcall, count:dword
inc ecx
cmp ecx,ebx
jb .match
.fail: xor eax, eax
.fail:
xor eax, eax
pop edi
pop ebx
popfd
ret
.next:
inc ecx
cmp ecx, ebx
jb .find
pop edi
pop ebx
popfd
xor eax, eax
ret
@ -81,6 +91,8 @@ proc alloc_pages stdcall, count:dword
mov ebx, [count]
shl ebx, 3
sub [pg_data.pages_free], ebx
pop edi
pop ebx
popfd
ret
endp

View File

@ -179,14 +179,6 @@ map_PE:
jmp .L24
.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]
add ebx, [ecx+40]