replace old kernel_free with mem_free

git-svn-id: svn://kolibrios.org@887 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2008-10-27 23:38:33 +00:00
parent bc6cebbf4b
commit 3f22b06b9f
14 changed files with 296 additions and 309 deletions

View File

@ -558,7 +558,7 @@ endp
; ebx= size of file
;
; warging
; You mast call kernel_free() to delete each file
; You mast call mem_free() to delete each file
; loaded by the load_file() function
align 4
@ -622,7 +622,7 @@ proc load_file stdcall, file_name:dword
.exit:
push eax
lea edi, [eax+ebx] ;cleanup remain space
mov ecx, 4096 ;from file end
mov ecx, 4096 ;from file end
and ebx, 4095
jz @f
sub ecx, ebx
@ -636,7 +636,8 @@ proc load_file stdcall, file_name:dword
pop esi
ret
.cleanup:
stdcall kernel_free, [file]
mov ecx, [file]
call @mem_free@4
.fail:
xor eax, eax
xor ebx, ebx
@ -826,12 +827,10 @@ proc load_driver stdcall, driver_name:dword
mov dword [edi], '.obj'
mov byte [edi+4], 0
stdcall load_file, edx
mov [coff], eax
test eax, eax
jz .exit
mov [coff], eax
movzx ebx, [eax+CFH.nSections]
lea edx, [eax+20]
xor ecx, ecx
@ -847,6 +846,7 @@ proc load_driver stdcall, driver_name:dword
mov edx, PG_SW
call @mem_alloc@8
test eax, eax
mov [img_base], eax
jz .fail
mov [img_base], eax
@ -923,14 +923,16 @@ proc load_driver stdcall, driver_name:dword
stdcall get_coff_sym,[sym],[ebx+CFH.nSymbols],szSTART
mov [start], eax
stdcall kernel_free, [coff]
mov ecx, [coff]
call @mem_free@4
mov ebx, [start]
stdcall ebx, DRV_ENTRY
test eax, eax
jnz .ok
stdcall kernel_free, [img_base]
mov ecx, [img_base]
call @mem_free@4
xor eax, eax
ret
.ok:
@ -961,9 +963,11 @@ proc load_driver stdcall, driver_name:dword
mov esi, msg_CR
call sys_msg_board_str
.cleanup:
stdcall kernel_free,[img_base]
mov ecx, [img_base]
call @mem_free@4
.fail:
stdcall kernel_free, [coff]
mov ecx, [coff]
call @mem_free@4
.exit:
xor eax, eax
ret
@ -1065,7 +1069,9 @@ proc load_library stdcall, file_name:dword
stdcall get_coff_sym,[sym],[ebx+CFH.nSymbols],szEXPORTS
mov [exports], eax
stdcall kernel_free, [coff]
mov ecx, [coff]
call @mem_free@4
mov eax, [exports]
ret
.fail:

View File

