Exemple #1
0
void __init paging_init(void)
{
    unsigned long max_zone_pfns[MAX_NR_ZONES];
    unsigned long lastpfn;

    pagetable_init();
    max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
    lastpfn = max_low_pfn;
    free_area_init_nodes(max_zone_pfns);
}
Exemple #2
0
/*
 * paging_init() continues the virtual memory environment setup which
 * was begun by the code in arch/head.S.
 * The parameters are pointers to where to stick the starting and ending
 * addresses of available kernel virtual memory.
 */
void __init paging_init(void)
{
	unsigned long zones_size[MAX_NR_ZONES];

	memset(zones_size, 0, sizeof(zones_size));

	pagetable_init();
	pgd_current = swapper_pg_dir;

	zones_size[ZONE_NORMAL] = max_mapnr;

	/* pass the memory from the bootmem allocator to the main allocator */
	free_area_init(zones_size);

	flush_dcache_range((unsigned long)empty_zero_page,
			(unsigned long)empty_zero_page + PAGE_SIZE);
}
Exemple #3
0
void loader_main(struct multiboot_info *mb)
{
    multiboot_module_t *mod;
    multiboot_memory_map_t *mmap;
    uint32_t kernel_entry, kernel_end;
    uint64_t max_addr = 0;
    uint64_t max_avail = 0;
    int m = 0;

    serial_init();

    printk("Memory map from multiboot info:\n");

    for (mmap = (multiboot_memory_map_t *)mb->mmap_addr; 
         (uint32_t)mmap < mb->mmap_addr + mb->mmap_length; mmap++) {
        m += mmap->len;
        printk("%d 0x%llx - 0x%llx [%d] (%d)\n", mmap->size, 
               mmap->addr, 
               mmap->addr + mmap->len, m/1024, mmap->type);
        max_addr = mmap->addr + mmap->len;
        if ( mmap->type == MULTIBOOT_MEMORY_AVAILABLE )
            max_avail = max_addr;
    }

    mod = (multiboot_module_t *) mb->mods_addr;

    printk("Found: %s\n", (char *)mod->cmdline);

    /* update mod_end with room for bss... we really should find the
       bss and fill it with zeros so the kernel doesn't need to worry
       about doing the zeroing. */
    mod->mod_end = elf_get_end(mod->mod_start);
    kernel_entry = elf_get_entry(mod->mod_start);

    printk("mod_start: 0x%lx\n", mod->mod_start);
    printk("mod_end: 0x%lx\n", mod->mod_end);
    printk("max_addr: 0x%llx\n", max_addr);
    printk("max_avail: 0x%llx\n", max_avail);

    kernel_end = ((mod->mod_end & PAGE_MASK) + PAGE_SIZE);
    pagetable_init(max_addr, kernel_end);
    gdt_init();

    to64_jump(kernel_entry, (uint32_t)mb, max_avail - 8);
}
Exemple #4
0
/*
 * paging_init() sets up the page tables - note that the first 8MB are
 * already mapped by head.S.
 *
 * This routines also unmaps the page at virtual kernel address 0, so
 * that we can trap those pesky NULL-reference errors in the kernel.
 */
void __init paging_init(void)
{
#ifdef CONFIG_X86_PAE
	set_nx();
	if (nx_enabled)
		printk("NX (Execute Disable) protection: active\n");
#endif

	pagetable_init();

	load_cr3(swapper_pg_dir);

#ifdef CONFIG_X86_PAE
	/*
	 * We will bail out later - printk doesn't work right now so
	 * the user would just see a hanging kernel.
	 */
	if (cpu_has_pae)
		set_in_cr4(X86_CR4_PAE);
#endif
	__flush_tlb_all();

	kmap_init();
}