Barrelfish
Macros | Variables
offsets.h File Reference

ARMv7-A address space sizes and offsets. More...

Macros

#define GEN_ADDR(bits)   (((genpaddr_t)1) << bits)
 
#define VADDR_SPACE_SIZE   GEN_ADDR(32);
 
#define PADDR_SPACE_SIZE   GEN_ADDR(32)
 
#define PADDR_SPACE_LIMIT   (PADDR_SPACE_SIZE - 1)
 
#define RAM_WINDOW_SIZE   GEN_ADDR(30)
 
#define KERNEL_OFFSET   0x80000000
 
#define INIT_SPACE_LIMIT   (32 * 1024 * 1024)
 
#define INIT_VBASE   (2 * 1024 * 1024)
 
#define MEMORY_OFFSET   GEN_ADDR(31)
 
#define VECTORS_BASE   0xffff0000
 
#define KERNEL_STACK_SIZE   0x4000
 
#define INT_HANDLER_TABLE   0xFFFF0100
 

Variables

lpaddr_t phys_memory_start
 
uint8_t kernel_first_byte
 
uint8_t kernel_text_final_byte
 
uint8_t kernel_final_byte
 
uintptr_t kernel_stack [KERNEL_STACK_SIZE/sizeof(uintptr_t)]
 The kernel stack. More...
 

Detailed Description

ARMv7-A address space sizes and offsets.

The layout of the ARM virtual address space can be summarized as follows:

User-space maps user-space programs. Physical memory maps all available physical memory (up to PADDR_SPACE_LIMIT). Kernel-space maps only the kernel text and data.

This partition is static and can only be changed at compile-time.

Macro Definition Documentation

#define GEN_ADDR (   bits)    (((genpaddr_t)1) << bits)

GEN_ADDR(bits) gives the size of address space possible with <bits> bits.

#define INIT_SPACE_LIMIT   (32 * 1024 * 1024)

Static address space limit for the init user-space domain. The static space is used to map in code and static data of the init module, as well as all loaded multiboot modules. init can freely allocate dynamic memory as soon as it is running. This is 32 MBytes right now.

You should make this constant a multiple of #BASE_PAGE_SIZE * #PTABLE_SIZE or you'll restrict init's static address space unneccessarily. init's lowest segment should also be based at these multiples or it restricts itself.

NB 32MB is size of the fast context switch extension per-process address space.

#define INIT_VBASE   (2 * 1024 * 1024)

Base address of init address space in virtual memory. init should start at 4 MByte. The kernel maps in important structures at 2 MByte. This address should be page-table size aligned (i.e. with 4 KByte pages, a page table maps 2 MBytes. Thus, align it to multiples of 2 MBytes).

#define INT_HANDLER_TABLE   0xFFFF0100

Kernel interrupt jump table

#define KERNEL_OFFSET   0x80000000

Kernel offset - the kernel window is mapped by TTBR1, from 2GB.

#define KERNEL_STACK_SIZE   0x4000

Kernel stack size – 16KB

#define MEMORY_OFFSET   GEN_ADDR(31)

Absolute offset of mapped physical memory within virtual address space. Just to clarify, this means that RAM will be mapped into kernel virtual address space at this address (i.e. 2GB.).

#define PADDR_SPACE_LIMIT   (PADDR_SPACE_SIZE - 1)

Maximum physical address space mappable by the kernel. Adjust this for a bigger physical address space.

#define PADDR_SPACE_SIZE   GEN_ADDR(32)

Absolute size of physical address space.

#define RAM_WINDOW_SIZE   GEN_ADDR(30)

The size of the kernel's RAM window.

#define VADDR_SPACE_SIZE   GEN_ADDR(32);

Absolute size of virtual address space. This is 32-bit on ARM.

#define VECTORS_BASE   0xffff0000

The high exception vector address

Variable Documentation

uint8_t kernel_final_byte

Symbol: End of kernel image. This symbol points to the end address of the kernel image.

uint8_t kernel_first_byte

Symbol: Start of kernel image. This symbol points to the start address of the kernel image.

uintptr_t kernel_stack[KERNEL_STACK_SIZE/sizeof(uintptr_t)]

The kernel stack.

Declared in boot.S.

uint8_t kernel_text_final_byte

Symbol: End of kernel image. This symbol points to the end address of the kernel image.

lpaddr_t phys_memory_start

Absolute start of RAM in physical memory.