@ -9,20 +9,20 @@ $Revision$
iglobal
szKernel db 'KERNEL', 0
szVersion db 'version',0
szKernel db 'KERNEL', 0
szVersion db 'version',0
szRegService db 'RegService',0
szGetService db 'GetService',0
szServiceHandler db 'ServiceHandler',0
szAttachIntHandler db 'AttachIntHandler',0
szGetIntHandler db 'GetIntHandler', 0
szFpuSave db 'FpuSave',0
szFpuSave db 'FpuSave',0
szFpuRestore db 'FpuRestore',0
szReservePortArea db 'ReservePortArea',0
szBoot_Log db 'Boot_Log',0
szPciApi db 'PciApi', 0
szPciApi db 'PciApi', 0
szPciRead32 db 'PciRead32', 0
szPciRead16 db 'PciRead16', 0
szPciRead8 db 'PciRead8', 0
@ -33,7 +33,7 @@ iglobal
szAllocPage db 'AllocPage',0
szFreePage db 'FreePage',0
szGetPgAddr db 'GetPgAddr',0
szMapPage db 'MapPage',0
szMapPage db 'MapPage',0
szMapSpace db 'MapSpace',0
szMapIoMem db 'MapIoMem',0
szCommitPages db 'CommitPages',0
@ -41,15 +41,15 @@ iglobal
szAllocKernelSpace db 'AllocKernelSpace',0
szFreeKernelSpace db 'FreeKernelSpace',0
szHeapAlloc db 'HeapAlloc',0
szKernelFree db 'KernelFree',0
szMemAlloc db 'MemAlloc',0
szMemFree db 'MemFree',0
szUserAlloc db 'UserAlloc',0
szUserFree db 'UserFree',0
szKmalloc db 'Kmalloc',0
szKfree db 'Kfree',0
szKmalloc db 'Kmalloc',0
szKfree db 'Kfree',0
szCreateRingBuffer db 'CreateRingBuffer',0
szGetPid db 'GetPid',0
szGetPid db 'GetPid',0
szCreateObject db 'CreateObject',0
szDestroyObject db 'DestroyObject',0
szCreateEvent db 'CreateEvent',0
@ -71,15 +71,15 @@ iglobal
szLoadFile db 'LoadFile',0
szSendEvent db 'SendEvent',0
szSetMouseData db 'SetMouseData',0
szSleep db 'Sleep',0
szSleep db 'Sleep',0
szGetTimerTicks db 'GetTimerTicks',0
szStrncat db 'strncat',0
szStrncpy db 'strncpy',0
szstrncmp db 'strncmp',0
szStrnlen db 'strnlen',0
szStrchr db 'strchr',0
szStrrchr db 'strrchr',0
szStrncat db 'strncat',0
szStrncpy db 'strncpy',0
szstrncmp db 'strncmp',0
szStrnlen db 'strnlen',0
szStrchr db 'strchr',0
szStrrchr db 'strrchr',0
align 16
@ -104,18 +104,18 @@ kernel_export:
dd szAllocPage , _alloc_page ;stdcall
dd szFreePage , free_page
dd szMapPage , map_page ;stdcall
dd szMapPage , map_page ;stdcall
dd szMapSpace , map_space
dd szMapIoMem , map_io_mem ;stdcall
dd szMapIoMem , map_io_mem ;stdcall
dd szGetPgAddr , get_pg_addr
dd szCommitPages , commit_pages ;not implemented
dd szReleasePages , release_pages
dd szFreeKernelSpace , free_kernel_space ;stdcall
dd szHeapAlloc , @mem_alloc@8 ;fastcall
dd szKernelFree , kernel_free ;stdcall
dd szUserAlloc , user_alloc ;stdcall
dd szUserFree , user_free ;stdcall
dd szMemAlloc , @mem_alloc@8 ;fastcall
dd szMemFree , @mem_free@4 ;fastcall
dd szUserAlloc , user_alloc ;stdcall
dd szUserFree , user_free ;stdcall
dd szKmalloc , malloc
dd szKfree , free
dd szCreateRingBuffer, create_ring_buffer ;stdcall

View File

@ -8,36 +8,12 @@
$Revision$
struc MEM_BLOCK
{ .next_block dd ?
.prev_block dd ? ;+4
.list_fd dd ? ;+8
.list_bk dd ? ;+12
.base dd ? ;+16
.size dd ? ;+20
.flags dd ? ;+24
.handle dd ? ;+28
}
MEM_LIST_OFFSET equ 8
FREE_BLOCK equ 4
USED_BLOCK equ 8
DONT_FREE_BLOCK equ 10h
virtual at 0
MEM_BLOCK MEM_BLOCK
end virtual
MEM_BLOCK_SIZE equ 8*4
block_next equ MEM_BLOCK.next_block
block_prev equ MEM_BLOCK.prev_block
list_fd equ MEM_BLOCK.list_fd
list_bk equ MEM_BLOCK.list_bk
block_base equ MEM_BLOCK.base
block_size equ MEM_BLOCK.size
block_flags equ MEM_BLOCK.flags
align 4
proc free_kernel_space stdcall uses ebx ecx edx esi edi, base:dword
@ -46,21 +22,6 @@ proc free_kernel_space stdcall uses ebx ecx edx esi edi, base:dword
endp
align 4
proc kernel_free stdcall, base:dword
ret
endp
restore block_next
restore block_prev
restore block_list
restore block_base
restore block_size
restore block_flags
;;;;;;;;;;;;;; USER ;;;;;;;;;;;;;;;;;
HEAP_TOP equ 0x5FC00000

