[uClinux-dev] init_mem_alloc and PAGE_OFFSET

John Williams jwilliams at itee.uq.edu.au
Tue Mar 11 01:57:34 EST 2003

Hi folks,

My port is based on the v850, so Miles you might be able to help here :)

Basically, where should PAGE_OFFSET point in a uclinux system?

On my dev board I only have 1MB of SRAM, arbitrarily mapped from 
0xFFE00000 -> 0xFFEFFFFF  .  I know this isn't enough for a production 
system, but my bare kernel image is only about 500K so I should be OK 
for a little while.

I have a little debug stub/bootloader in on-chip memory (0x0000 -> 
0x1FFF) that grabs a kernel image over the serial port and initialises 
all the segments etc in their appropriate places.

Anyway so the kernel loads into RAM at FFE00000, and after several hours 
of frustrating debugging I found that the init_mem_alloc function is 
stomping on a significant portion of my kernel image :(  sometimes, 
having an MMU would be nice!

I think it's all to do with how I set the PAGE_OFFSET macro.

Currently I take a leaf out of the v850 book and set PAGE_OFFSET to the 
start of external RAM, however I think because my entire kernel is 
living there, that's causing the problem... where should PAGE_OFFSET 
point in a uclinux system?  At the end of the kernel image?

My revised interpretation is that it should point to the first page of 
"allocateable" memory, is that right?  Should I maybe add a symbol to 
the link script so I can easily determine where the kernel (and ROMFS 
etc) ends, then round up to the nearest page boundary?

Any general principles I should apply here?



More information about the uClinux-dev mailing list