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 (uint32_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 ( uint32_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. It expects 'dest' to be a physical address pointing to the base of a memory area to relocate itself to.

For x86-64, after performing some sanity checks to the kernel image, this function first copies the whole kernel to a CPU-local version and then calls local_init(), at the offset of the local copy, to initialize that local copy. local_init() should 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.