diff --git a/mm/memory.c b/mm/memory.c index efa3d5c6..11f6fdce 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -152,8 +152,8 @@ int mmu_init(void) } } #elif defined(CONFIG_ROCKCREEK) - /* of course, the first slot belongs to the private memory */ - for(addr=0x00; addr<0x1000000; addr+=PAGE_SIZE) { + /* of course, the first twenty slots belong to the private memory */ + for(addr=0x00; addr<20*0x1000000; addr+=PAGE_SIZE) { page_clear_mark(addr >> PAGE_SHIFT); if (addr > addr + PAGE_SIZE) break; @@ -161,6 +161,15 @@ int mmu_init(void) atomic_int32_inc(&total_available_pages); } + // Note: The last slot belongs always to the private memory. + for(addr=0xFF000000; addr<0xFFFFFFFF; addr+=PAGE_SIZE) { + page_clear_mark(addr >> PAGE_SHIFT); + if (addr > addr + PAGE_SIZE) + break; + atomic_int32_inc(&total_pages); + atomic_int32_inc(&total_available_pages); + } + /* * Mark the bootinfo as used. */ @@ -201,8 +210,8 @@ int mmu_init(void) #ifdef CONFIG_ROCKCREEK /* - * Now, we are able to read the FPGA register and to - * determin the number of slots. + * Now, we are able to read the FPGA registers and to + * determine the number of slots for private memory. */ uint32_t slots = *((volatile uint32_t*) (FPGA_BASE + 0x8244)); if (slots == 0) @@ -210,17 +219,8 @@ int mmu_init(void) kprintf("MetalSVM use %d slots for private memory\n", slots); - // define all the private slots as free - for(addr=0x1000000; addr<(slots-1)*0x1000000; addr+=PAGE_SIZE) { - page_clear_mark(addr >> PAGE_SHIFT); - if (addr > addr + PAGE_SIZE) - break; - atomic_int32_inc(&total_pages); - atomic_int32_inc(&total_available_pages); - } - - // Note: The last slot belongs always to the private memory. - for(addr=0xFF000000; addr<0xFFFFFFFF; addr+=PAGE_SIZE) { + // define the residual private slots as free + for(addr=20*0x1000000; addr<(slots-1)*0x1000000; addr+=PAGE_SIZE) { page_clear_mark(addr >> PAGE_SHIFT); if (addr > addr + PAGE_SIZE) break;