View File

@ -38,9 +38,13 @@ proc load_PE stdcall, file_name:dword
test eax, eax
jnz .cleanup
stdcall kernel_free, [base]
mov ecx, [base]
call @mem_free@4
.cleanup:
stdcall kernel_free, [image]
mov ecx, [image]
call @mem_free@4
mov eax, [entry]
ret
.fail:
@ -54,237 +58,236 @@ PTR equ
align 4
map_PE: ;stdcall base:dword, image:dword
cld
push ebp
push edi
push esi
push ebx
sub esp, 60
mov ebx, DWORD PTR [esp+84]
mov ebp, DWORD PTR [esp+80]
mov edx, ebx
mov esi, ebx
add edx, DWORD PTR [ebx+60]
mov edi, ebp
mov DWORD PTR [esp+32], edx
mov ecx, DWORD PTR [edx+84]
push ebp
push edi
push esi
push ebx
sub esp, 60
mov ebx, DWORD PTR [esp+84]
mov ebp, DWORD PTR [esp+80]
mov edx, ebx
mov esi, ebx
add edx, DWORD PTR [ebx+60]
mov edi, ebp
mov DWORD PTR [esp+32], edx
mov ecx, DWORD PTR [edx+84]
shr ecx, 2
rep movsd
shr ecx, 2
rep movsd
movzx eax, WORD PTR [edx+6]
mov DWORD PTR [esp+36], 0
mov DWORD PTR [esp+16], eax
jmp L2
movzx eax, WORD PTR [edx+6]
mov DWORD PTR [esp+36], 0
mov DWORD PTR [esp+16], eax
jmp L2
L3:
mov eax, DWORD PTR [edx+264]
test eax, eax
je L4
mov esi, ebx
mov edi, ebp
add esi, DWORD PTR [edx+268]
mov ecx, eax
add edi, DWORD PTR [edx+260]
mov eax, DWORD PTR [edx+264]
test eax, eax
je L4
mov esi, ebx
mov edi, ebp
add esi, DWORD PTR [edx+268]
mov ecx, eax
add edi, DWORD PTR [edx+260]
shr ecx, 2
rep movsd
shr ecx, 2
rep movsd
L4:
mov ecx, DWORD PTR [edx+256]
add ecx, 4095
and ecx, -4096
cmp ecx, eax
jbe L6
sub ecx, eax
add eax, DWORD PTR [edx+260]
lea edi, [eax+ebp]
mov ecx, DWORD PTR [edx+256]
add ecx, 4095
and ecx, -4096
cmp ecx, eax
jbe L6
sub ecx, eax
add eax, DWORD PTR [edx+260]
lea edi, [eax+ebp]
xor eax, eax
rep stosb
xor eax, eax
rep stosb
L6:
inc DWORD PTR [esp+36]
add edx, 40
inc DWORD PTR [esp+36]
add edx, 40
L2:
mov esi, DWORD PTR [esp+16]
cmp DWORD PTR [esp+36], esi
jne L3
mov edi, DWORD PTR [esp+32]
cmp DWORD PTR [edi+164], 0
je L9
mov esi, ebp
mov ecx, ebp
sub esi, DWORD PTR [edi+52]
add ecx, DWORD PTR [edi+160]
mov eax, esi
shr eax, 16
mov DWORD PTR [esp+12], eax
jmp L11
mov esi, DWORD PTR [esp+16]
cmp DWORD PTR [esp+36], esi
jne L3
mov edi, DWORD PTR [esp+32]
cmp DWORD PTR [edi+164], 0
je L9
mov esi, ebp
mov ecx, ebp
sub esi, DWORD PTR [edi+52]
add ecx, DWORD PTR [edi+160]
mov eax, esi
shr eax, 16
mov DWORD PTR [esp+12], eax
jmp L11
L12:
lea ebx, [eax-8]
xor edi, edi
shr ebx,1
jmp L13
lea ebx, [eax-8]
xor edi, edi
shr ebx,1
jmp L13
L14:
movzx eax, WORD PTR [ecx+8+edi*2]
mov edx, eax
shr eax, 12
and edx, 4095
add edx, DWORD PTR [ecx]
cmp ax, 2
je L17
cmp ax, 3
je L18
dec ax
jne L15
mov eax, DWORD PTR [esp+12]
add WORD PTR [edx+ebp], ax
movzx eax, WORD PTR [ecx+8+edi*2]
mov edx, eax
shr eax, 12
and edx, 4095
add edx, DWORD PTR [ecx]
cmp ax, 2
je L17
cmp ax, 3
je L18
dec ax
jne L15
mov eax, DWORD PTR [esp+12]
add WORD PTR [edx+ebp], ax
L17:
add WORD PTR [edx+ebp], si
add WORD PTR [edx+ebp], si
L18:
add DWORD PTR [edx+ebp], esi
add DWORD PTR [edx+ebp], esi
L15:
inc edi
inc edi
L13:
cmp edi, ebx
jne L14
add ecx, DWORD PTR [ecx+4]
cmp edi, ebx
jne L14
add ecx, DWORD PTR [ecx+4]
L11:
mov eax, DWORD PTR [ecx+4]
test eax, eax
jne L12
mov eax, DWORD PTR [ecx+4]
test eax, eax
jne L12
L9:
mov edx, DWORD PTR [esp+32]
cmp DWORD PTR [edx+132], 0
je L20
mov eax, ebp
add eax, DWORD PTR [edx+128]
mov DWORD PTR [esp+40], 0
add eax, 20
mov DWORD PTR [esp+56], eax
mov edx, DWORD PTR [esp+32]
cmp DWORD PTR [edx+132], 0
je L20
mov eax, ebp
add eax, DWORD PTR [edx+128]
mov DWORD PTR [esp+40], 0
add eax, 20
mov DWORD PTR [esp+56], eax
L22:
mov ecx, DWORD PTR [esp+56]
cmp DWORD PTR [ecx-16], 0
jne L23
cmp DWORD PTR [ecx-8], 0
je L25
mov ecx, DWORD PTR [esp+56]
cmp DWORD PTR [ecx-16], 0
jne L23
cmp DWORD PTR [ecx-8], 0
je L25
L23:
mov edi, DWORD PTR [__exports+32]
mov esi, DWORD PTR [__exports+28]
mov eax, DWORD PTR [esp+56]
mov DWORD PTR [esp+20], edi
add edi, OS_BASE
add esi, OS_BASE
mov DWORD PTR [esp+44], esi
mov ecx, DWORD PTR [eax-4]
mov DWORD PTR [esp+48], edi
mov edx, DWORD PTR [eax-20]
mov DWORD PTR [esp+52], 0
add ecx, ebp
add edx, ebp
mov DWORD PTR [esp+24], edx
mov DWORD PTR [esp+28], ecx
mov edi, DWORD PTR [__exports+32]
mov esi, DWORD PTR [__exports+28]
mov eax, DWORD PTR [esp+56]
mov DWORD PTR [esp+20], edi
add edi, OS_BASE
add esi, OS_BASE
mov DWORD PTR [esp+44], esi
mov ecx, DWORD PTR [eax-4]
mov DWORD PTR [esp+48], edi
mov edx, DWORD PTR [eax-20]
mov DWORD PTR [esp+52], 0
add ecx, ebp
add edx, ebp
mov DWORD PTR [esp+24], edx
mov DWORD PTR [esp+28], ecx
L26:
mov esi, DWORD PTR [esp+52]
mov edi, DWORD PTR [esp+24]
mov eax, DWORD PTR [edi+esi*4]
test eax, eax
je L27
test eax, eax
js L27
lea edi, [ebp+eax]
mov eax, DWORD PTR [esp+28]
mov DWORD PTR [eax+esi*4], 0
lea esi, [edi+2]
push eax
push 32
movzx eax, WORD PTR [edi]
mov edx, DWORD PTR [esp+56]
mov eax, DWORD PTR [edx+eax*4]
add eax, OS_BASE
push eax
push esi
call strncmp
pop ebx
xor ebx, ebx
test eax, eax
jne L32
jmp L30
mov esi, DWORD PTR [esp+52]
mov edi, DWORD PTR [esp+24]
mov eax, DWORD PTR [edi+esi*4]
test eax, eax
je L27
test eax, eax
js L27
lea edi, [ebp+eax]
mov eax, DWORD PTR [esp+28]
mov DWORD PTR [eax+esi*4], 0
lea esi, [edi+2]
push eax
push 32
movzx eax, WORD PTR [edi]
mov edx, DWORD PTR [esp+56]
mov eax, DWORD PTR [edx+eax*4]
add eax, OS_BASE
push eax
push esi
call strncmp
pop ebx
xor ebx, ebx
test eax, eax
jne L32
jmp L30
L33:
push ecx
push 32
mov ecx, DWORD PTR [esp+28]
mov eax, DWORD PTR [ecx+OS_BASE+ebx*4]
add eax, OS_BASE
push eax
push esi
call strncmp
pop edx
test eax, eax
jne L34
mov esi, DWORD PTR [esp+44]
mov edx, DWORD PTR [esp+52]
mov ecx, DWORD PTR [esp+28]
mov eax, DWORD PTR [esi+ebx*4]
add eax, OS_BASE
mov DWORD PTR [ecx+edx*4], eax
jmp L36
push ecx
push 32
mov ecx, DWORD PTR [esp+28]
mov eax, DWORD PTR [ecx+OS_BASE+ebx*4]
add eax, OS_BASE
push eax
push esi
call strncmp
pop edx
test eax, eax
jne L34
mov esi, DWORD PTR [esp+44]
mov edx, DWORD PTR [esp+52]
mov ecx, DWORD PTR [esp+28]
mov eax, DWORD PTR [esi+ebx*4]
add eax, OS_BASE
mov DWORD PTR [ecx+edx*4], eax
jmp L36
L34:
inc ebx
inc ebx
L32:
cmp ebx, DWORD PTR [__exports+24]
jb L33
cmp ebx, DWORD PTR [__exports+24]
jb L33
L36:
cmp ebx, DWORD PTR [__exports+24]
jne L37
cmp ebx, DWORD PTR [__exports+24]
jne L37
mov esi, msg_unresolved
call sys_msg_board_str
lea esi, [edi+2]
call sys_msg_board_str
mov esi, msg_CR
call sys_msg_board_str
mov esi, msg_unresolved
call sys_msg_board_str
lea esi, [edi+2]
call sys_msg_board_str
mov esi, msg_CR
call sys_msg_board_str
mov DWORD PTR [esp+40], 1
jmp L37
mov DWORD PTR [esp+40], 1
jmp L37
L30:
movzx eax, WORD PTR [edi]
mov esi, DWORD PTR [esp+44]
mov edi, DWORD PTR [esp+52]
mov edx, DWORD PTR [esp+28]
mov eax, DWORD PTR [esi+eax*4]
add eax, OS_BASE
mov DWORD PTR [edx+edi*4], eax
movzx eax, WORD PTR [edi]
mov esi, DWORD PTR [esp+44]
mov edi, DWORD PTR [esp+52]
mov edx, DWORD PTR [esp+28]
mov eax, DWORD PTR [esi+eax*4]
add eax, OS_BASE
mov DWORD PTR [edx+edi*4], eax
L37:
inc DWORD PTR [esp+52]
jmp L26
inc DWORD PTR [esp+52]
jmp L26
L27:
add DWORD PTR [esp+56], 20
jmp L22
add DWORD PTR [esp+56], 20
jmp L22
L25:
xor eax, eax
cmp DWORD PTR [esp+40], 0
jne L40
xor eax, eax
cmp DWORD PTR [esp+40], 0
jne L40
L20:
mov ecx, DWORD PTR [esp+32]
mov eax, ebp
add eax, DWORD PTR [ecx+40]
mov ecx, DWORD PTR [esp+32]
mov eax, ebp
add eax, DWORD PTR [ecx+40]
L40:
add esp, 60
pop ebx
pop esi
pop edi
pop ebp
ret 8
add esp, 60
pop ebx
pop esi
pop edi
pop ebp
ret 8
align 16
__exports:
export 'KERNEL', \
commit_pages, 'CommitPages', \ ; eax, ebx, ecx
export 'KERNEL', \
commit_pages, 'CommitPages', \ ; eax, ebx, ecx
create_kernel_object, 'CreateObject', \
create_ring_buffer, 'CreateRingBuffer', \ ; stdcall
destroy_kernel_object, 'DestroyObject', \
free_kernel_space, 'FreeKernelSpace', \ ; stdcall
kernel_free, 'KernelFree', \ ; stdcall
malloc, 'Kmalloc', \
free, 'Kfree', \
map_io_mem, 'MapIoMem', \ ; stdcall

