Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

System initialization

When Hermes is booted, among its various roles in initializing the system and various kernel subsystems, the kernel will load and execute a user-provided program image as the first task, referred to as the “init” task, or simply “init”.

User image loading

The user image is an ELF executable file built for the system architecture. The image is loaded using the smallest pages supported on the target architecture (usually 4KiB) and each program header must be located at a page boundary.

The kernel allocates the user image pages (and any intermediate page tables necessary to map them) from the largest available Memory capability on the system. The kernel additionally allocates and maps a stack for the init process.

Warning

The kernel makes no attempt to initialize thread-local storage for the init task.

Bootinfo

Information about the system, boot environment, and the capabilities allocated to init during system startup is available to userspace through the bootinfo structure.

Initial task environment

The init task is configured with a CSpace which is populated with capabilities that enumerate all of the resources available on the system.

The initial task affinity is set to the first CPU in the bootinfo’s cpu_info list.

x86_64-specific details

Registers are initialized as follows:

RegisterInitial valuePurpose
%ripELF entry pointEntry point
%rsp0x7fff80000000Initial stack (grows down)
%rdi0x7fff80000000Bootinfo address (grows up)

Initial CSpace

The init task receives a CSpace allocated with a fixed radix of 16, which can store up to 65,536 capabilities. The initial CSpace has 16 guard bits set to 0x0000, allowing the init task to address capabilities using their index in the initial CSpace.

The init task receives the following capabilities at fixed capability addresses:

caddrTypeNotes
0x0000CSPACEInit task CSpace
0x0001VSPACEInit task VSpace
0x0002TASKInit task
0x0008-0x0010VariesArch-specific capabilities
0x0010+VariesDynamically allocated capabilities

The dynamically allocated capabilities include a variable number of capabilities for Memory areas installed on the system, page and page table capabilities for the mapped user image, stack, and bootinfo, and so on. The address assignments are noted in the bootinfo structure.

Any unused capability slots contain Null capabilities.

x86_64-specific initial capabilities

The init task on x86_64 receives the following additional capabilities:

caddrTypeNotes
0x0008IOCONTROLGlobal I/O control
0x0009IRQCONTROLGlobal IRQ control

Note

All unallocated capability addresses below address 0x0010 are reserved for future use and should not be used by the init task.