- minor changes in the prototyp of mmu_init
- return value 0 => successfull intitialization of the mmu git-svn-id: http://svn.lfbs.rwth-aachen.de/svn/scc/trunk/MetalSVM@29 315a16e6-25f9-4109-90ae-ca3045a26c18
This commit is contained in:
parent
b09114c06c
commit
6fdb0a2068
2 changed files with 10 additions and 3 deletions
|
@ -36,7 +36,7 @@ typedef struct {
|
|||
atomic_size_t usage;
|
||||
} mm_t;
|
||||
|
||||
void mmu_init(void);
|
||||
int mmu_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
11
mm/memory.c
11
mm/memory.c
|
@ -21,6 +21,7 @@
|
|||
#include <metalsvm/string.h>
|
||||
#include <metalsvm/mmu.h>
|
||||
#include <metalsvm/spinlocks.h>
|
||||
#include <metalsvm/time.h>
|
||||
#ifdef USE_MULTIBOOT
|
||||
#include <asm/multiboot.h>
|
||||
#endif
|
||||
|
@ -71,7 +72,7 @@ inline static void page_unmarked(unsigned int i)
|
|||
bitmap[index] = bitmap[index] & ~(1 << mod);
|
||||
}
|
||||
|
||||
void mmu_init(void)
|
||||
int mmu_init(void)
|
||||
{
|
||||
size_t kernel_size;
|
||||
unsigned int i;
|
||||
|
@ -80,7 +81,7 @@ void mmu_init(void)
|
|||
memset(bitmap, 0xFF, sizeof(uint8_t)*BITMAP_SIZE);
|
||||
|
||||
#ifdef USE_MULTIBOOT
|
||||
if (mb_info) {
|
||||
if (mb_info && (mb_info->flags & (1 << (6)))) {
|
||||
multiboot_memory_map_t* mmap = (multiboot_memory_map_t*) mb_info->mmap_addr;
|
||||
multiboot_memory_map_t* mmap_end = (void*) ((size_t) mb_info->mmap_addr + mb_info->mmap_length);
|
||||
|
||||
|
@ -99,6 +100,10 @@ void mmu_init(void)
|
|||
}
|
||||
mmap++;
|
||||
}
|
||||
} else {
|
||||
kputs("Unable to initialize the memory management subsystem\n");
|
||||
sleep(5);
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
#error Currently, MetalSVM needs multiboot!
|
||||
|
@ -114,6 +119,8 @@ void mmu_init(void)
|
|||
page_marked(i);
|
||||
|
||||
alloc_start = (unsigned int) (&kernel_end) / PAGE_SIZE + 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void* task_malloc(task_t* task, size_t sz)
|
||||
|
|
Loading…
Add table
Reference in a new issue