View File

@ -235,7 +235,8 @@ end if
call set_cr3
.err:
.err_hdr:
stdcall kernel_free,[file_base]
mov ecx, [file_base]
call @mem_free@4
.err_file:
xor eax, eax
mov [application_table_status],eax

View File

@ -72,7 +72,7 @@ v86_create:
mov edi, eax
add eax, 1000h
push eax
call get_pg_addr
sub eax, OS_BASE
or al, PG_UW
stosd
; ...and also copy system page tables
@ -143,7 +143,11 @@ v86_create:
; destroys: eax, ebx, ecx, edx (due to free)
v86_destroy:
push eax
stdcall kernel_free, [eax+V86_machine.pagedir]
mov ecx, [eax+V86_machine.pagedir]
sub ecx, OS_BASE
call @core_free@4
pop eax
jmp free

View File

@ -44,14 +44,14 @@ kernel_export \
CommitPages,\
ReleasePages,\
\
FreeKernelSpace,\
HeapAlloc,\
KernelFree,\
UserAlloc,\
UserFree,\
Kmalloc,\
Kfree,\
CreateRingBuffer,\
FreeKernelSpace, \
MemAlloc, \
MemFree, \
UserAlloc, \
UserFree, \
Kmalloc, \
Kfree, \
CreateRingBuffer, \
\
GetPid,\
CreateObject,\

