diff --git a/.bochsrc b/.bochsrc index f5f75c1..a6cc73d 100644 --- a/.bochsrc +++ b/.bochsrc @@ -27,7 +27,7 @@ private_colormap: enabled=0 i440fxsupport: enabled=1 clock: sync=realtime, time0=local # no ne2k -newharddrivesupport: enabled=1 +#newharddrivesupport: enabled=1 # no loader log: - logprefix: %t%e%d diff --git a/kernel/Makefile b/kernel/Makefile index 4433349..54a5598 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -102,5 +102,7 @@ fs/sysfs/sysfs_entry.o: fs/sysfs/sysfs_entry.h lang/vector.h hos_defines.h fs/sysfs/sysfs_entry.o: lang/string.h sys/pci.o: hos_defines.h display/kout.h sys/io.h sys/pci.h lang/vector.h proc/proc.o: hos_defines.h mm/mm.h kernel.h multiboot.h mm/vmm.h lang/lang.h -proc/proc.o: functions.h sys/io.h proc/proc.h proc/hash.h -proc/hash.o: hos_defines.h proc/hash.h +proc/proc.o: functions.h sys/io.h display/kout.h proc/proc.h proc/hash.h +proc/proc.o: lang/vector.h +proc/hash.o: hos_defines.h proc/hash.h lang/vector.h display/kout.h mm/vmm.h +proc/hash.o: multiboot.h diff --git a/kernel/Makefile.bak b/kernel/Makefile.bak index ff4c277..4433349 100644 --- a/kernel/Makefile.bak +++ b/kernel/Makefile.bak @@ -66,12 +66,12 @@ html: kernel.o: kernel.h hos_defines.h multiboot.h module.h lang/lang.h functions.h kernel.o: sys/io.h mm/mm.h mm/vmm.h lang/conv.h devices.h display/display.h kernel.o: display/kout.h sys/pic.h char/keyboard.h block/ramdisk.h fs/vfs.h -kernel.o: fs/ext2/ext2.h +kernel.o: fs/ext2/ext2.h sys/pci.h proc/proc.h mm/mm.o: kernel.h hos_defines.h multiboot.h mm/mm.h mm/vmm.o: hos_defines.h kernel.h multiboot.h mm/vmm.h lang/lang.h mm/mm.h lang/conv.o: lang/conv.h hos_defines.h display/kout.o: hos_defines.h display/kout.h lang/conv.h devices.h -display/kout.o: char/misc_char.h char/misc_char.h +display/kout.o: char/misc_char.h char/misc_char.h functions.h sys/io.h display/display.o: devices.h hos_defines.h char/vconsole.h display/display.h display/display.o: lang/lang.h kernel.h multiboot.h display/vesafb.h display/display.o: char/keyboard.h display/kout.h @@ -80,8 +80,6 @@ char/keyboard.o: hos_defines.h char/keyboard.h sys/io.h functions.h char/keyboard.o: lang/conv.h display/kout.h display/display.h devices.h lang/lang.o: lang/lang.h hos_defines.h sys/pci_classes.o: hos_defines.h sys/pci.h -proc/proc.o: hos_defines.h proc/proc.h mm/mm.h kernel.h multiboot.h mm/vmm.h -proc/proc.o: lang/lang.h lang/string.o: lang/string.h lang/lang.h hos_defines.h lang/new.o: hos_defines.h mm/vmm.h multiboot.h char/misc_char.o: hos_defines.h devices.h char/misc_char.h sys/io.h @@ -103,3 +101,6 @@ fs/sysfs/sysfs.o: lang/string.h fs/sysfs/sysfs_entry.h fs/sysfs/sysfs_entry.o: fs/sysfs/sysfs_entry.h lang/vector.h hos_defines.h fs/sysfs/sysfs_entry.o: lang/string.h sys/pci.o: hos_defines.h display/kout.h sys/io.h sys/pci.h lang/vector.h +proc/proc.o: hos_defines.h mm/mm.h kernel.h multiboot.h mm/vmm.h lang/lang.h +proc/proc.o: functions.h sys/io.h proc/proc.h proc/hash.h +proc/hash.o: hos_defines.h proc/hash.h diff --git a/kernel/fs/vfs.cpp b/kernel/fs/vfs.cpp index 57e4cf6..2483d23 100644 --- a/kernel/fs/vfs.cpp +++ b/kernel/fs/vfs.cpp @@ -9,6 +9,7 @@ extern "C" { #include "hos_defines.h" #include "display/kout.h" +#include "functions.h" } #include "vfs.h" diff --git a/kernel/lang/vector.h b/kernel/lang/vector.h index 034d303..570fd42 100644 --- a/kernel/lang/vector.h +++ b/kernel/lang/vector.h @@ -31,9 +31,12 @@ public: /* Constructors/Destructor */ vector(); vector(unsigned int size); - vector(vector & v1); + vector(const vector & v1); ~vector(); + /* Assignment operator */ + vector & operator=(const vector & v1); + /* Returns the size of the vector */ unsigned int size() const; @@ -49,7 +52,6 @@ public: /* Direct access operators */ const type & operator[](unsigned int index) const; type & operator[](unsigned int index); - }; template @@ -69,12 +71,12 @@ vector::vector(unsigned int size) } template -vector::vector(vector & v1) +vector::vector(const vector & v1) { mySize = v1.mySize; myAllocated = v1.myAllocated; myData = new (type *)[myAllocated]; - for (int i = 0; i < mySize; i++) + for (u32_t i = 0; i < mySize; i++) myData[i] = new type(*v1.myData[i]); } @@ -86,6 +88,16 @@ vector::~vector() delete[] myData; } +template +vector & vector::operator=(const vector & v1) +{ + mySize = v1.mySize; + myAllocated = v1.myAllocated; + myData = new (type *)[myAllocated]; + for (u32_t i = 0; i < mySize; i++) + myData[i] = new type(*v1.myData[i]); +} + template u32_t vector::size() const { @@ -110,6 +122,7 @@ vector & vector::add(type elem) while (mySize >= myAllocated) grow(); myData[mySize++] = new type(elem); + kprintf("vector.h: added element %d @ 0x%x\n", mySize-1, myData[mySize-1]); return *this; } @@ -145,7 +158,7 @@ vector & vector::insert(type elem, unsigned int position) { if (position <= mySize) { - if (mySize == myAllocated) + if (mySize >= myAllocated) grow(); for (unsigned int i = mySize; i > position; i--) myData[i] = myData[i-1]; diff --git a/kernel/mm/vmm.c b/kernel/mm/vmm.c index bbfa7ee..7e87caf 100644 --- a/kernel/mm/vmm.c +++ b/kernel/mm/vmm.c @@ -41,6 +41,7 @@ void vmm_init() vmm_map_range((void*)mb_modules[i].mod_start, (void*)mb_modules[i].mod_end - 1, mb_modules[i].mod_start - VIRT_OFFSET); for (i = 0; i < VMM_HE_TYPES; i++) { + heapEntryQueues[i].count = 0; heapEntryQueues[i].head = &heapEntryHeadNodes[i]; heapEntryHeadNodes[i].next = &heapEntryTailNodes[i]; heapEntryTailNodes[i].prev = &heapEntryHeadNodes[i]; @@ -159,6 +160,8 @@ void *kmalloc(u32_t size) void *attempt = vmm_getFreeChunk(size); if (attempt) { + if ((u32_t)attempt == 0xd000c5e4) + kprintf("vmm.c: attempt = 0x%x\n", attempt); k_leave_critical(); return attempt; } @@ -168,6 +171,8 @@ void *kmalloc(u32_t size) return NULL; //we could not get any more heap memory } attempt = vmm_getFreeChunk(size); + if ((u32_t)attempt == 0xd000c5e4) + kprintf("vmm.c: attempt = 0x%x\n", attempt); k_leave_critical(); return attempt; } @@ -338,17 +343,17 @@ void *vmm_getFreeChunk(u32_t size) } he = (HeapEntry_t *)he->next; } - if (good) - { - HeapEntry_t *newHE = vmm_getUnusedEntry(); - newHE->base = good->base; - newHE->length = size; - good->base += size; - good->length -= size; - vmm_addToQueue(VMM_HE_USED, heapEntryQueues[VMM_HE_USED].head, newHE); - return newHE->base; - } - return NULL; + if (!good) + return NULL; + HeapEntry_t *newHE = vmm_getUnusedEntry(); + newHE->base = good->base; + newHE->length = size; + newHE->next = NULL; + newHE->prev = NULL; + good->base += size; + good->length -= size; + vmm_addToQueue(VMM_HE_USED, heapEntryQueues[VMM_HE_USED].head, newHE); + return newHE->base; } @@ -379,6 +384,8 @@ int vmm_moreCore(u32_t size) HeapEntry_t *newHE = vmm_getUnusedEntry(); newHE->base = wilderness->base; newHE->length = size; + newHE->next = 0; + newHE->prev = 0; wilderness->base += size; wilderness->length -= size; if (vmm_coalesceEntry(VMM_HE_FREE, newHE)) // returns 0 on success (coalesced into previous entry) @@ -438,6 +445,7 @@ void vmm_heb_init(HeapEntryBlock_t *heb) // This function adds a HeapEntry structure to the queue following 'preceeding' the queue +// fails if add to tail (add one element before tail node) void vmm_addToQueue(u32_t queue, HeapEntry_t *preceeding, HeapEntry_t *he) { heapEntryQueues[queue].count += vmm_countHeapEntries(he); @@ -472,10 +480,13 @@ HeapEntry_t *vmm_followChain(HeapEntry_t *he) // This function breaks an unused chunk from its queue and returns a pointer to it +// 09/10/05 nasty bug fixed by josh, wasn't adding unused entries when we ran out of them HeapEntry_t *vmm_getUnusedEntry() { if (heapEntryQueues[VMM_HE_UNUSED].count < 5) { + kprintf(" heapEntryQueues[VMM_HE_UNUSED].count = %d\n", + heapEntryQueues[VMM_HE_UNUSED].count); HeapEntry_t *he = heapEntryQueues[VMM_HE_HOLE].head->next; HeapEntry_t *wilderness = he; while (he) @@ -484,14 +495,15 @@ HeapEntry_t *vmm_getUnusedEntry() wilderness = he; he = (HeapEntry_t *)he->next; } + if (wilderness->length < 10000) + { + k_check(-1, "Kernel panic: out of virtual memory\n"); + } wilderness->length -= 4096; //strip 4k from the top HeapEntryBlock_t *newHEB = wilderness->base + wilderness->length; vmm_map(newHEB); vmm_heb_init(newHEB); - HeapEntry_t *newDesc = vmm_stripUnusedEntry(); //descriptor for the new HEB - newDesc->base = newHEB; - newDesc->length = 4096; - vmm_addToQueue(VMM_HE_USED, heapEntryTailNodes[VMM_HE_USED].prev, newDesc); + vmm_addToQueue(VMM_HE_UNUSED, heapEntryTailNodes[VMM_HE_UNUSED].prev, &newHEB->entry[0]); } return vmm_stripUnusedEntry(); } @@ -502,6 +514,8 @@ HeapEntry_t *vmm_stripUnusedEntry() { HeapEntry_t *he = heapEntryQueues[VMM_HE_UNUSED].head->next; heapEntryQueues[VMM_HE_UNUSED].head->next = he->next; + if (! he->next) + kprintf(" he->next is NULL\n"); ((HeapEntry_t *)he->next)->prev = he->prev; heapEntryQueues[VMM_HE_UNUSED].count--; he->next = 0; diff --git a/kernel/proc/hash.cpp b/kernel/proc/hash.cpp index f1020a1..8b5c8a8 100644 --- a/kernel/proc/hash.cpp +++ b/kernel/proc/hash.cpp @@ -33,51 +33,35 @@ hash::hash() int hash::add(u32_t key, void *val) { - kprintf("$1$"); u32_t hashed = hash_key(key); - vector *vec = myTable[hashed]; - kprintf("$2$"); - if (!vec) - myTable[hashed] = vec = new vector; - for (u32_t i = 0; i < vec->size(); i++) - if ( (*vec)[i]->key == key ) + for (u32_t i = 0; i < myTable[hashed].size(); i++) + if ( myTable[hashed][i].key == key ) return -1; // key exists already - kprintf("$3$"); - hash_entry_t *he = (hash_entry_t *) New(hash_entry_t); - kprintf("("); - for (u32_t i = 0; i < vec->size(); i++) - kprintf("%d,", (*vec)[i]->key); - kprintf(")"); - he->key = key; - he->data = val; - vec->add(he); + kprintf("hash.cpp: %d (slot %d) -> %d\n", key, hashed, val); + hash_entry_t he = {key, val}; + kprintf("hash.cpp: going to add {%d, %d} to vector %d\n", he.key, he.data, hashed); + myTable[hashed].add(he); + kprintf("hash.cpp: finished adding %d -> %d\n", + myTable[hashed][myTable[hashed].size()-1].key, + myTable[hashed][myTable[hashed].size()-1].data); mySize++; - kprintf("*%d*\t", mySize); if ( mySize > (hash_primes[mySizeIndex] << 1) ) // re-hash { - kprintf("*1*"); - vector **oldTable = myTable; + kprintf("re-hashing\n"); + vector< vector > oldTable = myTable; mySizeIndex++; - myTable = new (vector *)[hash_primes[mySizeIndex]]; + myTable = vector< vector >(); for (u32_t i = 0; i < hash_primes[mySizeIndex]; i++) - myTable[i] = NULL; + myTable.add(vector()); mySize = 0; - kprintf("*2*"); for (u32_t i = 0; i < hash_primes[mySizeIndex - 1]; i++) { - if (oldTable[i]) + for (u32_t j = 0; j < oldTable[i].size(); j++) { - for (u32_t j = 0; j < oldTable[i]->size(); j++) - { - add( (*(oldTable[i]))[j]->key, - (*(oldTable[i]))[j]->data ); - kfree( (*(oldTable[i]))[j] ); - } - delete oldTable[i]; + add( oldTable[i][j].key, + oldTable[i][j].data ); } } - kprintf("*3*"); - delete oldTable; } return 0; } @@ -85,26 +69,19 @@ int hash::add(u32_t key, void *val) void *hash::get(u32_t key) { u32_t hashed = hash_key(key); - vector *vec = myTable[hashed]; - if (!vec) - return NULL; - for (u32_t i = 0; i < vec->size(); i++) - if ( (*vec)[i]->key == key ) - return (*vec)[i]->data; + for (u32_t i = 0; i < myTable[hashed].size(); i++) + if ( myTable[hashed][i].key == key ) + return myTable[hashed][i].data; return NULL; } int hash::remove(u32_t key) { u32_t hashed = hash_key(key); - vector *vec = myTable[hashed]; - if (!vec) - return -1; - for (u32_t i = 0; i < vec->size(); i++) - if ( (*vec)[i]->key == key ) + for (u32_t i = 0; i < myTable[hashed].size(); i++) + if ( myTable[hashed][i].key == key ) { - kfree( (*vec)[i] ); - vec->remove(i); // remove key + myTable[hashed].remove(i); // remove key mySize--; return 0; } @@ -114,11 +91,8 @@ int hash::remove(u32_t key) int hash::exists(u32_t key) { u32_t hashed = hash_key(key); - vector *vec = myTable[hashed]; - if (!vec) - return 0; - for (u32_t i = 0; i < vec->size(); i++) - if ( (*vec)[i]->key == key ) + for (u32_t i = 0; i < myTable[hashed].size(); i++) + if ( myTable[hashed][i].key == key ) return 1; // key exists return 0; } @@ -132,3 +106,20 @@ u32_t hash::size() { return mySize; } + +void hash::dump() +{ + kprintf("hash table @ 0x%x : {\n", &myTable); + for (u32_t i = 0; i < hash_primes[mySizeIndex]; i++) + { + kprintf("\t%d @ 0x%x (", i, &myTable[i]); + for (u32_t j = 0; j < myTable[i].size(); j++) + kprintf("%s%d -> %d @ 0x%x", (j ? ", " : ""), + myTable[i][j].key, + myTable[i][j].data, + &myTable[i][j]); + kprintf(")\n"); + } + kprintf("}\n"); +} + diff --git a/kernel/proc/hash.h b/kernel/proc/hash.h index b39c324..4898c37 100644 --- a/kernel/proc/hash.h +++ b/kernel/proc/hash.h @@ -47,6 +47,9 @@ public: /* Check if the given key exists in the hash table */ int exists(u32_t key); + /* Dump a hash */ + void dump(); + /* How many values are in the hash table */ u32_t size(); }; diff --git a/kernel/proc/proc.cpp b/kernel/proc/proc.cpp index 900196b..4ae1cf6 100644 --- a/kernel/proc/proc.cpp +++ b/kernel/proc/proc.cpp @@ -37,13 +37,28 @@ int proc_init() memset(&tss0, 0, sizeof(tss_t)); tss0.ss0 = SEG_KERNEL_DATA; tss0.esp0 = VIRT_STACK_TOP; + kprintf("make new hash\n"); processes = new hash(); - for (u32_t i = 0; i < 110; i++) + vector< vector > test; + for (u32_t i = 0; i < 5; i++) + test.add(vector()); + for (u32_t i = 0; i < 5; i++) + for (u32_t j = 0; j < 3; j++) + test[i].add(i*10+j); + for (u32_t i = 0; i < 5; i++) + for (u32_t j = 0; j < 3; j++) + kprintf("<%d>", test[i][j]); + for (u32_t i = 0; i < 11; i++) { + kprintf("add %d to hash\n", i); processes->add(i, (void *) i); } - for (u32_t i = 0; i < 110; i++) + kprintf("\n\n"); + processes->dump(); + kprintf("\n\n"); + for (u32_t i = 0; i < 11; i++) { + kprintf("get %d from hash\n", i); if (i != (u32_t)processes->get(i)) kprintf(" !=: %d -> %d\n", i, processes->get(i)); processes->remove(i); diff --git a/kernel/vmm.S b/kernel/vmm.S new file mode 100644 index 0000000..233b611 --- /dev/null +++ b/kernel/vmm.S @@ -0,0 +1,1272 @@ + .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)"