Forum Discussion
Altera_Forum
Honored Contributor
21 years agoThanks again,
The problem with telling it about all 1G is that I don't have all 1G of SDRAM right now -- just a 128MB stick. So, right now, my gear looks like: 0x0 - 0x07FFFFFF -- SDRAM 0x08000000 - 0x3FFFFFFF -- Nothing 0x40000000 - 0x40FFFFFF -- SRAM So, if I understand correctly, to use free_area_init_node, I need to pass it a zholes_size array, which in my case should be { (0x40000000 - 0x08000000), 0, 0 }. I edited paging_init as shown below, and I get uClinux/Nios II Altera Nios II support © 2004 Microtronix Datacom Ltd. KERNEL -> TEXT=0x40000000-0x40132c04 DATA=0x40132c10-0x40160000 BSS=0x40179350-0 x4017937d KERNEL -> MEM=0x4017a000-0x41000000 STACK=0x41000000-0x41000000 setup_arch: No persistant network settings signature at 43FF0000 start_mem is 0x4017a000 virtual_end is 0x41000000 Built 1 zonelists Kernel command line: root=/dev/mtdblock0 ro PID hash table entries: 4096 (order: 12, 65536 bytes) __alloc_bootmem_core(): zero-sized request /cygdrive/c/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.ker nel_0.1.5/linux-2.6.x/mm/bootmem.c(156): kernel BUG! Dentry cache hash table entries: -2147483648 (order: -12, 0 bytes) __alloc_bootmem_core(): zero-sized request /cygdrive/c/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.ker nel_0.1.5/linux-2.6.x/mm/bootmem.c(156): kernel BUG! Inode-cache hash table entries: 1073741824 (order: -12, 0 bytes) Any thoughts? Am I doing something blatantly wrong in the code below? Ryanvoid paging_init(void)
{
/*
* Make sure start_mem is page aligned, otherwise bootmem and
* page_alloc get different views of the world.
*/
# ifdef DEBUG
unsigned long start_mem = PAGE_ALIGN(memory_start);
//#endif
unsigned long end_mem = memory_end & PAGE_MASK;
//#ifdef DEBUG
printk (/*KERN_DEBUG*/ "start_mem is %#lx\nvirtual_end is %#lx\n",
start_mem, end_mem);
//#endif
/*
* Initialize the bad page table and bad page to point
* to a couple of allocated pages.
*/
empty_bad_page_table = (unsigned long)alloc_bootmem_pages(PAGE_SIZE);
empty_bad_page = (unsigned long)alloc_bootmem_pages(PAGE_SIZE);
empty_zero_page = (unsigned long)alloc_bootmem_pages(PAGE_SIZE);
memset((void *)empty_zero_page, 0, PAGE_SIZE);
/*
* Set up SFC/DFC registers (user data space).
*/
set_fs (USER_DS);
# ifdef DEBUG
printk (KERN_DEBUG "before free_area_init\n");
printk (KERN_DEBUG "free_area_init -> start_mem is %#lx\nvirtual_end is %#lx\n",
start_mem, end_mem);# endif
{
unsigned long zones_size = {0, 0, 0};
unsigned long holes_size = {0, 0, 0};
zones_size = (0x8000000-PAGE_OFFSET) >> PAGE_SHIFT;
zones_size = (0x1000000-PAGE_OFFSET) >> PAGE_SHIFT;
holes_size = zones_size-zones_size;
# ifdef CONFIG_HIGHMEM
zones_size = 0;# endif
//free_area_init(zones_size);
free_area_init_node(0, &contig_page_data, zones_size, __pa(PAGE_OFFSET) >> PAGE_SHIFT, holes_size);
}
}