View File

@ -83,7 +83,7 @@ proc START stdcall, state:dword
mov ecx, 16*512
mov edx, PG_SW
call HeapAlloc
call MemAlloc
test eax, eax
jz .out_of_mem
mov [mix_buff], eax
@ -426,7 +426,7 @@ proc CreateBuffer stdcall, format:dword, size:dword
add ecx, 128 ;resampler required
mov [eax+STREAM.in_size], ecx
mov edx, PG_SW
call HeapAlloc
call MemAlloc
mov edi, [str]
mov [edi+STREAM.in_base], eax
@ -513,9 +513,11 @@ DestroyBuffer:
mov [ecx+STREAM.str_fd], ebx
popf
stdcall KernelFree, [eax+STREAM.in_base]
mov ecx, [eax+STREAM.in_base]
call MemFree
mov eax, [.handle]
stdcall KernelFree, [eax+STREAM.out_base]
mov ecx, [eax+STREAM.out_base]
call MemFree
pop eax ;restore stack
call DestroyObject ;eax= stream

View File

@ -511,7 +511,7 @@ proc create_primary_buff
mov ecx, 0x10000
mov edx, PG_SW
call HeapAlloc
call MemAlloc
mov [ctrl.buffer], eax
mov edi, eax

View File

@ -533,7 +533,7 @@ proc create_primary_buff
mov ecx, 0x10000
mov edx, PG_SW
call HeapAlloc
call MemAlloc
mov [ctrl.buffer], eax
mov edi, eax

