diff options
Diffstat (limited to 'src/arch/amd64/mboot.c')
-rw-r--r-- | src/arch/amd64/mboot.c | 112 |
1 files changed, 52 insertions, 60 deletions
diff --git a/src/arch/amd64/mboot.c b/src/arch/amd64/mboot.c index b7124df..f39dd79 100644 --- a/src/arch/amd64/mboot.c +++ b/src/arch/amd64/mboot.c @@ -13,81 +13,73 @@ #define MBOOT_OLD_RSDP 14 #define MBOOT_NEW_RSDP 15 -extern char symtab; -#define kaddr(addr) ((uintptr_t)(&addr)) - -typedef uint8_t mboot_uint8_t; -typedef uint16_t mboot_uint16_t; -typedef uint32_t mboot_uint32_t; -typedef uint64_t mboot_uint64_t; - struct mboot_info { - mboot_uint32_t total_size; - mboot_uint32_t reserved; + uint32_t total_size; + uint32_t reserved; char tags[]; }; struct mboot_tag { - mboot_uint32_t type; - mboot_uint32_t size; + uint32_t type; + uint32_t size; char data[]; }; struct mboot_tag_elf_sections { - mboot_uint32_t type; - mboot_uint32_t size; - mboot_uint16_t num; - mboot_uint16_t entsize; - mboot_uint16_t shndx; - mboot_uint16_t reserved; + uint32_t type; + uint32_t size; + uint16_t num; + uint16_t entsize; + uint16_t shndx; + uint16_t reserved; char sections[]; }; struct mboot_tag_elf_sections_entry { - mboot_uint32_t sh_name; - mboot_uint32_t sh_type; - mboot_uint64_t sh_flags; - mboot_uint64_t sh_addr; - mboot_uint64_t sh_offset; - mboot_uint64_t sh_size; - mboot_uint32_t sh_link; - mboot_uint32_t sh_info; - mboot_uint64_t sh_addralign; - mboot_uint64_t sh_entsize; + uint32_t sh_name; + uint32_t sh_type; + uint64_t sh_flags; + uint64_t sh_addr; + uint64_t sh_offset; + uint64_t sh_size; + uint32_t sh_link; + uint32_t sh_info; + uint64_t sh_addralign; + uint64_t sh_entsize; }; struct mboot_mmap_entry { - mboot_uint64_t addr; - mboot_uint64_t len; - mboot_uint32_t type; - mboot_uint32_t zero; + uint64_t addr; + uint64_t len; + uint32_t type; + uint32_t zero; }; struct mboot_tag_mmap { - mboot_uint32_t type; - mboot_uint32_t size; - mboot_uint32_t entry_size; - mboot_uint32_t entry_version; + uint32_t type; + uint32_t size; + uint32_t entry_size; + uint32_t entry_version; struct mboot_mmap_entry entries[]; }; struct mboot_tag_old_rsdp { - mboot_uint32_t type; - mboot_uint32_t size; - mboot_uint8_t rsdp[]; + uint32_t type; + uint32_t size; + uint8_t rsdp[]; }; struct mboot_tag_new_rsdp { - mboot_uint32_t type; - mboot_uint32_t size; - mboot_uint8_t rsdp[]; + uint32_t type; + uint32_t size; + uint8_t rsdp[]; }; struct mboot_tag_cmdline { - mboot_uint32_t type; - mboot_uint32_t size; - mboot_uint8_t cmdline[]; + uint32_t type; + uint32_t size; + uint8_t cmdline[]; }; static void read_symbols( @@ -100,33 +92,33 @@ static void read_symbols( // struct mboot_elf_section_header *section = // (struct mboot_elf_section_header *) (layout->elf_section_headers); // -// for (mboot_uint32_t i = 0; i < layout->num; i++) { +// for (uint32_t i = 0; i < layout->num; i++) { // char buf[20]; // // ultoa(i, buf, 10); // serial_out_str("["); -// serial_out_str(buf); -// serial_out_str("]\t"); +// serial_out_str(buf); +// serial_out_str("]\t"); // // serial_out_str((char *)(kaddr(symtab) + section->sh_name)); // serial_out('\t'); // // ultoa(section->sh_type, buf, 16); // serial_out_str("type: 0x"); -// serial_out_str(buf); -// serial_out('\t'); +// serial_out_str(buf); +// serial_out('\t'); // -// ultoa(section->sh_addr, buf, 16); -// serial_out_str("addr: 0x"); -// serial_out_str(buf); -// serial_out('\t'); +// ultoa(section->sh_addr, buf, 16); +// serial_out_str("addr: 0x"); +// serial_out_str(buf); +// serial_out('\t'); // -// ultoa(section->sh_offset, buf, 16); -// serial_out_str("offset: 0x"); -// serial_out_str(buf); -// serial_out('\n'); +// ultoa(section->sh_offset, buf, 16); +// serial_out_str("offset: 0x"); +// serial_out_str(buf); +// serial_out('\n'); // -// section++; +// section++; // } } @@ -134,7 +126,7 @@ static void read_cmdline( struct boot_info *shim_info, struct mboot_tag_cmdline *cmdline ) { - mboot_uint32_t size = cmdline->size - 8; + uint32_t size = cmdline->size - 8; if (size >= CMDLINE_MAX) size = CMDLINE_MAX; // truncate :( memcpy(shim_info->cmdline, cmdline->cmdline, size); |