MentOS  0.8.0
The Mentoring Operating System
Macros | Functions | Variables
boot.c File Reference

Bootloader. More...

Macros

#define KERNEL_STACK_SIZE   0x100000
 Size of the kernel's stack.
 
#define SERIAL_COM1   (0x03F8)
 Serial port for QEMU.
 

Functions

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...
 

Variables

char _bootloader_start []
 Linker symbols for where the .data section of kernel.bin.o. More...
 
char _bootloader_end []
 Linker symbol for where the bootloader ends.
 
static boot_info_t boot_info
 Boot info provided to the kmain function.
 
static page_directory_t boot_pgdir
 Boot page directory.
 
static page_table_t boot_pgtables [1024]
 Boot page tables.
 

Detailed Description

Bootloader.