View File

@ -168,12 +168,12 @@ ntfs_setup: ; CODE XREF: part_set.inc
@@:
; $MFT and $MFTMirr invalid!
.fail_free_frs:
push [ntfs_data.frs_buffer]
call kernel_free
mov ecx, [ntfs_data.frs_buffer]
call @mem_free@4
jmp problem_fat_dec_count
.fail_free_mft:
push [ntfs_data.mft_retrieval]
call kernel_free
mov ecx, [ntfs_data.mft_retrieval]
call @mem_free@4
jmp .fail_free_frs
.mftok:
; read $MFT table retrieval information
@ -259,9 +259,9 @@ ntfs_setup: ; CODE XREF: part_set.inc
mov ecx, [ntfs_data.mft_retrieval_size]
add ecx, ecx
rep movsd
push [ntfs_data.mft_retrieval]
mov ecx, [ntfs_data.mft_retrieval]
mov [ntfs_data.mft_retrieval], eax
call kernel_free
call @mem_free@4
mov eax, [ntfs_data.mft_retrieval_size]
.ok:
shl eax, 3
@ -980,8 +980,8 @@ ntfs_find_lfn:
@@:
; reallocate
push eax
push [ntfs_data.cur_index_buf]
call kernel_free
mov ecx, [ntfs_data.cur_index_buf]
call @mem_free@4
pop ecx
mov [ntfs_data.cur_index_size], ecx
mov edx, PG_SW
@ -1013,10 +1013,10 @@ ntfs_find_lfn:
rep movsd
mov esi, eax
mov [ntfs_data.cur_index_size], ebp
push esi ebp
push [ntfs_data.cur_index_buf]
call kernel_free
pop ebp esi
mov ecx, [ntfs_data.cur_index_buf]
call @mem_free@4
mov [ntfs_data.cur_index_buf], esi
.ok2:
add esi, 10h
@ -1327,8 +1327,8 @@ ntfs_HdReadFolder:
@@:
; reallocate
push eax
push [ntfs_data.cur_index_buf]
call kernel_free
mov ecx, [ntfs_data.cur_index_buf]
call @mem_free@4
pop ecx
mov [ntfs_data.cur_index_size], ecx
mov edx, PG_SW
@ -1365,10 +1365,10 @@ ntfs_HdReadFolder:
rep movsd
mov esi, eax
mov [ntfs_data.cur_index_size], ebp
push esi ebp
push [ntfs_data.cur_index_buf]
call kernel_free
pop ebp esi
mov ecx, [ntfs_data.cur_index_buf]
call @mem_free@4
mov [ntfs_data.cur_index_buf], esi
.ok2:
add esi, 10h

