Porting¶
Taken from list archive athttp://lists.arm.linux.org.uk/pipermail/linux-arm-kernel/2001-July/004064.html
Initial definitions¶
The following symbol definitions rely on you knowing the translation that__virt_to_phys() does for your machine. This macro converts the passedvirtual address to a physical address. Normally, it is simply:
phys = virt - PAGE_OFFSET + PHYS_OFFSET
Decompressor Symbols¶
- ZTEXTADDR
- Start address of decompressor. There’s no point in talking aboutvirtual or physical addresses here, since the MMU will be off atthe time when you call the decompressor code. You normally callthe kernel at this address to start it booting. This doesn’t haveto be located in RAM, it can be in flash or other read-only orread-write addressable medium.
- ZBSSADDR
- Start address of zero-initialised work area for the decompressor.This must be pointing at RAM. The decompressor will zero initialisethis for you. Again, the MMU will be off.
- ZRELADDR
This is the address where the decompressed kernel will be written,and eventually executed. The following constraint must be valid:
__virt_to_phys(TEXTADDR) == ZRELADDRThe initial part of the kernel is carefully coded to be positionindependent.
- INITRD_PHYS
- Physical address to place the initial RAM disk. Only relevant ifyou are using the bootpImage stuff (which only works on the oldstruct param_struct).
- INITRD_VIRT
Virtual address of the initial RAM disk. The following constraintmust be valid:
__virt_to_phys(INITRD_VIRT) == INITRD_PHYS- PARAMS_PHYS
- Physical address of the struct param_struct or tag list, giving thekernel various parameters about its execution environment.
Kernel Symbols¶
- PHYS_OFFSET
- Physical start address of the first bank of RAM.
- PAGE_OFFSET
- Virtual start address of the first bank of RAM. During the kernelboot phase, virtual address PAGE_OFFSET will be mapped to physicaladdress PHYS_OFFSET, along with any other mappings you supply.This should be the same value as TASK_SIZE.
- TASK_SIZE
The maximum size of a user process in bytes. Since user spacealways starts at zero, this is the maximum address that a userprocess can access+1. The user space stack grows down from thisaddress.
Any virtual address below TASK_SIZE is deemed to be user processarea, and therefore managed dynamically on a process by processbasis by the kernel. I’ll call this the user segment.
Anything above TASK_SIZE is common to all processes. I’ll callthis the kernel segment.
(In other words, you can’t put IO mappings below TASK_SIZE, andhence PAGE_OFFSET).
- TEXTADDR
- Virtual start address of kernel, normally PAGE_OFFSET + 0x8000.This is where the kernel image ends up. With the latest kernels,it must be located at 32768 bytes into a 128MB region. Previouskernels placed a restriction of 256MB here.
- DATAADDR
- Virtual address for the kernel data segment. Must not be definedwhen using the decompressor.
- VMALLOC_START / VMALLOC_END
- Virtual addresses bounding the
vmalloc()area. There must not beany static mappings in this area; vmalloc will overwrite them.The addresses must also be in the kernel segment (see above).Normally, thevmalloc()area starts VMALLOC_OFFSET bytes above thelast virtual RAM address (found using variable high_memory). - VMALLOC_OFFSET
- Offset normally incorporated into VMALLOC_START to provide a holebetween virtual RAM and the vmalloc area. We do this to allowout of bounds memory accesses (eg, something writing off the endof the mapped memory map) to be caught. Normally set to 8MB.
Architecture Specific Macros¶
- BOOT_MEM(pram,pio,vio)
pram specifies the physical start address of RAM. Must alwaysbe present, and should be the same as PHYS_OFFSET.
pio is the physical address of an 8MB region containing IO foruse with the debugging macros in arch/arm/kernel/debug-armv.S.
vio is the virtual address of the 8MB debugging region.
It is expected that the debugging region will be re-initialisedby the architecture specific code later in the code (via theMAPIO function).
- BOOT_PARAMS
- Same as, and see PARAMS_PHYS.
- FIXUP(func)
- Machine specific fixups, run before memory subsystems have beeninitialised.
- MAPIO(func)
- Machine specific function to map IO areas (including the debugregion above).
- INITIRQ(func)
- Machine specific function to initialise interrupts.