forked from KolibriOS/kolibrios
replace old kernel_free with mem_free
git-svn-id: svn://kolibrios.org@887 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
bc6cebbf4b
commit
3f22b06b9f
@ -558,7 +558,7 @@ endp
|
|||||||
; ebx= size of file
|
; ebx= size of file
|
||||||
;
|
;
|
||||||
; warging
|
; 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
|
; loaded by the load_file() function
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
@ -622,7 +622,7 @@ proc load_file stdcall, file_name:dword
|
|||||||
.exit:
|
.exit:
|
||||||
push eax
|
push eax
|
||||||
lea edi, [eax+ebx] ;cleanup remain space
|
lea edi, [eax+ebx] ;cleanup remain space
|
||||||
mov ecx, 4096 ;from file end
|
mov ecx, 4096 ;from file end
|
||||||
and ebx, 4095
|
and ebx, 4095
|
||||||
jz @f
|
jz @f
|
||||||
sub ecx, ebx
|
sub ecx, ebx
|
||||||
@ -636,7 +636,8 @@ proc load_file stdcall, file_name:dword
|
|||||||
pop esi
|
pop esi
|
||||||
ret
|
ret
|
||||||
.cleanup:
|
.cleanup:
|
||||||
stdcall kernel_free, [file]
|
mov ecx, [file]
|
||||||
|
call @mem_free@4
|
||||||
.fail:
|
.fail:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
xor ebx, ebx
|
xor ebx, ebx
|
||||||
@ -826,12 +827,10 @@ proc load_driver stdcall, driver_name:dword
|
|||||||
mov dword [edi], '.obj'
|
mov dword [edi], '.obj'
|
||||||
mov byte [edi+4], 0
|
mov byte [edi+4], 0
|
||||||
stdcall load_file, edx
|
stdcall load_file, edx
|
||||||
|
mov [coff], eax
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .exit
|
jz .exit
|
||||||
|
|
||||||
mov [coff], eax
|
|
||||||
|
|
||||||
movzx ebx, [eax+CFH.nSections]
|
movzx ebx, [eax+CFH.nSections]
|
||||||
lea edx, [eax+20]
|
lea edx, [eax+20]
|
||||||
xor ecx, ecx
|
xor ecx, ecx
|
||||||
@ -847,6 +846,7 @@ proc load_driver stdcall, driver_name:dword
|
|||||||
mov edx, PG_SW
|
mov edx, PG_SW
|
||||||
call @mem_alloc@8
|
call @mem_alloc@8
|
||||||
test eax, eax
|
test eax, eax
|
||||||
|
mov [img_base], eax
|
||||||
jz .fail
|
jz .fail
|
||||||
|
|
||||||
mov [img_base], eax
|
mov [img_base], eax
|
||||||
@ -923,14 +923,16 @@ proc load_driver stdcall, driver_name:dword
|
|||||||
stdcall get_coff_sym,[sym],[ebx+CFH.nSymbols],szSTART
|
stdcall get_coff_sym,[sym],[ebx+CFH.nSymbols],szSTART
|
||||||
mov [start], eax
|
mov [start], eax
|
||||||
|
|
||||||
stdcall kernel_free, [coff]
|
mov ecx, [coff]
|
||||||
|
call @mem_free@4
|
||||||
|
|
||||||
mov ebx, [start]
|
mov ebx, [start]
|
||||||
stdcall ebx, DRV_ENTRY
|
stdcall ebx, DRV_ENTRY
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz .ok
|
jnz .ok
|
||||||
|
|
||||||
stdcall kernel_free, [img_base]
|
mov ecx, [img_base]
|
||||||
|
call @mem_free@4
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret
|
ret
|
||||||
.ok:
|
.ok:
|
||||||
@ -961,9 +963,11 @@ proc load_driver stdcall, driver_name:dword
|
|||||||
mov esi, msg_CR
|
mov esi, msg_CR
|
||||||
call sys_msg_board_str
|
call sys_msg_board_str
|
||||||
.cleanup:
|
.cleanup:
|
||||||
stdcall kernel_free,[img_base]
|
mov ecx, [img_base]
|
||||||
|
call @mem_free@4
|
||||||
.fail:
|
.fail:
|
||||||
stdcall kernel_free, [coff]
|
mov ecx, [coff]
|
||||||
|
call @mem_free@4
|
||||||
.exit:
|
.exit:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret
|
ret
|
||||||
@ -1065,7 +1069,9 @@ proc load_library stdcall, file_name:dword
|
|||||||
stdcall get_coff_sym,[sym],[ebx+CFH.nSymbols],szEXPORTS
|
stdcall get_coff_sym,[sym],[ebx+CFH.nSymbols],szEXPORTS
|
||||||
mov [exports], eax
|
mov [exports], eax
|
||||||
|
|
||||||
stdcall kernel_free, [coff]
|
mov ecx, [coff]
|
||||||
|
call @mem_free@4
|
||||||
|
|
||||||
mov eax, [exports]
|
mov eax, [exports]
|
||||||
ret
|
ret
|
||||||
.fail:
|
.fail:
|
||||||
|
@ -9,20 +9,20 @@ $Revision$
|
|||||||
|
|
||||||
|
|
||||||
iglobal
|
iglobal
|
||||||
szKernel db 'KERNEL', 0
|
szKernel db 'KERNEL', 0
|
||||||
szVersion db 'version',0
|
szVersion db 'version',0
|
||||||
|
|
||||||
szRegService db 'RegService',0
|
szRegService db 'RegService',0
|
||||||
szGetService db 'GetService',0
|
szGetService db 'GetService',0
|
||||||
szServiceHandler db 'ServiceHandler',0
|
szServiceHandler db 'ServiceHandler',0
|
||||||
szAttachIntHandler db 'AttachIntHandler',0
|
szAttachIntHandler db 'AttachIntHandler',0
|
||||||
szGetIntHandler db 'GetIntHandler', 0
|
szGetIntHandler db 'GetIntHandler', 0
|
||||||
szFpuSave db 'FpuSave',0
|
szFpuSave db 'FpuSave',0
|
||||||
szFpuRestore db 'FpuRestore',0
|
szFpuRestore db 'FpuRestore',0
|
||||||
szReservePortArea db 'ReservePortArea',0
|
szReservePortArea db 'ReservePortArea',0
|
||||||
szBoot_Log db 'Boot_Log',0
|
szBoot_Log db 'Boot_Log',0
|
||||||
|
|
||||||
szPciApi db 'PciApi', 0
|
szPciApi db 'PciApi', 0
|
||||||
szPciRead32 db 'PciRead32', 0
|
szPciRead32 db 'PciRead32', 0
|
||||||
szPciRead16 db 'PciRead16', 0
|
szPciRead16 db 'PciRead16', 0
|
||||||
szPciRead8 db 'PciRead8', 0
|
szPciRead8 db 'PciRead8', 0
|
||||||
@ -33,7 +33,7 @@ iglobal
|
|||||||
szAllocPage db 'AllocPage',0
|
szAllocPage db 'AllocPage',0
|
||||||
szFreePage db 'FreePage',0
|
szFreePage db 'FreePage',0
|
||||||
szGetPgAddr db 'GetPgAddr',0
|
szGetPgAddr db 'GetPgAddr',0
|
||||||
szMapPage db 'MapPage',0
|
szMapPage db 'MapPage',0
|
||||||
szMapSpace db 'MapSpace',0
|
szMapSpace db 'MapSpace',0
|
||||||
szMapIoMem db 'MapIoMem',0
|
szMapIoMem db 'MapIoMem',0
|
||||||
szCommitPages db 'CommitPages',0
|
szCommitPages db 'CommitPages',0
|
||||||
@ -41,15 +41,15 @@ iglobal
|
|||||||
|
|
||||||
szAllocKernelSpace db 'AllocKernelSpace',0
|
szAllocKernelSpace db 'AllocKernelSpace',0
|
||||||
szFreeKernelSpace db 'FreeKernelSpace',0
|
szFreeKernelSpace db 'FreeKernelSpace',0
|
||||||
szHeapAlloc db 'HeapAlloc',0
|
szMemAlloc db 'MemAlloc',0
|
||||||
szKernelFree db 'KernelFree',0
|
szMemFree db 'MemFree',0
|
||||||
szUserAlloc db 'UserAlloc',0
|
szUserAlloc db 'UserAlloc',0
|
||||||
szUserFree db 'UserFree',0
|
szUserFree db 'UserFree',0
|
||||||
szKmalloc db 'Kmalloc',0
|
szKmalloc db 'Kmalloc',0
|
||||||
szKfree db 'Kfree',0
|
szKfree db 'Kfree',0
|
||||||
szCreateRingBuffer db 'CreateRingBuffer',0
|
szCreateRingBuffer db 'CreateRingBuffer',0
|
||||||
|
|
||||||
szGetPid db 'GetPid',0
|
szGetPid db 'GetPid',0
|
||||||
szCreateObject db 'CreateObject',0
|
szCreateObject db 'CreateObject',0
|
||||||
szDestroyObject db 'DestroyObject',0
|
szDestroyObject db 'DestroyObject',0
|
||||||
szCreateEvent db 'CreateEvent',0
|
szCreateEvent db 'CreateEvent',0
|
||||||
@ -71,15 +71,15 @@ iglobal
|
|||||||
szLoadFile db 'LoadFile',0
|
szLoadFile db 'LoadFile',0
|
||||||
szSendEvent db 'SendEvent',0
|
szSendEvent db 'SendEvent',0
|
||||||
szSetMouseData db 'SetMouseData',0
|
szSetMouseData db 'SetMouseData',0
|
||||||
szSleep db 'Sleep',0
|
szSleep db 'Sleep',0
|
||||||
szGetTimerTicks db 'GetTimerTicks',0
|
szGetTimerTicks db 'GetTimerTicks',0
|
||||||
|
|
||||||
szStrncat db 'strncat',0
|
szStrncat db 'strncat',0
|
||||||
szStrncpy db 'strncpy',0
|
szStrncpy db 'strncpy',0
|
||||||
szstrncmp db 'strncmp',0
|
szstrncmp db 'strncmp',0
|
||||||
szStrnlen db 'strnlen',0
|
szStrnlen db 'strnlen',0
|
||||||
szStrchr db 'strchr',0
|
szStrchr db 'strchr',0
|
||||||
szStrrchr db 'strrchr',0
|
szStrrchr db 'strrchr',0
|
||||||
|
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
@ -104,18 +104,18 @@ kernel_export:
|
|||||||
|
|
||||||
dd szAllocPage , _alloc_page ;stdcall
|
dd szAllocPage , _alloc_page ;stdcall
|
||||||
dd szFreePage , free_page
|
dd szFreePage , free_page
|
||||||
dd szMapPage , map_page ;stdcall
|
dd szMapPage , map_page ;stdcall
|
||||||
dd szMapSpace , map_space
|
dd szMapSpace , map_space
|
||||||
dd szMapIoMem , map_io_mem ;stdcall
|
dd szMapIoMem , map_io_mem ;stdcall
|
||||||
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 szFreeKernelSpace , free_kernel_space ;stdcall
|
dd szFreeKernelSpace , free_kernel_space ;stdcall
|
||||||
dd szHeapAlloc , @mem_alloc@8 ;fastcall
|
dd szMemAlloc , @mem_alloc@8 ;fastcall
|
||||||
dd szKernelFree , kernel_free ;stdcall
|
dd szMemFree , @mem_free@4 ;fastcall
|
||||||
dd szUserAlloc , user_alloc ;stdcall
|
dd szUserAlloc , user_alloc ;stdcall
|
||||||
dd szUserFree , user_free ;stdcall
|
dd szUserFree , user_free ;stdcall
|
||||||
dd szKmalloc , malloc
|
dd szKmalloc , malloc
|
||||||
dd szKfree , free
|
dd szKfree , free
|
||||||
dd szCreateRingBuffer, create_ring_buffer ;stdcall
|
dd szCreateRingBuffer, create_ring_buffer ;stdcall
|
||||||
|
@ -8,36 +8,12 @@
|
|||||||
$Revision$
|
$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
|
MEM_LIST_OFFSET equ 8
|
||||||
FREE_BLOCK equ 4
|
FREE_BLOCK equ 4
|
||||||
USED_BLOCK equ 8
|
USED_BLOCK equ 8
|
||||||
DONT_FREE_BLOCK equ 10h
|
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
|
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
|
||||||
@ -46,21 +22,6 @@ proc free_kernel_space stdcall uses ebx ecx edx esi edi, base:dword
|
|||||||
endp
|
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 ;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;; USER ;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
HEAP_TOP equ 0x5FC00000
|
HEAP_TOP equ 0x5FC00000
|
||||||
|
@ -38,9 +38,13 @@ proc load_PE stdcall, file_name:dword
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jnz .cleanup
|
jnz .cleanup
|
||||||
|
|
||||||
stdcall kernel_free, [base]
|
mov ecx, [base]
|
||||||
|
call @mem_free@4
|
||||||
|
|
||||||
.cleanup:
|
.cleanup:
|
||||||
stdcall kernel_free, [image]
|
mov ecx, [image]
|
||||||
|
call @mem_free@4
|
||||||
|
|
||||||
mov eax, [entry]
|
mov eax, [entry]
|
||||||
ret
|
ret
|
||||||
.fail:
|
.fail:
|
||||||
@ -54,237 +58,236 @@ PTR equ
|
|||||||
align 4
|
align 4
|
||||||
map_PE: ;stdcall base:dword, image:dword
|
map_PE: ;stdcall base:dword, image:dword
|
||||||
cld
|
cld
|
||||||
push ebp
|
push ebp
|
||||||
push edi
|
push edi
|
||||||
push esi
|
push esi
|
||||||
push ebx
|
push ebx
|
||||||
sub esp, 60
|
sub esp, 60
|
||||||
mov ebx, DWORD PTR [esp+84]
|
mov ebx, DWORD PTR [esp+84]
|
||||||
mov ebp, DWORD PTR [esp+80]
|
mov ebp, DWORD PTR [esp+80]
|
||||||
mov edx, ebx
|
mov edx, ebx
|
||||||
mov esi, ebx
|
mov esi, ebx
|
||||||
add edx, DWORD PTR [ebx+60]
|
add edx, DWORD PTR [ebx+60]
|
||||||
mov edi, ebp
|
mov edi, ebp
|
||||||
mov DWORD PTR [esp+32], edx
|
mov DWORD PTR [esp+32], edx
|
||||||
mov ecx, DWORD PTR [edx+84]
|
mov ecx, DWORD PTR [edx+84]
|
||||||
|
|
||||||
shr ecx, 2
|
shr ecx, 2
|
||||||
rep movsd
|
rep movsd
|
||||||
|
|
||||||
movzx eax, WORD PTR [edx+6]
|
movzx eax, WORD PTR [edx+6]
|
||||||
mov DWORD PTR [esp+36], 0
|
mov DWORD PTR [esp+36], 0
|
||||||
mov DWORD PTR [esp+16], eax
|
mov DWORD PTR [esp+16], eax
|
||||||
jmp L2
|
jmp L2
|
||||||
L3:
|
L3:
|
||||||
mov eax, DWORD PTR [edx+264]
|
mov eax, DWORD PTR [edx+264]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
je L4
|
je L4
|
||||||
mov esi, ebx
|
mov esi, ebx
|
||||||
mov edi, ebp
|
mov edi, ebp
|
||||||
add esi, DWORD PTR [edx+268]
|
add esi, DWORD PTR [edx+268]
|
||||||
mov ecx, eax
|
mov ecx, eax
|
||||||
add edi, DWORD PTR [edx+260]
|
add edi, DWORD PTR [edx+260]
|
||||||
|
|
||||||
shr ecx, 2
|
shr ecx, 2
|
||||||
rep movsd
|
rep movsd
|
||||||
|
|
||||||
L4:
|
L4:
|
||||||
mov ecx, DWORD PTR [edx+256]
|
mov ecx, DWORD PTR [edx+256]
|
||||||
add ecx, 4095
|
add ecx, 4095
|
||||||
and ecx, -4096
|
and ecx, -4096
|
||||||
cmp ecx, eax
|
cmp ecx, eax
|
||||||
jbe L6
|
jbe L6
|
||||||
sub ecx, eax
|
sub ecx, eax
|
||||||
add eax, DWORD PTR [edx+260]
|
add eax, DWORD PTR [edx+260]
|
||||||
lea edi, [eax+ebp]
|
lea edi, [eax+ebp]
|
||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
rep stosb
|
rep stosb
|
||||||
|
|
||||||
L6:
|
L6:
|
||||||
inc DWORD PTR [esp+36]
|
inc DWORD PTR [esp+36]
|
||||||
add edx, 40
|
add edx, 40
|
||||||
L2:
|
L2:
|
||||||
mov esi, DWORD PTR [esp+16]
|
mov esi, DWORD PTR [esp+16]
|
||||||
cmp DWORD PTR [esp+36], esi
|
cmp DWORD PTR [esp+36], esi
|
||||||
jne L3
|
jne L3
|
||||||
mov edi, DWORD PTR [esp+32]
|
mov edi, DWORD PTR [esp+32]
|
||||||
cmp DWORD PTR [edi+164], 0
|
cmp DWORD PTR [edi+164], 0
|
||||||
je L9
|
je L9
|
||||||
mov esi, ebp
|
mov esi, ebp
|
||||||
mov ecx, ebp
|
mov ecx, ebp
|
||||||
sub esi, DWORD PTR [edi+52]
|
sub esi, DWORD PTR [edi+52]
|
||||||
add ecx, DWORD PTR [edi+160]
|
add ecx, DWORD PTR [edi+160]
|
||||||
mov eax, esi
|
mov eax, esi
|
||||||
shr eax, 16
|
shr eax, 16
|
||||||
mov DWORD PTR [esp+12], eax
|
mov DWORD PTR [esp+12], eax
|
||||||
jmp L11
|
jmp L11
|
||||||
L12:
|
L12:
|
||||||
lea ebx, [eax-8]
|
lea ebx, [eax-8]
|
||||||
xor edi, edi
|
xor edi, edi
|
||||||
shr ebx,1
|
shr ebx,1
|
||||||
jmp L13
|
jmp L13
|
||||||
L14:
|
L14:
|
||||||
movzx eax, WORD PTR [ecx+8+edi*2]
|
movzx eax, WORD PTR [ecx+8+edi*2]
|
||||||
mov edx, eax
|
mov edx, eax
|
||||||
shr eax, 12
|
shr eax, 12
|
||||||
and edx, 4095
|
and edx, 4095
|
||||||
add edx, DWORD PTR [ecx]
|
add edx, DWORD PTR [ecx]
|
||||||
cmp ax, 2
|
cmp ax, 2
|
||||||
je L17
|
je L17
|
||||||
cmp ax, 3
|
cmp ax, 3
|
||||||
je L18
|
je L18
|
||||||
dec ax
|
dec ax
|
||||||
jne L15
|
jne L15
|
||||||
mov eax, DWORD PTR [esp+12]
|
mov eax, DWORD PTR [esp+12]
|
||||||
add WORD PTR [edx+ebp], ax
|
add WORD PTR [edx+ebp], ax
|
||||||
L17:
|
L17:
|
||||||
add WORD PTR [edx+ebp], si
|
add WORD PTR [edx+ebp], si
|
||||||
L18:
|
L18:
|
||||||
add DWORD PTR [edx+ebp], esi
|
add DWORD PTR [edx+ebp], esi
|
||||||
L15:
|
L15:
|
||||||
inc edi
|
inc edi
|
||||||
L13:
|
L13:
|
||||||
cmp edi, ebx
|
cmp edi, ebx
|
||||||
jne L14
|
jne L14
|
||||||
add ecx, DWORD PTR [ecx+4]
|
add ecx, DWORD PTR [ecx+4]
|
||||||
L11:
|
L11:
|
||||||
mov eax, DWORD PTR [ecx+4]
|
mov eax, DWORD PTR [ecx+4]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jne L12
|
jne L12
|
||||||
L9:
|
L9:
|
||||||
mov edx, DWORD PTR [esp+32]
|
mov edx, DWORD PTR [esp+32]
|
||||||
cmp DWORD PTR [edx+132], 0
|
cmp DWORD PTR [edx+132], 0
|
||||||
je L20
|
je L20
|
||||||
mov eax, ebp
|
mov eax, ebp
|
||||||
add eax, DWORD PTR [edx+128]
|
add eax, DWORD PTR [edx+128]
|
||||||
mov DWORD PTR [esp+40], 0
|
mov DWORD PTR [esp+40], 0
|
||||||
add eax, 20
|
add eax, 20
|
||||||
mov DWORD PTR [esp+56], eax
|
mov DWORD PTR [esp+56], eax
|
||||||
L22:
|
L22:
|
||||||
mov ecx, DWORD PTR [esp+56]
|
mov ecx, DWORD PTR [esp+56]
|
||||||
cmp DWORD PTR [ecx-16], 0
|
cmp DWORD PTR [ecx-16], 0
|
||||||
jne L23
|
jne L23
|
||||||
cmp DWORD PTR [ecx-8], 0
|
cmp DWORD PTR [ecx-8], 0
|
||||||
je L25
|
je L25
|
||||||
L23:
|
L23:
|
||||||
mov edi, DWORD PTR [__exports+32]
|
mov edi, DWORD PTR [__exports+32]
|
||||||
mov esi, DWORD PTR [__exports+28]
|
mov esi, DWORD PTR [__exports+28]
|
||||||
mov eax, DWORD PTR [esp+56]
|
mov eax, DWORD PTR [esp+56]
|
||||||
mov DWORD PTR [esp+20], edi
|
mov DWORD PTR [esp+20], edi
|
||||||
add edi, OS_BASE
|
add edi, OS_BASE
|
||||||
add esi, OS_BASE
|
add esi, OS_BASE
|
||||||
mov DWORD PTR [esp+44], esi
|
mov DWORD PTR [esp+44], esi
|
||||||
mov ecx, DWORD PTR [eax-4]
|
mov ecx, DWORD PTR [eax-4]
|
||||||
mov DWORD PTR [esp+48], edi
|
mov DWORD PTR [esp+48], edi
|
||||||
mov edx, DWORD PTR [eax-20]
|
mov edx, DWORD PTR [eax-20]
|
||||||
mov DWORD PTR [esp+52], 0
|
mov DWORD PTR [esp+52], 0
|
||||||
add ecx, ebp
|
add ecx, ebp
|
||||||
add edx, ebp
|
add edx, ebp
|
||||||
mov DWORD PTR [esp+24], edx
|
mov DWORD PTR [esp+24], edx
|
||||||
mov DWORD PTR [esp+28], ecx
|
mov DWORD PTR [esp+28], ecx
|
||||||
L26:
|
L26:
|
||||||
mov esi, DWORD PTR [esp+52]
|
mov esi, DWORD PTR [esp+52]
|
||||||
mov edi, DWORD PTR [esp+24]
|
mov edi, DWORD PTR [esp+24]
|
||||||
mov eax, DWORD PTR [edi+esi*4]
|
mov eax, DWORD PTR [edi+esi*4]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
je L27
|
je L27
|
||||||
test eax, eax
|
test eax, eax
|
||||||
js L27
|
js L27
|
||||||
lea edi, [ebp+eax]
|
lea edi, [ebp+eax]
|
||||||
mov eax, DWORD PTR [esp+28]
|
mov eax, DWORD PTR [esp+28]
|
||||||
mov DWORD PTR [eax+esi*4], 0
|
mov DWORD PTR [eax+esi*4], 0
|
||||||
lea esi, [edi+2]
|
lea esi, [edi+2]
|
||||||
push eax
|
push eax
|
||||||
push 32
|
push 32
|
||||||
movzx eax, WORD PTR [edi]
|
movzx eax, WORD PTR [edi]
|
||||||
mov edx, DWORD PTR [esp+56]
|
mov edx, DWORD PTR [esp+56]
|
||||||
mov eax, DWORD PTR [edx+eax*4]
|
mov eax, DWORD PTR [edx+eax*4]
|
||||||
add eax, OS_BASE
|
add eax, OS_BASE
|
||||||
push eax
|
push eax
|
||||||
push esi
|
push esi
|
||||||
call strncmp
|
call strncmp
|
||||||
pop ebx
|
pop ebx
|
||||||
xor ebx, ebx
|
xor ebx, ebx
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jne L32
|
jne L32
|
||||||
jmp L30
|
jmp L30
|
||||||
L33:
|
L33:
|
||||||
push ecx
|
push ecx
|
||||||
push 32
|
push 32
|
||||||
mov ecx, DWORD PTR [esp+28]
|
mov ecx, DWORD PTR [esp+28]
|
||||||
mov eax, DWORD PTR [ecx+OS_BASE+ebx*4]
|
mov eax, DWORD PTR [ecx+OS_BASE+ebx*4]
|
||||||
add eax, OS_BASE
|
add eax, OS_BASE
|
||||||
push eax
|
push eax
|
||||||
push esi
|
push esi
|
||||||
call strncmp
|
call strncmp
|
||||||
pop edx
|
pop edx
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jne L34
|
jne L34
|
||||||
mov esi, DWORD PTR [esp+44]
|
mov esi, DWORD PTR [esp+44]
|
||||||
mov edx, DWORD PTR [esp+52]
|
mov edx, DWORD PTR [esp+52]
|
||||||
mov ecx, DWORD PTR [esp+28]
|
mov ecx, DWORD PTR [esp+28]
|
||||||
mov eax, DWORD PTR [esi+ebx*4]
|
mov eax, DWORD PTR [esi+ebx*4]
|
||||||
add eax, OS_BASE
|
add eax, OS_BASE
|
||||||
mov DWORD PTR [ecx+edx*4], eax
|
mov DWORD PTR [ecx+edx*4], eax
|
||||||
jmp L36
|
jmp L36
|
||||||
L34:
|
L34:
|
||||||
inc ebx
|
inc ebx
|
||||||
L32:
|
L32:
|
||||||
cmp ebx, DWORD PTR [__exports+24]
|
cmp ebx, DWORD PTR [__exports+24]
|
||||||
jb L33
|
jb L33
|
||||||
L36:
|
L36:
|
||||||
cmp ebx, DWORD PTR [__exports+24]
|
cmp ebx, DWORD PTR [__exports+24]
|
||||||
jne L37
|
jne L37
|
||||||
|
|
||||||
mov esi, msg_unresolved
|
mov esi, msg_unresolved
|
||||||
call sys_msg_board_str
|
call sys_msg_board_str
|
||||||
lea esi, [edi+2]
|
lea esi, [edi+2]
|
||||||
call sys_msg_board_str
|
call sys_msg_board_str
|
||||||
mov esi, msg_CR
|
mov esi, msg_CR
|
||||||
call sys_msg_board_str
|
call sys_msg_board_str
|
||||||
|
|
||||||
mov DWORD PTR [esp+40], 1
|
mov DWORD PTR [esp+40], 1
|
||||||
jmp L37
|
jmp L37
|
||||||
L30:
|
L30:
|
||||||
movzx eax, WORD PTR [edi]
|
movzx eax, WORD PTR [edi]
|
||||||
mov esi, DWORD PTR [esp+44]
|
mov esi, DWORD PTR [esp+44]
|
||||||
mov edi, DWORD PTR [esp+52]
|
mov edi, DWORD PTR [esp+52]
|
||||||
mov edx, DWORD PTR [esp+28]
|
mov edx, DWORD PTR [esp+28]
|
||||||
mov eax, DWORD PTR [esi+eax*4]
|
mov eax, DWORD PTR [esi+eax*4]
|
||||||
add eax, OS_BASE
|
add eax, OS_BASE
|
||||||
mov DWORD PTR [edx+edi*4], eax
|
mov DWORD PTR [edx+edi*4], eax
|
||||||
L37:
|
L37:
|
||||||
inc DWORD PTR [esp+52]
|
inc DWORD PTR [esp+52]
|
||||||
jmp L26
|
jmp L26
|
||||||
L27:
|
L27:
|
||||||
add DWORD PTR [esp+56], 20
|
add DWORD PTR [esp+56], 20
|
||||||
jmp L22
|
jmp L22
|
||||||
L25:
|
L25:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
cmp DWORD PTR [esp+40], 0
|
cmp DWORD PTR [esp+40], 0
|
||||||
jne L40
|
jne L40
|
||||||
L20:
|
L20:
|
||||||
mov ecx, DWORD PTR [esp+32]
|
mov ecx, DWORD PTR [esp+32]
|
||||||
mov eax, ebp
|
mov eax, ebp
|
||||||
add eax, DWORD PTR [ecx+40]
|
add eax, DWORD PTR [ecx+40]
|
||||||
L40:
|
L40:
|
||||||
add esp, 60
|
add esp, 60
|
||||||
pop ebx
|
pop ebx
|
||||||
pop esi
|
pop esi
|
||||||
pop edi
|
pop edi
|
||||||
pop ebp
|
pop ebp
|
||||||
ret 8
|
ret 8
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
__exports:
|
__exports:
|
||||||
export 'KERNEL', \
|
export 'KERNEL', \
|
||||||
commit_pages, 'CommitPages', \ ; eax, ebx, ecx
|
commit_pages, 'CommitPages', \ ; eax, ebx, ecx
|
||||||
create_kernel_object, 'CreateObject', \
|
create_kernel_object, 'CreateObject', \
|
||||||
create_ring_buffer, 'CreateRingBuffer', \ ; stdcall
|
create_ring_buffer, 'CreateRingBuffer', \ ; stdcall
|
||||||
destroy_kernel_object, 'DestroyObject', \
|
destroy_kernel_object, 'DestroyObject', \
|
||||||
free_kernel_space, 'FreeKernelSpace', \ ; stdcall
|
free_kernel_space, 'FreeKernelSpace', \ ; stdcall
|
||||||
kernel_free, 'KernelFree', \ ; stdcall
|
|
||||||
malloc, 'Kmalloc', \
|
malloc, 'Kmalloc', \
|
||||||
free, 'Kfree', \
|
free, 'Kfree', \
|
||||||
map_io_mem, 'MapIoMem', \ ; stdcall
|
map_io_mem, 'MapIoMem', \ ; stdcall
|
||||||
|
@ -235,7 +235,8 @@ end if
|
|||||||
call set_cr3
|
call set_cr3
|
||||||
.err:
|
.err:
|
||||||
.err_hdr:
|
.err_hdr:
|
||||||
stdcall kernel_free,[file_base]
|
mov ecx, [file_base]
|
||||||
|
call @mem_free@4
|
||||||
.err_file:
|
.err_file:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov [application_table_status],eax
|
mov [application_table_status],eax
|
||||||
|
@ -72,7 +72,7 @@ v86_create:
|
|||||||
mov edi, eax
|
mov edi, eax
|
||||||
add eax, 1000h
|
add eax, 1000h
|
||||||
push eax
|
push eax
|
||||||
call get_pg_addr
|
sub eax, OS_BASE
|
||||||
or al, PG_UW
|
or al, PG_UW
|
||||||
stosd
|
stosd
|
||||||
; ...and also copy system page tables
|
; ...and also copy system page tables
|
||||||
@ -143,7 +143,11 @@ v86_create:
|
|||||||
; destroys: eax, ebx, ecx, edx (due to free)
|
; destroys: eax, ebx, ecx, edx (due to free)
|
||||||
v86_destroy:
|
v86_destroy:
|
||||||
push eax
|
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
|
pop eax
|
||||||
jmp free
|
jmp free
|
||||||
|
|
||||||
|
@ -44,14 +44,14 @@ kernel_export \
|
|||||||
CommitPages,\
|
CommitPages,\
|
||||||
ReleasePages,\
|
ReleasePages,\
|
||||||
\
|
\
|
||||||
FreeKernelSpace,\
|
FreeKernelSpace, \
|
||||||
HeapAlloc,\
|
MemAlloc, \
|
||||||
KernelFree,\
|
MemFree, \
|
||||||
UserAlloc,\
|
UserAlloc, \
|
||||||
UserFree,\
|
UserFree, \
|
||||||
Kmalloc,\
|
Kmalloc, \
|
||||||
Kfree,\
|
Kfree, \
|
||||||
CreateRingBuffer,\
|
CreateRingBuffer, \
|
||||||
\
|
\
|
||||||
GetPid,\
|
GetPid,\
|
||||||
CreateObject,\
|
CreateObject,\
|
||||||
|
@ -83,7 +83,7 @@ proc START stdcall, state:dword
|
|||||||
|
|
||||||
mov ecx, 16*512
|
mov ecx, 16*512
|
||||||
mov edx, PG_SW
|
mov edx, PG_SW
|
||||||
call HeapAlloc
|
call MemAlloc
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .out_of_mem
|
jz .out_of_mem
|
||||||
mov [mix_buff], eax
|
mov [mix_buff], eax
|
||||||
@ -426,7 +426,7 @@ proc CreateBuffer stdcall, format:dword, size:dword
|
|||||||
add ecx, 128 ;resampler required
|
add ecx, 128 ;resampler required
|
||||||
mov [eax+STREAM.in_size], ecx
|
mov [eax+STREAM.in_size], ecx
|
||||||
mov edx, PG_SW
|
mov edx, PG_SW
|
||||||
call HeapAlloc
|
call MemAlloc
|
||||||
|
|
||||||
mov edi, [str]
|
mov edi, [str]
|
||||||
mov [edi+STREAM.in_base], eax
|
mov [edi+STREAM.in_base], eax
|
||||||
@ -513,9 +513,11 @@ DestroyBuffer:
|
|||||||
mov [ecx+STREAM.str_fd], ebx
|
mov [ecx+STREAM.str_fd], ebx
|
||||||
popf
|
popf
|
||||||
|
|
||||||
stdcall KernelFree, [eax+STREAM.in_base]
|
mov ecx, [eax+STREAM.in_base]
|
||||||
|
call MemFree
|
||||||
mov eax, [.handle]
|
mov eax, [.handle]
|
||||||
stdcall KernelFree, [eax+STREAM.out_base]
|
mov ecx, [eax+STREAM.out_base]
|
||||||
|
call MemFree
|
||||||
|
|
||||||
pop eax ;restore stack
|
pop eax ;restore stack
|
||||||
call DestroyObject ;eax= stream
|
call DestroyObject ;eax= stream
|
||||||
|
@ -511,7 +511,7 @@ proc create_primary_buff
|
|||||||
|
|
||||||
mov ecx, 0x10000
|
mov ecx, 0x10000
|
||||||
mov edx, PG_SW
|
mov edx, PG_SW
|
||||||
call HeapAlloc
|
call MemAlloc
|
||||||
mov [ctrl.buffer], eax
|
mov [ctrl.buffer], eax
|
||||||
|
|
||||||
mov edi, eax
|
mov edi, eax
|
||||||
|
@ -533,7 +533,7 @@ proc create_primary_buff
|
|||||||
|
|
||||||
mov ecx, 0x10000
|
mov ecx, 0x10000
|
||||||
mov edx, PG_SW
|
mov edx, PG_SW
|
||||||
call HeapAlloc
|
call MemAlloc
|
||||||
mov [ctrl.buffer], eax
|
mov [ctrl.buffer], eax
|
||||||
|
|
||||||
mov edi, eax
|
mov edi, eax
|
||||||
|
@ -168,12 +168,12 @@ ntfs_setup: ; CODE XREF: part_set.inc
|
|||||||
@@:
|
@@:
|
||||||
; $MFT and $MFTMirr invalid!
|
; $MFT and $MFTMirr invalid!
|
||||||
.fail_free_frs:
|
.fail_free_frs:
|
||||||
push [ntfs_data.frs_buffer]
|
mov ecx, [ntfs_data.frs_buffer]
|
||||||
call kernel_free
|
call @mem_free@4
|
||||||
jmp problem_fat_dec_count
|
jmp problem_fat_dec_count
|
||||||
.fail_free_mft:
|
.fail_free_mft:
|
||||||
push [ntfs_data.mft_retrieval]
|
mov ecx, [ntfs_data.mft_retrieval]
|
||||||
call kernel_free
|
call @mem_free@4
|
||||||
jmp .fail_free_frs
|
jmp .fail_free_frs
|
||||||
.mftok:
|
.mftok:
|
||||||
; read $MFT table retrieval information
|
; read $MFT table retrieval information
|
||||||
@ -259,9 +259,9 @@ ntfs_setup: ; CODE XREF: part_set.inc
|
|||||||
mov ecx, [ntfs_data.mft_retrieval_size]
|
mov ecx, [ntfs_data.mft_retrieval_size]
|
||||||
add ecx, ecx
|
add ecx, ecx
|
||||||
rep movsd
|
rep movsd
|
||||||
push [ntfs_data.mft_retrieval]
|
mov ecx, [ntfs_data.mft_retrieval]
|
||||||
mov [ntfs_data.mft_retrieval], eax
|
mov [ntfs_data.mft_retrieval], eax
|
||||||
call kernel_free
|
call @mem_free@4
|
||||||
mov eax, [ntfs_data.mft_retrieval_size]
|
mov eax, [ntfs_data.mft_retrieval_size]
|
||||||
.ok:
|
.ok:
|
||||||
shl eax, 3
|
shl eax, 3
|
||||||
@ -980,8 +980,8 @@ ntfs_find_lfn:
|
|||||||
@@:
|
@@:
|
||||||
; reallocate
|
; reallocate
|
||||||
push eax
|
push eax
|
||||||
push [ntfs_data.cur_index_buf]
|
mov ecx, [ntfs_data.cur_index_buf]
|
||||||
call kernel_free
|
call @mem_free@4
|
||||||
pop ecx
|
pop ecx
|
||||||
mov [ntfs_data.cur_index_size], ecx
|
mov [ntfs_data.cur_index_size], ecx
|
||||||
mov edx, PG_SW
|
mov edx, PG_SW
|
||||||
@ -1013,10 +1013,10 @@ ntfs_find_lfn:
|
|||||||
rep movsd
|
rep movsd
|
||||||
mov esi, eax
|
mov esi, eax
|
||||||
mov [ntfs_data.cur_index_size], ebp
|
mov [ntfs_data.cur_index_size], ebp
|
||||||
push esi ebp
|
|
||||||
push [ntfs_data.cur_index_buf]
|
mov ecx, [ntfs_data.cur_index_buf]
|
||||||
call kernel_free
|
call @mem_free@4
|
||||||
pop ebp esi
|
|
||||||
mov [ntfs_data.cur_index_buf], esi
|
mov [ntfs_data.cur_index_buf], esi
|
||||||
.ok2:
|
.ok2:
|
||||||
add esi, 10h
|
add esi, 10h
|
||||||
@ -1327,8 +1327,8 @@ ntfs_HdReadFolder:
|
|||||||
@@:
|
@@:
|
||||||
; reallocate
|
; reallocate
|
||||||
push eax
|
push eax
|
||||||
push [ntfs_data.cur_index_buf]
|
mov ecx, [ntfs_data.cur_index_buf]
|
||||||
call kernel_free
|
call @mem_free@4
|
||||||
pop ecx
|
pop ecx
|
||||||
mov [ntfs_data.cur_index_size], ecx
|
mov [ntfs_data.cur_index_size], ecx
|
||||||
mov edx, PG_SW
|
mov edx, PG_SW
|
||||||
@ -1365,10 +1365,10 @@ ntfs_HdReadFolder:
|
|||||||
rep movsd
|
rep movsd
|
||||||
mov esi, eax
|
mov esi, eax
|
||||||
mov [ntfs_data.cur_index_size], ebp
|
mov [ntfs_data.cur_index_size], ebp
|
||||||
push esi ebp
|
|
||||||
push [ntfs_data.cur_index_buf]
|
mov ecx, [ntfs_data.cur_index_buf]
|
||||||
call kernel_free
|
call @mem_free@4
|
||||||
pop ebp esi
|
|
||||||
mov [ntfs_data.cur_index_buf], esi
|
mov [ntfs_data.cur_index_buf], esi
|
||||||
.ok2:
|
.ok2:
|
||||||
add esi, 10h
|
add esi, 10h
|
||||||
|
@ -27,7 +27,9 @@ read_skin_file:
|
|||||||
mov esi, eax
|
mov esi, eax
|
||||||
mov edi, skin_data
|
mov edi, skin_data
|
||||||
rep movsd
|
rep movsd
|
||||||
stdcall kernel_free, eax
|
|
||||||
|
mov ecx, eax
|
||||||
|
call @mem_free@4
|
||||||
|
|
||||||
call parse_skin_data
|
call parse_skin_data
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
@ -37,9 +39,10 @@ read_skin_file:
|
|||||||
inc eax
|
inc eax
|
||||||
ret
|
ret
|
||||||
.noskin:
|
.noskin:
|
||||||
stdcall kernel_free, eax
|
mov ecx, eax
|
||||||
push 2
|
call @mem_free@4
|
||||||
pop eax
|
|
||||||
|
mov eax, 2
|
||||||
ret
|
ret
|
||||||
|
|
||||||
struct SKIN_HEADER
|
struct SKIN_HEADER
|
||||||
|
@ -142,6 +142,7 @@ extrn _init
|
|||||||
extrn _init_mm
|
extrn _init_mm
|
||||||
|
|
||||||
extrn @core_alloc@4
|
extrn @core_alloc@4
|
||||||
|
extrn @core_free@4
|
||||||
|
|
||||||
extrn @init_heap@8
|
extrn @init_heap@8
|
||||||
extrn @find_large_md@4
|
extrn @find_large_md@4
|
||||||
@ -2280,7 +2281,10 @@ sys_background:
|
|||||||
|
|
||||||
pushad
|
pushad
|
||||||
; return memory for old background
|
; return memory for old background
|
||||||
stdcall kernel_free, [img_background]
|
|
||||||
|
mov ecx, [img_background]
|
||||||
|
call @mem_free@4
|
||||||
|
|
||||||
; calculate RAW size
|
; calculate RAW size
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
inc eax
|
inc eax
|
||||||
|
@ -366,8 +366,8 @@ proc load_cursor stdcall, src:dword, flags:dword
|
|||||||
|
|
||||||
stdcall load_file, [src]
|
stdcall load_file, [src]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail
|
|
||||||
mov [src], eax
|
mov [src], eax
|
||||||
|
jz .fail
|
||||||
@@:
|
@@:
|
||||||
push ebx
|
push ebx
|
||||||
push esi
|
push esi
|
||||||
@ -383,7 +383,9 @@ proc load_cursor stdcall, src:dword, flags:dword
|
|||||||
|
|
||||||
cmp word [flags], LOAD_FROM_FILE
|
cmp word [flags], LOAD_FROM_FILE
|
||||||
jne .exit
|
jne .exit
|
||||||
stdcall kernel_free, [src]
|
|
||||||
|
mov ecx, [src]
|
||||||
|
call @mem_free@4
|
||||||
.exit:
|
.exit:
|
||||||
pop edi
|
pop edi
|
||||||
pop esi
|
pop esi
|
||||||
@ -436,7 +438,8 @@ align 4
|
|||||||
destroy_cursor:
|
destroy_cursor:
|
||||||
|
|
||||||
push eax
|
push eax
|
||||||
stdcall kernel_free, [eax+CURSOR.base]
|
mov ecx, [eax+CURSOR.base]
|
||||||
|
call @mem_free@4
|
||||||
pop eax
|
pop eax
|
||||||
|
|
||||||
call destroy_kernel_object
|
call destroy_kernel_object
|
||||||
|
Loading…
Reference in New Issue
Block a user