8#include <sys/kassert.h>
11#include "../dev/console.h"
13#include <machine/amd64.h>
14#include <machine/pmap.h>
15#include <machine/multiboot.h>
19#define CHECK_FLAG(flag, bit) ((flag) & (1 << (bit)))
21#define PAGE_ALIGN __attribute__((aligned(PGSIZE)))
22#define DATA_SECTION __attribute__((section(".data")))
55 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
56 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
57 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
58 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
59 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
60 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
61 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
62 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
63 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
65 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
66 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
67 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
68 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
69 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
70 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
90 kprintf(
"Invalid magic number: 0x%x\n", magic);
99 kprintf(
"mem_lower = %uKB, mem_upper = %uKB\n",
116 kprintf(
"mods_count = %d, mods_addr = 0x%x\n",
121 kprintf(
" mod_start = 0x%x, mod_end = 0x%x, cmdline = %s\n",
130 kprintf(
"Both bits 4 and 5 are set.\n");
139 kprintf(
"multiboot_aout_symbol_table: tabsize = 0x%0x\n"
140 " strsize = 0x%x, addr = 0x%x\n",
141 (
unsigned) multiboot_aout_sym->
tabsize,
142 (
unsigned) multiboot_aout_sym->
strsize,
143 (
unsigned) multiboot_aout_sym->
addr);
151 kprintf(
"multiboot_elf_sec: num = %u, size = 0x%x,"
152 " addr = 0x%x, shndx = 0x%x\n",
153 (
unsigned) multiboot_elf_sec->
num, (
unsigned) multiboot_elf_sec->
size,
154 (
unsigned) multiboot_elf_sec->
addr, (
unsigned) multiboot_elf_sec->
shndx);
164 kprintf(
"mmap_addr = 0x%x, mmap_length = 0x%x\n",
167 (
unsigned long) mmap < mbi->mmap_addr + mbi->
mmap_length;
169 +
mmap->size + sizeof (
mmap->size)))
171 kprintf(
" size = 0x%x, base_addr = 0x%llx,"
172 " length = 0x%llx, type = 0x%x\n",
173 (
unsigned)
mmap->size,
176 (
unsigned)
mmap->type);
202 if (start +
len < initRamEnd)
205 if (start < initRamEnd) {
206 len = initRamEnd - start;
210 kprintf(
"AddRegion: %08llx %08llx\n", start,
len);
PageEntry entries[PAGETABLE_ENTRIES]
int kprintf(const char *fmt,...)
PAGE_ALIGN DATA_SECTION PageTable bootpgtbl1
PAGE_ALIGN DATA_SECTION PageTable bootpgtbl3
void MachineBoot_Entry(unsigned long magic, unsigned long addr)
#define CHECK_FLAG(flag, bit)
PAGE_ALIGN DATA_SECTION PageTable bootpgtbl2
static uintptr_t memRegionLen[MAX_REGIONS]
static uintptr_t memRegionStart[MAX_REGIONS]
void MachineBoot_AddMem()
void PAlloc_AddRegion(uintptr_t start, uintptr_t len)
void * mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset)
union multiboot_info::@0 u
#define MULTIBOOT_MEMORY_AVAILABLE
#define MULTIBOOT_BOOTLOADER_MAGIC
#define MEM_DIRECTMAP_BASE