View File

@ -27,7 +27,9 @@ read_skin_file:
mov esi, eax
mov edi, skin_data
rep movsd
stdcall kernel_free, eax
mov ecx, eax
call @mem_free@4
call parse_skin_data
xor eax, eax
@ -37,9 +39,10 @@ read_skin_file:
inc eax
ret
.noskin:
stdcall kernel_free, eax
push 2
pop eax
mov ecx, eax
call @mem_free@4
mov eax, 2
ret
struct SKIN_HEADER

View File

@ -142,6 +142,7 @@ extrn _init
extrn _init_mm
extrn @core_alloc@4
extrn @core_free@4
extrn @init_heap@8
extrn @find_large_md@4
@ -2280,7 +2281,10 @@ sys_background:
pushad
; return memory for old background
stdcall kernel_free, [img_background]
mov ecx, [img_background]
call @mem_free@4
; calculate RAW size
xor eax,eax
inc eax

View File

@ -366,8 +366,8 @@ proc load_cursor stdcall, src:dword, flags:dword
stdcall load_file, [src]
test eax, eax
jz .fail
mov [src], eax
jz .fail
@@:
push ebx
push esi
@ -383,7 +383,9 @@ proc load_cursor stdcall, src:dword, flags:dword
cmp word [flags], LOAD_FROM_FILE
jne .exit
stdcall kernel_free, [src]
mov ecx, [src]
call @mem_free@4
.exit:
pop edi
pop esi
@ -436,7 +438,8 @@ align 4
destroy_cursor:
push eax
stdcall kernel_free, [eax+CURSOR.base]
mov ecx, [eax+CURSOR.base]
call @mem_free@4
pop eax
call destroy_kernel_object