Barrelfish
Macros | Functions | Variables
init.h File Reference

x86-64 architecture initialization More...

Macros

#define KERNEL_BOOT_MAGIC   0x33e1f154
 Magic value passed when kernel is booted by itself (and not bootloader)
 

Functions

void arch_init (uint64_t magic, void *pointer)
 Architecture-specific initialization function. More...
 
void syscall_entry (void)
 

Variables

bool idt_initialized
 

Detailed Description

x86-64 architecture initialization

Function Documentation

void arch_init ( uint64_t  magic,
void *  pointer 
)

Architecture-specific initialization function.

This function is called by the bootup code in boot.S to initialize architecture-specific stuff. It is expected to call the kernel main loop. This function never returns.

The kernel expects one of two magic values in 'magic' that determine how it has been booted. If 'magic' is #MULTIBOOT_INFO_MAGIC the kernel has been booted by a (Multiboot-compliant) bootloader and this is the first image on the boot CPU. It will relocate itself to a default position. If 'magic' is KERNEL_BOOT_MAGIC it has been booted by another image of itself and is running on an (so-called) application CPU.

This function sets up new page tables to alias the kernel at MEMORY_OFFSET. It also does any relocations necessary to the "position-independent" code to make it run at the new location (e.g. relocating the GOT). After all relocations, it calls text_init() of the relocated image, which destroys the lower alias and may never return.

For bsp kernels, the void pointer is of type multiboot_info, for application CPUs, it is of type global. Global carries a pointer to multiboot_info. Global also contains pointers to memory that is shared between kernels.

Parameters
magicBoot magic value
pointerPointer to Multiboot Info or to Global structure
void syscall_entry ( void  )

Fast system call entry point (in Assembler).

Variable Documentation

bool idt_initialized

This flag is set to true once the IDT is initialized and exceptions can be caught.