Import backup from 2005-09-13
This commit is contained in:
1 parent
0521733e20
commit
79ca453f66
7 files changed
+60
-49
No files matched your search
+6
-8
@@ -2,7 +2,7 @@
|
||||
// Author: Josh Holtrop
|
||||
// Date: 09/30/03
|
||||
// Rewritten from scratch: 12/23/03
|
||||
// Modified: 08/17/05
|
||||
// Modified: 09/12/05
|
||||
|
||||
#include "hos_defines.h"
|
||||
#include "kernel.h"
|
||||
@@ -157,11 +157,13 @@ void *kmalloc(u32_t size)
|
||||
if (size % VMM_MALLOC_GRANULARITY)
|
||||
size = size + VMM_MALLOC_GRANULARITY -
|
||||
(size % VMM_MALLOC_GRANULARITY);
|
||||
/* added 09/12/05 by josh - fixed bug returning size 0 segments
|
||||
multiple times */
|
||||
if (size < VMM_MALLOC_GRANULARITY)
|
||||
size = VMM_MALLOC_GRANULARITY;
|
||||
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;
|
||||
}
|
||||
@@ -171,8 +173,6 @@ 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;
|
||||
}
|
||||
@@ -485,8 +485,6 @@ 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)
|
||||
@@ -515,7 +513,7 @@ 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");
|
||||
k_check(1, "kernel panic: he->next is NULL\n");
|
||||
((HeapEntry_t *)he->next)->prev = he->prev;
|
||||
heapEntryQueues[VMM_HE_UNUSED].count--;
|
||||
he->next = 0;
|
||||
|
||||
Reference in new issue
Block a user