Import backup from 2005-08-18
This commit is contained in:
1 parent
e1682a2fe7
commit
345ef6c9f3
35 files changed
+804
-89
No files matched your search
+16
-4
@@ -18,7 +18,6 @@ int vmm_coalesceEntry(u32_t queue, HeapEntry_t *newHE);
|
||||
void vmm_heb_init(HeapEntryBlock_t *heb);
|
||||
void vmm_addToQueue(u32_t queue, HeapEntry_t *preceeding, HeapEntry_t *he);
|
||||
int vmm_countHeapEntries(HeapEntry_t *he);
|
||||
int vmm_unmapp(void *addr);
|
||||
HeapEntry_t *vmm_followChain(HeapEntry_t *he);
|
||||
HeapEntry_t *vmm_getUnusedEntry();
|
||||
HeapEntry_t *vmm_stripUnusedEntry();
|
||||
@@ -57,10 +56,16 @@ void vmm_init()
|
||||
|
||||
/* Allocate a physical page and map the virtual address to it, return physical address allocated or NULL */
|
||||
int vmm_map(void *virt)
|
||||
{
|
||||
u32_t dum;
|
||||
return vmm_map_addr(virt, &dum);
|
||||
}
|
||||
|
||||
int vmm_map_addr(void *virt, u32_t *phys_addr)
|
||||
{
|
||||
if (mm_freepages < 10)
|
||||
return -1;
|
||||
return vmm_map1((u32_t)virt, mm_palloc());
|
||||
return vmm_map1((u32_t)virt, *phys_addr = mm_palloc());
|
||||
}
|
||||
|
||||
|
||||
@@ -191,6 +196,12 @@ int kfree(void *addr)
|
||||
|
||||
// This function allocates a virtual page and maps it to a physical page
|
||||
void *vmm_palloc()
|
||||
{
|
||||
u32_t dum;
|
||||
return vmm_palloc_addr(&dum);
|
||||
}
|
||||
|
||||
void *vmm_palloc_addr(u32_t *phys_addr)
|
||||
{
|
||||
k_enter_critical();
|
||||
HeapEntry_t *he = heapEntryQueues[VMM_HE_HOLE].head->next;
|
||||
@@ -201,7 +212,7 @@ void *vmm_palloc()
|
||||
{
|
||||
vmm_removeHeapEntry(VMM_HE_HOLE, he);
|
||||
vmm_addToQueue(VMM_HE_USED, &heapEntryHeadNodes[VMM_HE_USED], he);
|
||||
if (vmm_map(he->base))
|
||||
if (vmm_map_addr(he->base, phys_addr))
|
||||
he->base = NULL;
|
||||
k_leave_critical();
|
||||
return he->base;
|
||||
@@ -220,7 +231,7 @@ void *vmm_palloc()
|
||||
he->base = wilderness->base + wilderness->length;
|
||||
he->length = 4096;
|
||||
vmm_addToQueue(VMM_HE_USED, &heapEntryHeadNodes[VMM_HE_USED], he);
|
||||
if (vmm_map(he->base))
|
||||
if (vmm_map_addr(he->base, phys_addr))
|
||||
he->base = NULL;
|
||||
k_leave_critical();
|
||||
return he->base;
|
||||
@@ -236,6 +247,7 @@ int vmm_pfree(void *addr)
|
||||
if (vmm_unmapp(addr))
|
||||
return -1;
|
||||
mm_pfree(pbase);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vmm_unmapp(void *addr)
|
||||
|
||||
@@ -40,11 +40,14 @@ typedef struct {
|
||||
void vmm_init();
|
||||
void *kmalloc(u32_t size);
|
||||
int kfree(void *addr);
|
||||
int vmm_unmapp(void *addr);
|
||||
void *vmm_palloc();
|
||||
void *vmm_palloc_addr(u32_t *phys_addr);
|
||||
int vmm_pfree(void *addr);
|
||||
void *kcalloc(unsigned int number, unsigned int size);
|
||||
|
||||
int vmm_map(void *virt);
|
||||
int vmm_map_addr(void *virt, u32_t *phys_addr);
|
||||
int vmm_map1(unsigned int virt, unsigned int physical);
|
||||
int vmm_mapn(unsigned int virt, unsigned int physical, unsigned int n);
|
||||
void vmm_unmap1(unsigned int virt);
|
||||
|
||||
Reference in new issue
Block a user