1273 lines
28 KiB
ArmAsm
1273 lines
28 KiB
ArmAsm
.file "vmm.c"
|
|
.intel_syntax
|
|
.text
|
|
.globl _vmm_init
|
|
.type _vmm_init, @function
|
|
_vmm_init:
|
|
push %ebp
|
|
mov %ebp, %esp
|
|
sub %esp, 24
|
|
mov DWORD PTR [%ebp-4], 0
|
|
.L2:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
cmp %eax, DWORD PTR _mb_info_block+20
|
|
jb .L5
|
|
jmp .L3
|
|
.L5:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
sal %eax, 4
|
|
mov %eax, DWORD PTR _mb_modules[%eax]
|
|
add %eax, 1073741824
|
|
mov DWORD PTR [%esp+8], %eax
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
sal %eax, 4
|
|
mov %eax, DWORD PTR _mb_modules[%eax+4]
|
|
dec %eax
|
|
mov DWORD PTR [%esp+4], %eax
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
sal %eax, 4
|
|
mov %eax, DWORD PTR _mb_modules[%eax]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _vmm_map_range
|
|
lea %eax, [%ebp-4]
|
|
inc DWORD PTR [%eax]
|
|
jmp .L2
|
|
.L3:
|
|
mov DWORD PTR [%ebp-4], 0
|
|
.L6:
|
|
cmp DWORD PTR [%ebp-4], 3
|
|
jle .L9
|
|
jmp .L7
|
|
.L9:
|
|
mov %ecx, DWORD PTR [%ebp-4]
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %edx, %eax
|
|
sal %edx, 4
|
|
mov %eax, OFFSET FLAT:_heapEntryHeadNodes
|
|
add %eax, %edx
|
|
mov DWORD PTR _heapEntryQueues[4+%ecx*8], %eax
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %ecx, %eax
|
|
sal %ecx, 4
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %edx, %eax
|
|
sal %edx, 4
|
|
mov %eax, OFFSET FLAT:_heapEntryTailNodes
|
|
add %eax, %edx
|
|
mov DWORD PTR _heapEntryHeadNodes[%ecx+8], %eax
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %ecx, %eax
|
|
sal %ecx, 4
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %edx, %eax
|
|
sal %edx, 4
|
|
mov %eax, OFFSET FLAT:_heapEntryHeadNodes
|
|
add %eax, %edx
|
|
mov DWORD PTR _heapEntryTailNodes[%ecx+12], %eax
|
|
lea %eax, [%ebp-4]
|
|
inc DWORD PTR [%eax]
|
|
jmp .L6
|
|
.L7:
|
|
mov DWORD PTR [%esp], OFFSET FLAT:_initialHEB
|
|
call _vmm_heb_init
|
|
mov DWORD PTR [%esp+8], OFFSET FLAT:_initialHEB
|
|
mov DWORD PTR [%esp+4], OFFSET FLAT:_heapEntryHeadNodes
|
|
mov DWORD PTR [%esp], 0
|
|
call _vmm_addToQueue
|
|
call _vmm_stripUnusedEntry
|
|
mov DWORD PTR [%ebp-8], %eax
|
|
mov %eax, DWORD PTR [%ebp-8]
|
|
mov DWORD PTR [%eax], -805306368
|
|
mov %eax, DWORD PTR [%ebp-8]
|
|
mov DWORD PTR [%eax+4], 536870912
|
|
mov %eax, DWORD PTR [%ebp-8]
|
|
mov DWORD PTR [%esp+8], %eax
|
|
mov DWORD PTR [%esp+4], OFFSET FLAT:_heapEntryHeadNodes+48
|
|
mov DWORD PTR [%esp], 3
|
|
call _vmm_addToQueue
|
|
leave
|
|
ret
|
|
.size _vmm_init, .-_vmm_init
|
|
.globl _vmm_map
|
|
.type _vmm_map, @function
|
|
_vmm_map:
|
|
push %ebp
|
|
mov %ebp, %esp
|
|
sub %esp, 24
|
|
lea %eax, [%ebp-4]
|
|
mov DWORD PTR [%esp+4], %eax
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _vmm_map_addr
|
|
leave
|
|
ret
|
|
.size _vmm_map, .-_vmm_map
|
|
.globl _vmm_map_addr
|
|
.type _vmm_map_addr, @function
|
|
_vmm_map_addr:
|
|
push %ebp
|
|
mov %ebp, %esp
|
|
sub %esp, 24
|
|
cmp DWORD PTR _mm_freepages, 9
|
|
ja .L12
|
|
mov DWORD PTR [%ebp-4], -1
|
|
jmp .L11
|
|
.L12:
|
|
call _mm_palloc
|
|
mov %edx, %eax
|
|
mov %eax, DWORD PTR [%ebp+12]
|
|
mov DWORD PTR [%eax], %edx
|
|
mov %eax, DWORD PTR [%eax]
|
|
mov DWORD PTR [%esp+4], %eax
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _vmm_map1
|
|
mov DWORD PTR [%ebp-4], %eax
|
|
.L11:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
leave
|
|
ret
|
|
.size _vmm_map_addr, .-_vmm_map_addr
|
|
.globl _vmm_map1
|
|
.type _vmm_map1, @function
|
|
_vmm_map1:
|
|
push %ebp
|
|
mov %ebp, %esp
|
|
sub %esp, 40
|
|
and DWORD PTR [%ebp+8], -4096
|
|
lea %eax, [%ebp+12]
|
|
and DWORD PTR [%eax], -4096
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
shr %eax, 22
|
|
mov DWORD PTR [%ebp-4], %eax
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
and %eax, 4190208
|
|
shr %eax, 12
|
|
mov DWORD PTR [%ebp-8], %eax
|
|
mov DWORD PTR [%ebp-12], -4096
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
lea %edx, [0+%eax*4]
|
|
mov %eax, DWORD PTR [%ebp-12]
|
|
mov %eax, DWORD PTR [%eax+%edx]
|
|
and %eax, 1
|
|
test %eax, %eax
|
|
jne .L14
|
|
call _mm_palloc
|
|
mov DWORD PTR [%ebp-16], %eax
|
|
cmp DWORD PTR [%ebp-16], 0
|
|
jne .L15
|
|
mov DWORD PTR [%ebp-20], -1
|
|
jmp .L13
|
|
.L15:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
lea %ecx, [0+%eax*4]
|
|
mov %edx, DWORD PTR [%ebp-12]
|
|
mov %eax, DWORD PTR [%ebp-16]
|
|
or %eax, 3
|
|
mov DWORD PTR [%edx+%ecx], %eax
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
sal %eax, 2
|
|
sub %eax, 4096
|
|
mov DWORD PTR [%esp], %eax
|
|
call _invlpg_
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _invlpg_
|
|
mov DWORD PTR [%esp+8], 1024
|
|
mov DWORD PTR [%esp+4], 0
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
sal %eax, 12
|
|
or %eax, -4194304
|
|
mov DWORD PTR [%esp], %eax
|
|
call _memsetd
|
|
.L14:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %edx, %eax
|
|
sal %edx, 12
|
|
mov %eax, DWORD PTR [%ebp-8]
|
|
sal %eax, 2
|
|
or %eax, %edx
|
|
mov %edx, %eax
|
|
or %edx, -4194304
|
|
mov %eax, DWORD PTR [%ebp+12]
|
|
or %eax, 3
|
|
mov DWORD PTR [%edx], %eax
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %edx, %eax
|
|
sal %edx, 12
|
|
mov %eax, DWORD PTR [%ebp-8]
|
|
sal %eax, 2
|
|
or %eax, %edx
|
|
or %eax, -4194304
|
|
mov DWORD PTR [%esp], %eax
|
|
call _invlpg_
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _invlpg_
|
|
mov DWORD PTR [%ebp-20], 0
|
|
.L13:
|
|
mov %eax, DWORD PTR [%ebp-20]
|
|
leave
|
|
ret
|
|
.size _vmm_map1, .-_vmm_map1
|
|
.globl _vmm_mapn
|
|
.type _vmm_mapn, @function
|
|
_vmm_mapn:
|
|
push %ebp
|
|
mov %ebp, %esp
|
|
sub %esp, 24
|
|
nop
|
|
.L17:
|
|
cmp DWORD PTR [%ebp+16], 0
|
|
jne .L19
|
|
jmp .L18
|
|
.L19:
|
|
mov %eax, DWORD PTR [%ebp+12]
|
|
mov DWORD PTR [%esp+4], %eax
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _vmm_map1
|
|
test %eax, %eax
|
|
je .L20
|
|
mov DWORD PTR [%ebp-4], 1
|
|
jmp .L16
|
|
.L20:
|
|
add DWORD PTR [%ebp+8], 4096
|
|
lea %eax, [%ebp+12]
|
|
add DWORD PTR [%eax], 4096
|
|
lea %eax, [%ebp+16]
|
|
dec DWORD PTR [%eax]
|
|
jmp .L17
|
|
.L18:
|
|
mov DWORD PTR [%ebp-4], 0
|
|
.L16:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
leave
|
|
ret
|
|
.size _vmm_mapn, .-_vmm_mapn
|
|
.globl _vmm_unmap1
|
|
.type _vmm_unmap1, @function
|
|
_vmm_unmap1:
|
|
push %ebp
|
|
mov %ebp, %esp
|
|
sub %esp, 8
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
and %eax, -4194304
|
|
mov %edx, %eax
|
|
shr %edx, 10
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
and %eax, 4190208
|
|
shr %eax, 10
|
|
or %eax, %edx
|
|
or %eax, -4194304
|
|
mov DWORD PTR [%eax], 0
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _invlpg_
|
|
leave
|
|
ret
|
|
.size _vmm_unmap1, .-_vmm_unmap1
|
|
.globl _vmm_unmapn
|
|
.type _vmm_unmapn, @function
|
|
_vmm_unmapn:
|
|
push %ebp
|
|
mov %ebp, %esp
|
|
sub %esp, 8
|
|
nop
|
|
.L23:
|
|
cmp DWORD PTR [%ebp+12], 0
|
|
jne .L25
|
|
jmp .L22
|
|
.L25:
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _vmm_unmap1
|
|
add DWORD PTR [%ebp+8], 4096
|
|
lea %eax, [%ebp+12]
|
|
dec DWORD PTR [%eax]
|
|
jmp .L23
|
|
.L22:
|
|
leave
|
|
ret
|
|
.size _vmm_unmapn, .-_vmm_unmapn
|
|
.globl _vmm_map_range
|
|
.type _vmm_map_range, @function
|
|
_vmm_map_range:
|
|
push %ebp
|
|
mov %ebp, %esp
|
|
sub %esp, 24
|
|
mov %eax, DWORD PTR [%ebp+12]
|
|
cmp %eax, DWORD PTR [%ebp+8]
|
|
jae .L27
|
|
mov DWORD PTR [%ebp-4], -1
|
|
jmp .L26
|
|
.L27:
|
|
nop
|
|
.L28:
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
cmp %eax, DWORD PTR [%ebp+12]
|
|
jb .L30
|
|
jmp .L29
|
|
.L30:
|
|
mov %eax, DWORD PTR [%ebp+16]
|
|
mov DWORD PTR [%esp+4], %eax
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _vmm_map1
|
|
test %eax, %eax
|
|
je .L31
|
|
mov DWORD PTR [%ebp-4], -2
|
|
jmp .L26
|
|
.L31:
|
|
add DWORD PTR [%ebp+8], 4096
|
|
lea %eax, [%ebp+16]
|
|
add DWORD PTR [%eax], 4096
|
|
jmp .L28
|
|
.L29:
|
|
mov DWORD PTR [%ebp-4], 0
|
|
.L26:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
leave
|
|
ret
|
|
.size _vmm_map_range, .-_vmm_map_range
|
|
.globl _kmalloc
|
|
.type _kmalloc, @function
|
|
_kmalloc:
|
|
push %ebp
|
|
mov %ebp, %esp
|
|
sub %esp, 24
|
|
call _k_enter_critical
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
and %eax, 3
|
|
test %eax, %eax
|
|
je .L33
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
mov %edx, %eax
|
|
and %edx, 3
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
sub %eax, %edx
|
|
add %eax, 4
|
|
mov DWORD PTR [%ebp+8], %eax
|
|
.L33:
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _vmm_getFreeChunk
|
|
mov DWORD PTR [%ebp-4], %eax
|
|
cmp DWORD PTR [%ebp-4], 0
|
|
je .L34
|
|
call _k_leave_critical
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%ebp-8], %eax
|
|
jmp .L32
|
|
.L34:
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _vmm_moreCore
|
|
test %eax, %eax
|
|
je .L35
|
|
call _k_leave_critical
|
|
mov DWORD PTR [%ebp-8], 0
|
|
jmp .L32
|
|
.L35:
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _vmm_getFreeChunk
|
|
mov DWORD PTR [%ebp-4], %eax
|
|
call _k_leave_critical
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%ebp-8], %eax
|
|
.L32:
|
|
mov %eax, DWORD PTR [%ebp-8]
|
|
leave
|
|
ret
|
|
.size _kmalloc, .-_kmalloc
|
|
.globl _kfree
|
|
.type _kfree, @function
|
|
_kfree:
|
|
push %ebp
|
|
mov %ebp, %esp
|
|
sub %esp, 24
|
|
call _k_enter_critical
|
|
mov %eax, DWORD PTR _heapEntryQueues+20
|
|
mov %eax, DWORD PTR [%eax+8]
|
|
mov DWORD PTR [%ebp-4], %eax
|
|
.L37:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
cmp DWORD PTR [%eax+8], 0
|
|
jne .L39
|
|
jmp .L38
|
|
.L39:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %eax, DWORD PTR [%eax]
|
|
cmp %eax, DWORD PTR [%ebp+8]
|
|
jne .L40
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%esp+4], %eax
|
|
mov DWORD PTR [%esp], 2
|
|
call _vmm_removeHeapEntry
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%esp+4], %eax
|
|
mov DWORD PTR [%esp], 1
|
|
call _vmm_coalesceEntry
|
|
test %eax, %eax
|
|
je .L41
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%esp+8], %eax
|
|
mov %eax, DWORD PTR _heapEntryQueues+12
|
|
mov DWORD PTR [%esp+4], %eax
|
|
mov DWORD PTR [%esp], 1
|
|
call _vmm_addToQueue
|
|
jmp .L38
|
|
.L41:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%esp+8], %eax
|
|
mov %eax, DWORD PTR _heapEntryQueues+4
|
|
mov DWORD PTR [%esp+4], %eax
|
|
mov DWORD PTR [%esp], 0
|
|
call _vmm_addToQueue
|
|
jmp .L38
|
|
.L40:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %eax, DWORD PTR [%eax+8]
|
|
mov DWORD PTR [%ebp-4], %eax
|
|
jmp .L37
|
|
.L38:
|
|
call _k_leave_critical
|
|
mov %eax, 0
|
|
leave
|
|
ret
|
|
.size _kfree, .-_kfree
|
|
.globl _vmm_palloc
|
|
.type _vmm_palloc, @function
|
|
_vmm_palloc:
|
|
push %ebp
|
|
mov %ebp, %esp
|
|
sub %esp, 8
|
|
lea %eax, [%ebp-4]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _vmm_palloc_addr
|
|
leave
|
|
ret
|
|
.size _vmm_palloc, .-_vmm_palloc
|
|
.globl _vmm_palloc_addr
|
|
.type _vmm_palloc_addr, @function
|
|
_vmm_palloc_addr:
|
|
push %ebp
|
|
mov %ebp, %esp
|
|
sub %esp, 24
|
|
call _k_enter_critical
|
|
mov %eax, DWORD PTR _heapEntryQueues+28
|
|
mov %eax, DWORD PTR [%eax+8]
|
|
mov DWORD PTR [%ebp-4], %eax
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%ebp-8], %eax
|
|
.L45:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
cmp DWORD PTR [%eax+8], 0
|
|
jne .L47
|
|
jmp .L46
|
|
.L47:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
cmp DWORD PTR [%eax+4], 4096
|
|
jne .L48
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%esp+4], %eax
|
|
mov DWORD PTR [%esp], 3
|
|
call _vmm_removeHeapEntry
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%esp+8], %eax
|
|
mov DWORD PTR [%esp+4], OFFSET FLAT:_heapEntryHeadNodes+32
|
|
mov DWORD PTR [%esp], 2
|
|
call _vmm_addToQueue
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
mov DWORD PTR [%esp+4], %eax
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %eax, DWORD PTR [%eax]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _vmm_map_addr
|
|
test %eax, %eax
|
|
je .L49
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%eax], 0
|
|
.L49:
|
|
call _k_leave_critical
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %eax, DWORD PTR [%eax]
|
|
mov DWORD PTR [%ebp-12], %eax
|
|
jmp .L44
|
|
.L48:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %edx, DWORD PTR [%ebp-8]
|
|
mov %eax, DWORD PTR [%eax+4]
|
|
cmp %eax, DWORD PTR [%edx+4]
|
|
jbe .L50
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%ebp-8], %eax
|
|
.L50:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %eax, DWORD PTR [%eax+8]
|
|
mov DWORD PTR [%ebp-4], %eax
|
|
jmp .L45
|
|
.L46:
|
|
mov %eax, DWORD PTR [%ebp-8]
|
|
cmp DWORD PTR [%eax+4], 65535
|
|
ja .L51
|
|
call _k_leave_critical
|
|
mov DWORD PTR [%ebp-12], 0
|
|
jmp .L44
|
|
.L51:
|
|
mov %edx, DWORD PTR [%ebp-8]
|
|
mov %eax, DWORD PTR [%ebp-8]
|
|
mov %eax, DWORD PTR [%eax+4]
|
|
sub %eax, 4096
|
|
mov DWORD PTR [%edx+4], %eax
|
|
call _vmm_getUnusedEntry
|
|
mov DWORD PTR [%ebp-4], %eax
|
|
mov %ecx, DWORD PTR [%ebp-4]
|
|
mov %edx, DWORD PTR [%ebp-8]
|
|
mov %eax, DWORD PTR [%ebp-8]
|
|
mov %eax, DWORD PTR [%eax+4]
|
|
add %eax, DWORD PTR [%edx]
|
|
mov DWORD PTR [%ecx], %eax
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%eax+4], 4096
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%esp+8], %eax
|
|
mov DWORD PTR [%esp+4], OFFSET FLAT:_heapEntryHeadNodes+32
|
|
mov DWORD PTR [%esp], 2
|
|
call _vmm_addToQueue
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
mov DWORD PTR [%esp+4], %eax
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %eax, DWORD PTR [%eax]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _vmm_map_addr
|
|
test %eax, %eax
|
|
je .L52
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%eax], 0
|
|
.L52:
|
|
call _k_leave_critical
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %eax, DWORD PTR [%eax]
|
|
mov DWORD PTR [%ebp-12], %eax
|
|
.L44:
|
|
mov %eax, DWORD PTR [%ebp-12]
|
|
leave
|
|
ret
|
|
.size _vmm_palloc_addr, .-_vmm_palloc_addr
|
|
.globl _vmm_pfree
|
|
.type _vmm_pfree, @function
|
|
_vmm_pfree:
|
|
push %ebp
|
|
mov %ebp, %esp
|
|
sub %esp, 24
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
and %eax, -4194304
|
|
mov %edx, %eax
|
|
shr %edx, 10
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
and %eax, 4190208
|
|
shr %eax, 10
|
|
or %eax, %edx
|
|
or %eax, -4194304
|
|
mov %eax, DWORD PTR [%eax]
|
|
mov DWORD PTR [%ebp-4], %eax
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _vmm_unmapp
|
|
test %eax, %eax
|
|
je .L54
|
|
mov DWORD PTR [%ebp-8], -1
|
|
jmp .L53
|
|
.L54:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _mm_pfree
|
|
mov DWORD PTR [%ebp-8], 0
|
|
.L53:
|
|
mov %eax, DWORD PTR [%ebp-8]
|
|
leave
|
|
ret
|
|
.size _vmm_pfree, .-_vmm_pfree
|
|
.globl _vmm_unmapp
|
|
.type _vmm_unmapp, @function
|
|
_vmm_unmapp:
|
|
push %ebp
|
|
mov %ebp, %esp
|
|
sub %esp, 24
|
|
cmp DWORD PTR [%ebp+8], 0
|
|
jne .L56
|
|
mov DWORD PTR [%ebp-8], -2
|
|
jmp .L55
|
|
.L56:
|
|
call _k_enter_critical
|
|
mov %eax, DWORD PTR _heapEntryQueues+20
|
|
mov %eax, DWORD PTR [%eax+8]
|
|
mov DWORD PTR [%ebp-4], %eax
|
|
.L57:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
cmp DWORD PTR [%eax+8], 0
|
|
jne .L59
|
|
jmp .L58
|
|
.L59:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %eax, DWORD PTR [%eax]
|
|
cmp %eax, DWORD PTR [%ebp+8]
|
|
jne .L60
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%esp+4], %eax
|
|
mov DWORD PTR [%esp], 2
|
|
call _vmm_removeHeapEntry
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %eax, DWORD PTR [%eax]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _vmm_unmap1
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%esp+8], %eax
|
|
mov DWORD PTR [%esp+4], OFFSET FLAT:_heapEntryHeadNodes+48
|
|
mov DWORD PTR [%esp], 3
|
|
call _vmm_addToQueue
|
|
call _k_leave_critical
|
|
mov DWORD PTR [%ebp-8], 0
|
|
jmp .L55
|
|
.L60:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %eax, DWORD PTR [%eax+8]
|
|
mov DWORD PTR [%ebp-4], %eax
|
|
jmp .L57
|
|
.L58:
|
|
call _k_leave_critical
|
|
mov DWORD PTR [%ebp-8], -1
|
|
.L55:
|
|
mov %eax, DWORD PTR [%ebp-8]
|
|
leave
|
|
ret
|
|
.size _vmm_unmapp, .-_vmm_unmapp
|
|
.globl _kcalloc
|
|
.type _kcalloc, @function
|
|
_kcalloc:
|
|
push %ebp
|
|
mov %ebp, %esp
|
|
sub %esp, 24
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
imul %eax, DWORD PTR [%ebp+12]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _kmalloc
|
|
mov DWORD PTR [%ebp-4], %eax
|
|
cmp DWORD PTR [%ebp-4], 0
|
|
jne .L62
|
|
mov DWORD PTR [%ebp-8], 0
|
|
jmp .L61
|
|
.L62:
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
imul %eax, DWORD PTR [%ebp+12]
|
|
mov DWORD PTR [%esp+8], %eax
|
|
mov DWORD PTR [%esp+4], 0
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _memset
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%ebp-8], %eax
|
|
.L61:
|
|
mov %eax, DWORD PTR [%ebp-8]
|
|
leave
|
|
ret
|
|
.size _kcalloc, .-_kcalloc
|
|
.globl _krealloc
|
|
.type _krealloc, @function
|
|
_krealloc:
|
|
push %ebp
|
|
mov %ebp, %esp
|
|
sub %esp, 40
|
|
mov %eax, DWORD PTR [%ebp+12]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _kmalloc
|
|
mov DWORD PTR [%ebp-4], %eax
|
|
cmp DWORD PTR [%ebp-4], 0
|
|
je .L64
|
|
mov %eax, DWORD PTR _heapEntryQueues+20
|
|
mov %eax, DWORD PTR [%eax+8]
|
|
mov DWORD PTR [%ebp-8], %eax
|
|
.L65:
|
|
mov %eax, DWORD PTR [%ebp-8]
|
|
cmp DWORD PTR [%eax+8], 0
|
|
jne .L67
|
|
jmp .L66
|
|
.L67:
|
|
mov %eax, DWORD PTR [%ebp-8]
|
|
mov %eax, DWORD PTR [%eax]
|
|
cmp %eax, DWORD PTR [%ebp+8]
|
|
jne .L68
|
|
mov %eax, DWORD PTR [%ebp-8]
|
|
mov %eax, DWORD PTR [%eax+4]
|
|
mov DWORD PTR [%ebp-20], %eax
|
|
mov %eax, DWORD PTR [%ebp+12]
|
|
mov DWORD PTR [%ebp-16], %eax
|
|
mov %eax, DWORD PTR [%ebp-20]
|
|
cmp DWORD PTR [%ebp-16], %eax
|
|
jbe .L69
|
|
mov %eax, DWORD PTR [%ebp-20]
|
|
mov DWORD PTR [%ebp-16], %eax
|
|
.L69:
|
|
mov %eax, DWORD PTR [%ebp-16]
|
|
mov DWORD PTR [%esp+8], %eax
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
mov DWORD PTR [%esp+4], %eax
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _memcpy
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _kfree
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%ebp-12], %eax
|
|
jmp .L63
|
|
.L68:
|
|
mov %eax, DWORD PTR [%ebp-8]
|
|
mov %eax, DWORD PTR [%eax+8]
|
|
mov DWORD PTR [%ebp-8], %eax
|
|
jmp .L65
|
|
.L66:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _kfree
|
|
mov DWORD PTR [%ebp-12], 0
|
|
jmp .L63
|
|
.L64:
|
|
mov DWORD PTR [%ebp-12], 0
|
|
.L63:
|
|
mov %eax, DWORD PTR [%ebp-12]
|
|
leave
|
|
ret
|
|
.size _krealloc, .-_krealloc
|
|
.globl _vmm_getFreeChunk
|
|
.type _vmm_getFreeChunk, @function
|
|
_vmm_getFreeChunk:
|
|
push %ebp
|
|
mov %ebp, %esp
|
|
sub %esp, 40
|
|
mov %eax, DWORD PTR _heapEntryQueues+12
|
|
mov %eax, DWORD PTR [%eax+8]
|
|
mov DWORD PTR [%ebp-4], %eax
|
|
mov DWORD PTR [%ebp-8], 0
|
|
.L72:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
cmp DWORD PTR [%eax+8], 0
|
|
jne .L74
|
|
jmp .L73
|
|
.L74:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %eax, DWORD PTR [%eax+4]
|
|
cmp %eax, DWORD PTR [%ebp+8]
|
|
jne .L75
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%esp+4], %eax
|
|
mov DWORD PTR [%esp], 1
|
|
call _vmm_removeHeapEntry
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%esp+8], %eax
|
|
mov %eax, DWORD PTR _heapEntryQueues+20
|
|
mov DWORD PTR [%esp+4], %eax
|
|
mov DWORD PTR [%esp], 2
|
|
call _vmm_addToQueue
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %eax, DWORD PTR [%eax]
|
|
mov DWORD PTR [%ebp-16], %eax
|
|
jmp .L71
|
|
.L75:
|
|
cmp DWORD PTR [%ebp-8], 0
|
|
je .L76
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %eax, DWORD PTR [%eax+4]
|
|
cmp %eax, DWORD PTR [%ebp+8]
|
|
jbe .L78
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %edx, DWORD PTR [%ebp-8]
|
|
mov %eax, DWORD PTR [%eax+4]
|
|
cmp %eax, DWORD PTR [%edx+4]
|
|
jae .L78
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%ebp-8], %eax
|
|
jmp .L78
|
|
.L76:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %eax, DWORD PTR [%eax+4]
|
|
cmp %eax, DWORD PTR [%ebp+8]
|
|
jbe .L78
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%ebp-8], %eax
|
|
.L78:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %eax, DWORD PTR [%eax+8]
|
|
mov DWORD PTR [%ebp-4], %eax
|
|
jmp .L72
|
|
.L73:
|
|
cmp DWORD PTR [%ebp-8], 0
|
|
je .L80
|
|
call _vmm_getUnusedEntry
|
|
mov DWORD PTR [%ebp-12], %eax
|
|
mov %edx, DWORD PTR [%ebp-12]
|
|
mov %eax, DWORD PTR [%ebp-8]
|
|
mov %eax, DWORD PTR [%eax]
|
|
mov DWORD PTR [%edx], %eax
|
|
mov %edx, DWORD PTR [%ebp-12]
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
mov DWORD PTR [%edx+4], %eax
|
|
mov %ecx, DWORD PTR [%ebp-8]
|
|
mov %edx, DWORD PTR [%ebp-8]
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
add %eax, DWORD PTR [%edx]
|
|
mov DWORD PTR [%ecx], %eax
|
|
mov %ecx, DWORD PTR [%ebp-8]
|
|
mov %eax, DWORD PTR [%ebp-8]
|
|
mov %edx, DWORD PTR [%ebp+8]
|
|
mov %eax, DWORD PTR [%eax+4]
|
|
sub %eax, %edx
|
|
mov DWORD PTR [%ecx+4], %eax
|
|
mov %eax, DWORD PTR [%ebp-12]
|
|
mov DWORD PTR [%esp+8], %eax
|
|
mov %eax, DWORD PTR _heapEntryQueues+20
|
|
mov DWORD PTR [%esp+4], %eax
|
|
mov DWORD PTR [%esp], 2
|
|
call _vmm_addToQueue
|
|
mov %eax, DWORD PTR [%ebp-12]
|
|
mov %eax, DWORD PTR [%eax]
|
|
mov DWORD PTR [%ebp-16], %eax
|
|
jmp .L71
|
|
.L80:
|
|
mov DWORD PTR [%ebp-16], 0
|
|
.L71:
|
|
mov %eax, DWORD PTR [%ebp-16]
|
|
leave
|
|
ret
|
|
.size _vmm_getFreeChunk, .-_vmm_getFreeChunk
|
|
.globl _vmm_moreCore
|
|
.type _vmm_moreCore, @function
|
|
_vmm_moreCore:
|
|
push %ebp
|
|
mov %ebp, %esp
|
|
sub %esp, 40
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
shr %eax, 12
|
|
add %eax, 2
|
|
mov DWORD PTR [%ebp-4], %eax
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
sal %eax, 12
|
|
mov DWORD PTR [%ebp+8], %eax
|
|
mov %eax, DWORD PTR _mm_freepages
|
|
sub %eax, 5
|
|
cmp %eax, DWORD PTR [%ebp-4]
|
|
jae .L82
|
|
mov DWORD PTR [%ebp-28], -1
|
|
jmp .L81
|
|
.L82:
|
|
mov %eax, DWORD PTR _heapEntryQueues+28
|
|
mov %eax, DWORD PTR [%eax+8]
|
|
mov DWORD PTR [%ebp-8], %eax
|
|
mov %eax, DWORD PTR [%ebp-8]
|
|
mov DWORD PTR [%ebp-12], %eax
|
|
.L83:
|
|
mov %eax, DWORD PTR [%ebp-8]
|
|
cmp DWORD PTR [%eax+8], 0
|
|
jne .L85
|
|
jmp .L84
|
|
.L85:
|
|
mov %eax, DWORD PTR [%ebp-8]
|
|
mov %edx, DWORD PTR [%ebp-12]
|
|
mov %eax, DWORD PTR [%eax+4]
|
|
cmp %eax, DWORD PTR [%edx+4]
|
|
jbe .L86
|
|
mov %eax, DWORD PTR [%ebp-8]
|
|
mov DWORD PTR [%ebp-12], %eax
|
|
.L86:
|
|
mov %eax, DWORD PTR [%ebp-8]
|
|
mov %eax, DWORD PTR [%eax+8]
|
|
mov DWORD PTR [%ebp-8], %eax
|
|
jmp .L83
|
|
.L84:
|
|
mov %eax, DWORD PTR [%ebp-12]
|
|
mov %eax, DWORD PTR [%eax+4]
|
|
cmp %eax, DWORD PTR [%ebp+8]
|
|
ja .L87
|
|
mov DWORD PTR [%ebp-28], -2
|
|
jmp .L81
|
|
.L87:
|
|
mov %eax, DWORD PTR [%ebp-12]
|
|
mov %eax, DWORD PTR [%eax]
|
|
mov DWORD PTR [%ebp-20], %eax
|
|
mov DWORD PTR [%ebp-16], 0
|
|
.L88:
|
|
mov %eax, DWORD PTR [%ebp-16]
|
|
cmp %eax, DWORD PTR [%ebp-4]
|
|
jl .L91
|
|
jmp .L89
|
|
.L91:
|
|
mov %eax, DWORD PTR [%ebp-20]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _vmm_map
|
|
lea %eax, [%ebp-20]
|
|
add DWORD PTR [%eax], 4096
|
|
lea %eax, [%ebp-16]
|
|
inc DWORD PTR [%eax]
|
|
jmp .L88
|
|
.L89:
|
|
call _vmm_getUnusedEntry
|
|
mov DWORD PTR [%ebp-24], %eax
|
|
mov %edx, DWORD PTR [%ebp-24]
|
|
mov %eax, DWORD PTR [%ebp-12]
|
|
mov %eax, DWORD PTR [%eax]
|
|
mov DWORD PTR [%edx], %eax
|
|
mov %edx, DWORD PTR [%ebp-24]
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
mov DWORD PTR [%edx+4], %eax
|
|
mov %ecx, DWORD PTR [%ebp-12]
|
|
mov %edx, DWORD PTR [%ebp-12]
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
add %eax, DWORD PTR [%edx]
|
|
mov DWORD PTR [%ecx], %eax
|
|
mov %ecx, DWORD PTR [%ebp-12]
|
|
mov %eax, DWORD PTR [%ebp-12]
|
|
mov %edx, DWORD PTR [%ebp+8]
|
|
mov %eax, DWORD PTR [%eax+4]
|
|
sub %eax, %edx
|
|
mov DWORD PTR [%ecx+4], %eax
|
|
mov %eax, DWORD PTR [%ebp-24]
|
|
mov DWORD PTR [%esp+4], %eax
|
|
mov DWORD PTR [%esp], 1
|
|
call _vmm_coalesceEntry
|
|
test %eax, %eax
|
|
je .L92
|
|
mov %eax, DWORD PTR [%ebp-24]
|
|
mov DWORD PTR [%esp+8], %eax
|
|
mov %eax, DWORD PTR _heapEntryQueues+12
|
|
mov DWORD PTR [%esp+4], %eax
|
|
mov DWORD PTR [%esp], 1
|
|
call _vmm_addToQueue
|
|
jmp .L93
|
|
.L92:
|
|
mov %eax, DWORD PTR [%ebp-24]
|
|
mov DWORD PTR [%esp+8], %eax
|
|
mov %eax, DWORD PTR _heapEntryQueues+4
|
|
mov DWORD PTR [%esp+4], %eax
|
|
mov DWORD PTR [%esp], 0
|
|
call _vmm_addToQueue
|
|
.L93:
|
|
mov DWORD PTR [%ebp-28], 0
|
|
.L81:
|
|
mov %eax, DWORD PTR [%ebp-28]
|
|
leave
|
|
ret
|
|
.size _vmm_moreCore, .-_vmm_moreCore
|
|
.globl _vmm_coalesceEntry
|
|
.type _vmm_coalesceEntry, @function
|
|
_vmm_coalesceEntry:
|
|
push %ebp
|
|
mov %ebp, %esp
|
|
sub %esp, 8
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
mov %eax, DWORD PTR _heapEntryQueues[4+%eax*8]
|
|
mov %eax, DWORD PTR [%eax+8]
|
|
mov DWORD PTR [%ebp-4], %eax
|
|
.L95:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
cmp DWORD PTR [%eax+8], 0
|
|
jne .L97
|
|
jmp .L96
|
|
.L97:
|
|
mov %edx, DWORD PTR [%ebp-4]
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %eax, DWORD PTR [%eax+4]
|
|
mov %edx, DWORD PTR [%edx]
|
|
add %edx, %eax
|
|
mov %eax, DWORD PTR [%ebp+12]
|
|
cmp %edx, DWORD PTR [%eax]
|
|
jne .L98
|
|
mov %ecx, DWORD PTR [%ebp-4]
|
|
mov %edx, DWORD PTR [%ebp-4]
|
|
mov %eax, DWORD PTR [%ebp+12]
|
|
mov %eax, DWORD PTR [%eax+4]
|
|
add %eax, DWORD PTR [%edx+4]
|
|
mov DWORD PTR [%ecx+4], %eax
|
|
mov DWORD PTR [%ebp-8], 0
|
|
jmp .L94
|
|
.L98:
|
|
mov %edx, DWORD PTR [%ebp+12]
|
|
mov %eax, DWORD PTR [%ebp+12]
|
|
mov %eax, DWORD PTR [%eax+4]
|
|
mov %edx, DWORD PTR [%edx]
|
|
add %edx, %eax
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
cmp %edx, DWORD PTR [%eax]
|
|
jne .L99
|
|
mov %edx, DWORD PTR [%ebp-4]
|
|
mov %eax, DWORD PTR [%ebp+12]
|
|
mov %eax, DWORD PTR [%eax]
|
|
mov DWORD PTR [%edx], %eax
|
|
mov %ecx, DWORD PTR [%ebp-4]
|
|
mov %edx, DWORD PTR [%ebp-4]
|
|
mov %eax, DWORD PTR [%ebp+12]
|
|
mov %eax, DWORD PTR [%eax+4]
|
|
add %eax, DWORD PTR [%edx+4]
|
|
mov DWORD PTR [%ecx+4], %eax
|
|
mov DWORD PTR [%ebp-8], 0
|
|
jmp .L94
|
|
.L99:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %eax, DWORD PTR [%eax+8]
|
|
mov DWORD PTR [%ebp-4], %eax
|
|
jmp .L95
|
|
.L96:
|
|
mov DWORD PTR [%ebp-8], -1
|
|
.L94:
|
|
mov %eax, DWORD PTR [%ebp-8]
|
|
leave
|
|
ret
|
|
.size _vmm_coalesceEntry, .-_vmm_coalesceEntry
|
|
.globl _vmm_removeHeapEntry
|
|
.type _vmm_removeHeapEntry, @function
|
|
_vmm_removeHeapEntry:
|
|
push %ebp
|
|
mov %ebp, %esp
|
|
mov %eax, DWORD PTR [%ebp+12]
|
|
mov %edx, DWORD PTR [%eax+12]
|
|
mov %eax, DWORD PTR [%ebp+12]
|
|
mov %eax, DWORD PTR [%eax+8]
|
|
mov DWORD PTR [%edx+8], %eax
|
|
mov %eax, DWORD PTR [%ebp+12]
|
|
mov %edx, DWORD PTR [%eax+8]
|
|
mov %eax, DWORD PTR [%ebp+12]
|
|
mov %eax, DWORD PTR [%eax+12]
|
|
mov DWORD PTR [%edx+12], %eax
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
dec DWORD PTR _heapEntryQueues[0+%eax*8]
|
|
mov %eax, DWORD PTR [%ebp+12]
|
|
mov DWORD PTR [%eax+8], 0
|
|
mov %eax, DWORD PTR [%ebp+12]
|
|
mov DWORD PTR [%eax+12], 0
|
|
pop %ebp
|
|
ret
|
|
.size _vmm_removeHeapEntry, .-_vmm_removeHeapEntry
|
|
.globl _vmm_heb_init
|
|
.type _vmm_heb_init, @function
|
|
_vmm_heb_init:
|
|
push %ebp
|
|
mov %ebp, %esp
|
|
sub %esp, 4
|
|
mov DWORD PTR [%ebp-4], 0
|
|
.L103:
|
|
cmp DWORD PTR [%ebp-4], 254
|
|
jle .L106
|
|
jmp .L104
|
|
.L106:
|
|
mov %ecx, DWORD PTR [%ebp+8]
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %edx, %eax
|
|
sal %edx, 4
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
sal %eax, 4
|
|
add %eax, DWORD PTR [%ebp+8]
|
|
add %eax, 16
|
|
mov DWORD PTR [%ecx+8+%edx], %eax
|
|
mov %edx, DWORD PTR [%ebp+8]
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
sal %eax, 4
|
|
add %eax, %edx
|
|
lea %edx, [%eax+16]
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
sal %eax, 4
|
|
add %eax, DWORD PTR [%ebp+8]
|
|
mov DWORD PTR [%edx+12], %eax
|
|
lea %eax, [%ebp-4]
|
|
inc DWORD PTR [%eax]
|
|
jmp .L103
|
|
.L104:
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
mov DWORD PTR [%eax+12], 0
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
mov DWORD PTR [%eax+4088], 0
|
|
leave
|
|
ret
|
|
.size _vmm_heb_init, .-_vmm_heb_init
|
|
.globl _vmm_addToQueue
|
|
.type _vmm_addToQueue, @function
|
|
_vmm_addToQueue:
|
|
push %ebp
|
|
mov %ebp, %esp
|
|
push %esi
|
|
push %ebx
|
|
sub %esp, 16
|
|
mov %esi, DWORD PTR [%ebp+8]
|
|
mov %ebx, DWORD PTR [%ebp+8]
|
|
mov %eax, DWORD PTR [%ebp+16]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _vmm_countHeapEntries
|
|
add %eax, DWORD PTR _heapEntryQueues[0+%ebx*8]
|
|
mov DWORD PTR _heapEntryQueues[0+%esi*8], %eax
|
|
mov %eax, DWORD PTR [%ebp+16]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _vmm_followChain
|
|
mov DWORD PTR [%ebp-12], %eax
|
|
mov %edx, DWORD PTR [%ebp-12]
|
|
mov %eax, DWORD PTR [%ebp+12]
|
|
mov %eax, DWORD PTR [%eax+8]
|
|
mov DWORD PTR [%edx+8], %eax
|
|
mov %edx, DWORD PTR [%ebp+16]
|
|
mov %eax, DWORD PTR [%ebp+12]
|
|
mov DWORD PTR [%edx+12], %eax
|
|
mov %eax, DWORD PTR [%ebp-12]
|
|
mov %edx, DWORD PTR [%eax+8]
|
|
mov %eax, DWORD PTR [%ebp-12]
|
|
mov DWORD PTR [%edx+12], %eax
|
|
mov %edx, DWORD PTR [%ebp+12]
|
|
mov %eax, DWORD PTR [%ebp+16]
|
|
mov DWORD PTR [%edx+8], %eax
|
|
add %esp, 16
|
|
pop %ebx
|
|
pop %esi
|
|
pop %ebp
|
|
ret
|
|
.size _vmm_addToQueue, .-_vmm_addToQueue
|
|
.globl _vmm_countHeapEntries
|
|
.type _vmm_countHeapEntries, @function
|
|
_vmm_countHeapEntries:
|
|
push %ebp
|
|
mov %ebp, %esp
|
|
sub %esp, 4
|
|
mov DWORD PTR [%ebp-4], 0
|
|
.L109:
|
|
cmp DWORD PTR [%ebp+8], 0
|
|
jne .L111
|
|
jmp .L110
|
|
.L111:
|
|
lea %eax, [%ebp-4]
|
|
inc DWORD PTR [%eax]
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
mov %eax, DWORD PTR [%eax+8]
|
|
mov DWORD PTR [%ebp+8], %eax
|
|
jmp .L109
|
|
.L110:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
leave
|
|
ret
|
|
.size _vmm_countHeapEntries, .-_vmm_countHeapEntries
|
|
.globl _vmm_followChain
|
|
.type _vmm_followChain, @function
|
|
_vmm_followChain:
|
|
push %ebp
|
|
mov %ebp, %esp
|
|
nop
|
|
.L113:
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
cmp DWORD PTR [%eax+8], 0
|
|
jne .L115
|
|
jmp .L114
|
|
.L115:
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
mov %eax, DWORD PTR [%eax+8]
|
|
mov DWORD PTR [%ebp+8], %eax
|
|
jmp .L113
|
|
.L114:
|
|
mov %eax, DWORD PTR [%ebp+8]
|
|
pop %ebp
|
|
ret
|
|
.size _vmm_followChain, .-_vmm_followChain
|
|
.globl _vmm_getUnusedEntry
|
|
.type _vmm_getUnusedEntry, @function
|
|
_vmm_getUnusedEntry:
|
|
push %ebp
|
|
mov %ebp, %esp
|
|
sub %esp, 40
|
|
cmp DWORD PTR _heapEntryQueues, 4
|
|
jg .L117
|
|
mov %eax, DWORD PTR _heapEntryQueues+28
|
|
mov %eax, DWORD PTR [%eax+8]
|
|
mov DWORD PTR [%ebp-4], %eax
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%ebp-8], %eax
|
|
.L118:
|
|
cmp DWORD PTR [%ebp-4], 0
|
|
jne .L120
|
|
jmp .L119
|
|
.L120:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %edx, DWORD PTR [%ebp-8]
|
|
mov %eax, DWORD PTR [%eax+4]
|
|
cmp %eax, DWORD PTR [%edx+4]
|
|
jbe .L121
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%ebp-8], %eax
|
|
.L121:
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %eax, DWORD PTR [%eax+8]
|
|
mov DWORD PTR [%ebp-4], %eax
|
|
jmp .L118
|
|
.L119:
|
|
mov %edx, DWORD PTR [%ebp-8]
|
|
mov %eax, DWORD PTR [%ebp-8]
|
|
mov %eax, DWORD PTR [%eax+4]
|
|
sub %eax, 4096
|
|
mov DWORD PTR [%edx+4], %eax
|
|
mov %edx, DWORD PTR [%ebp-8]
|
|
mov %eax, DWORD PTR [%ebp-8]
|
|
mov %eax, DWORD PTR [%eax+4]
|
|
add %eax, DWORD PTR [%edx]
|
|
mov DWORD PTR [%ebp-12], %eax
|
|
mov %eax, DWORD PTR [%ebp-12]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _vmm_map
|
|
mov %eax, DWORD PTR [%ebp-12]
|
|
mov DWORD PTR [%esp], %eax
|
|
call _vmm_heb_init
|
|
call _vmm_stripUnusedEntry
|
|
mov DWORD PTR [%ebp-16], %eax
|
|
mov %edx, DWORD PTR [%ebp-16]
|
|
mov %eax, DWORD PTR [%ebp-12]
|
|
mov DWORD PTR [%edx], %eax
|
|
mov %eax, DWORD PTR [%ebp-16]
|
|
mov DWORD PTR [%eax+4], 4096
|
|
mov %eax, DWORD PTR [%ebp-16]
|
|
mov DWORD PTR [%esp+8], %eax
|
|
mov %eax, DWORD PTR _heapEntryTailNodes+44
|
|
mov DWORD PTR [%esp+4], %eax
|
|
mov DWORD PTR [%esp], 2
|
|
call _vmm_addToQueue
|
|
.L117:
|
|
call _vmm_stripUnusedEntry
|
|
leave
|
|
ret
|
|
.size _vmm_getUnusedEntry, .-_vmm_getUnusedEntry
|
|
.globl _vmm_stripUnusedEntry
|
|
.type _vmm_stripUnusedEntry, @function
|
|
_vmm_stripUnusedEntry:
|
|
push %ebp
|
|
mov %ebp, %esp
|
|
sub %esp, 4
|
|
mov %eax, DWORD PTR _heapEntryQueues+4
|
|
mov %eax, DWORD PTR [%eax+8]
|
|
mov DWORD PTR [%ebp-4], %eax
|
|
mov %edx, DWORD PTR _heapEntryQueues+4
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %eax, DWORD PTR [%eax+8]
|
|
mov DWORD PTR [%edx+8], %eax
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %edx, DWORD PTR [%eax+8]
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov %eax, DWORD PTR [%eax+12]
|
|
mov DWORD PTR [%edx+12], %eax
|
|
dec DWORD PTR _heapEntryQueues
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%eax+8], 0
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
mov DWORD PTR [%eax+12], 0
|
|
mov %eax, DWORD PTR [%ebp-4]
|
|
leave
|
|
ret
|
|
.size _vmm_stripUnusedEntry, .-_vmm_stripUnusedEntry
|
|
.comm _heapEntryQueues,32,32
|
|
.comm _heapEntryHeadNodes,64,32
|
|
.comm _heapEntryTailNodes,64,32
|
|
.comm _initialHEB,4096,32
|
|
.section .note.GNU-stack,"",@progbits
|
|
.ident "GCC: (GNU) 3.3.5-20050130 (Gentoo 3.3.5.20050130-r1, ssp-3.3.5.20050130-1, pie-8.7.7.1)"
|