Set of functions and variables for booting the kernel.
More...
|
void | boot_kernel (uint32_t stack_pointer, uint32_t entry, struct boot_info_t *boot_info) |
| External function implemented in boot.S . More...
|
|
static void | __outportb (uint16_t port, uint8_t data) |
| Use this to write to I/O ports to send bytes to devices. More...
|
|
static void | __debug_putchar (char c) |
| Writes the given character on the debug port. More...
|
|
static void | __debug_puts (char *s) |
| Writes the given string on the debug port. More...
|
|
static uint32_t | __align_rup (uint32_t addr, uint32_t value) |
| Align memory address to the specified value (round up). More...
|
|
static uint32_t | __align_rdown (uint32_t addr, uint32_t value) |
| Align memory address to the specified value (round down). More...
|
|
static void | __setup_pages (uint32_t pfn_virt_start, uint32_t pfn_phys_start, uint32_t pfn_count) |
| Prepares the page frames. More...
|
|
static void | __setup_boot_paging (void) |
| Setup paging mapping all the low memory to two places: one is the physical address of the memory itself the other is in the virtual kernel address space.
|
|
static void | __get_kernel_low_high (elf_header_t *elf_hdr, uint32_t *virt_low, uint32_t *virt_high) |
| Extract the starting and ending address of the kernel. More...
|
|
static uint32_t | __get_address_after_modules (multiboot_info_t *header) |
| Returns the first address after the modules. More...
|
|
static void | __relocate_kernel_image (elf_header_t *elf_hdr) |
| Relocate the kernel image. More...
|
|
void | boot_main (uint32_t magic, multiboot_info_t *header, uint32_t esp) |
| Entry point of the bootloader. More...
|
|
Set of functions and variables for booting the kernel.
◆ __align_rdown()
Align memory address to the specified value (round down).
- Parameters
-
addr | the address to align |
value | the value used to align. |
- Returns
- the aligned address.
◆ __align_rup()
Align memory address to the specified value (round up).
- Parameters
-
addr | the address to align |
value | the value used to align. |
- Returns
- the aligned address.
◆ __debug_putchar()
static void __debug_putchar |
( |
char |
c | ) |
|
|
inlinestatic |
Writes the given character on the debug port.
- Parameters
-
c | the character to send to the debug port. |
◆ __debug_puts()
static void __debug_puts |
( |
char * |
s | ) |
|
|
inlinestatic |
Writes the given string on the debug port.
- Parameters
-
s | the string to send to the debug port. |
◆ __get_address_after_modules()
Returns the first address after the modules.
- Parameters
-
header | The multiboot info structure from which we extract the info. |
- Returns
- The address after the modules.
◆ __get_kernel_low_high()
Extract the starting and ending address of the kernel.
- Parameters
-
elf_hdr | The elf header of the kernel. |
virt_low | Output variable where we store the lowest address of the kernel. |
virt_high | Output variable where we store the highest address of the kernel. |
◆ __outportb()
Use this to write to I/O ports to send bytes to devices.
- Parameters
-
port | The output port. |
data | The data to write. |
◆ __relocate_kernel_image()
static void __relocate_kernel_image |
( |
elf_header_t * |
elf_hdr | ) |
|
|
inlinestatic |
Relocate the kernel image.
- Parameters
-
elf_hdr | The elf header of the kernel. |
◆ __setup_pages()
Prepares the page frames.
- Parameters
-
pfn_virt_start | The first virtual page frame. |
pfn_phys_start | The first physical page frame. |
pfn_count | The number of page frames. |
◆ boot_kernel()
External function implemented in boot.S
.
- Parameters
-
stack_pointer | The stack base pointer, usually at the end of the lowmem. |
entry | |
boot_info | |
◆ boot_main()
Entry point of the bootloader.
- Parameters
-
magic | The magic number coming from the multiboot assembly code. |
header | Multiboot header provided by the bootloader. |
esp | The initial stack pointer. |
◆ _bootloader_start
Linker symbols for where the .data section of kernel.bin.o
.
Linker symbol for where the bootloader starts.