some comments cleaned up
This commit is contained in:
parent
2e230a609e
commit
dac9b20c18
2 changed files with 8 additions and 12 deletions
|
@ -34,7 +34,7 @@
|
||||||
// ____ _ _
|
// ____ _ _
|
||||||
// / ___| _ _ _ __ ___ | |__ ___ | |___
|
// / ___| _ _ _ __ ___ | |__ ___ | |___
|
||||||
// \___ \| | | | '_ ` _ \| '_ \ / _ \| / __|
|
// \___ \| | | | '_ ` _ \| '_ \ / _ \| / __|
|
||||||
// ___) | |_| | | | | | | |_) | (_) | \__ \
|
// ___) | |_| | | | | | | |_) | (_) | \__
|
||||||
// |____/ \__, |_| |_| |_|_.__/ \___/|_|___/
|
// |____/ \__, |_| |_| |_|_.__/ \___/|_|___/
|
||||||
// |___/
|
// |___/
|
||||||
//
|
//
|
||||||
|
@ -253,7 +253,7 @@
|
||||||
// _____ _ _
|
// _____ _ _
|
||||||
// | ___| _ _ __ ___| |_(_) ___ _ __ ___
|
// | ___| _ _ __ ___| |_(_) ___ _ __ ___
|
||||||
// | |_ | | | | '_ \ / __| __| |/ _ \| '_ \/ __|
|
// | |_ | | | | '_ \ / __| __| |/ _ \| '_ \/ __|
|
||||||
// | _|| |_| | | | | (__| |_| | (_) | | | \__ \
|
// | _|| |_| | | | | (__| |_| | (_) | | | \__
|
||||||
// |_| \__,_|_| |_|\___|\__|_|\___/|_| |_|___/
|
// |_| \__,_|_| |_|\___|\__|_|\___/|_| |_|___/
|
||||||
//
|
//
|
||||||
// #########################################################################################
|
// #########################################################################################
|
||||||
|
|
16
mm/memory.c
16
mm/memory.c
|
@ -109,7 +109,8 @@ int mmu_init(void)
|
||||||
|
|
||||||
while (mmap < mmap_end) {
|
while (mmap < mmap_end) {
|
||||||
if (mmap->type == MULTIBOOT_MEMORY_AVAILABLE) {
|
if (mmap->type == MULTIBOOT_MEMORY_AVAILABLE) {
|
||||||
/* set the available memory as "unused" */
|
/
|
||||||
|
// set the available memory as "unused"
|
||||||
addr = mmap->addr;
|
addr = mmap->addr;
|
||||||
end_addr = addr + mmap->len;
|
end_addr = addr + mmap->len;
|
||||||
|
|
||||||
|
@ -129,7 +130,7 @@ int mmu_init(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#elif defined(CONFIG_ROCKCREEK)
|
#elif defined(CONFIG_ROCKCREEK)
|
||||||
/* of course, the first slots belong to the private memory */
|
// of course, the first slots belong to the private memory
|
||||||
for(addr=0x00; addr<1*0x1000000; addr+=PAGE_SIZE) {
|
for(addr=0x00; addr<1*0x1000000; addr+=PAGE_SIZE) {
|
||||||
page_clear_mark(addr >> PAGE_SHIFT);
|
page_clear_mark(addr >> PAGE_SHIFT);
|
||||||
if (addr > addr + PAGE_SIZE)
|
if (addr > addr + PAGE_SIZE)
|
||||||
|
@ -147,9 +148,7 @@ int mmu_init(void)
|
||||||
atomic_int32_inc(&total_available_pages);
|
atomic_int32_inc(&total_available_pages);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// mark the bootinfo as used.
|
||||||
* Mark the bootinfo as used.
|
|
||||||
*/
|
|
||||||
page_set_mark((size_t)bootinfo >> PAGE_SHIFT);
|
page_set_mark((size_t)bootinfo >> PAGE_SHIFT);
|
||||||
atomic_int32_inc(&total_allocated_pages);
|
atomic_int32_inc(&total_allocated_pages);
|
||||||
atomic_int32_dec(&total_available_pages);
|
atomic_int32_dec(&total_available_pages);
|
||||||
|
@ -164,7 +163,7 @@ int mmu_init(void)
|
||||||
atomic_int32_add(&total_allocated_pages, kernel_size >> PAGE_SHIFT);
|
atomic_int32_add(&total_allocated_pages, kernel_size >> PAGE_SHIFT);
|
||||||
atomic_int32_sub(&total_available_pages, kernel_size >> PAGE_SHIFT);
|
atomic_int32_sub(&total_available_pages, kernel_size >> PAGE_SHIFT);
|
||||||
|
|
||||||
/* set kernel space as used */
|
// set kernel space as used
|
||||||
for(i=(size_t) &kernel_start >> PAGE_SHIFT; i < (size_t) &kernel_end >> PAGE_SHIFT; i++)
|
for(i=(size_t) &kernel_start >> PAGE_SHIFT; i < (size_t) &kernel_end >> PAGE_SHIFT; i++)
|
||||||
page_set_mark(i);
|
page_set_mark(i);
|
||||||
if ((size_t) &kernel_end & (PAGE_SIZE-1))
|
if ((size_t) &kernel_end & (PAGE_SIZE-1))
|
||||||
|
@ -194,9 +193,7 @@ int mmu_init(void)
|
||||||
if (mb_info && (mb_info->flags & MULTIBOOT_INFO_MODS)) {
|
if (mb_info && (mb_info->flags & MULTIBOOT_INFO_MODS)) {
|
||||||
multiboot_module_t* mmodule = (multiboot_module_t*) ((size_t) mb_info->mods_addr);
|
multiboot_module_t* mmodule = (multiboot_module_t*) ((size_t) mb_info->mods_addr);
|
||||||
|
|
||||||
/*
|
// mark the mb_info as used.
|
||||||
* Mark the mb_info as used.
|
|
||||||
*/
|
|
||||||
page_set_mark((size_t)mb_info >> PAGE_SHIFT);
|
page_set_mark((size_t)mb_info >> PAGE_SHIFT);
|
||||||
atomic_int32_inc(&total_allocated_pages);
|
atomic_int32_inc(&total_allocated_pages);
|
||||||
atomic_int32_dec(&total_available_pages);
|
atomic_int32_dec(&total_available_pages);
|
||||||
|
@ -371,7 +368,6 @@ void kfree(void* addr, size_t sz)
|
||||||
|
|
||||||
index = phyaddr >> PAGE_SHIFT;
|
index = phyaddr >> PAGE_SHIFT;
|
||||||
page_clear_mark(index);
|
page_clear_mark(index);
|
||||||
|
|
||||||
}
|
}
|
||||||
spinlock_unlock(&bitmap_lock);
|
spinlock_unlock(&bitmap_lock);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue