diff --git a/kernel/trunk/core/exports.inc b/kernel/trunk/core/exports.inc index 68cfda9d3..43061b19d 100644 --- a/kernel/trunk/core/exports.inc +++ b/kernel/trunk/core/exports.inc @@ -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 diff --git a/kernel/trunk/core/heap.inc b/kernel/trunk/core/heap.inc index 1afae728a..58126fb17 100644 --- a/kernel/trunk/core/heap.inc +++ b/kernel/trunk/core/heap.inc @@ -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 diff --git a/kernel/trunk/core/memory.inc b/kernel/trunk/core/memory.inc index 900c06654..eb49c49b0 100644 --- a/kernel/trunk/core/memory.inc +++ b/kernel/trunk/core/memory.inc @@ -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 diff --git a/kernel/trunk/core/peload.inc b/kernel/trunk/core/peload.inc index 7a07e87d2..ee9f37939 100644 --- a/kernel/trunk/core/peload.inc +++ b/kernel/trunk/core/peload.inc @@ -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]