a few more tags, just printing
This commit is contained in:
parent
3353bdaf2b
commit
1f309e75b8
1 changed files with 70 additions and 9 deletions
|
@ -26,7 +26,7 @@ OF THIS SOFTWARE.
|
||||||
enum tag_type {
|
enum tag_type {
|
||||||
BOOT_COMMAND = 0x00000001,
|
BOOT_COMMAND = 0x00000001,
|
||||||
LOADER_NAME = 0x00000002,
|
LOADER_NAME = 0x00000002,
|
||||||
BOOT_MODULES = 0x00000003,
|
BOOT_MODULE = 0x00000003,
|
||||||
MEMORY_INFO = 0x00000004,
|
MEMORY_INFO = 0x00000004,
|
||||||
BOOT_DEVICE = 0x00000005,
|
BOOT_DEVICE = 0x00000005,
|
||||||
MEMORY_MAP = 0x00000006,
|
MEMORY_MAP = 0x00000006,
|
||||||
|
@ -113,9 +113,24 @@ struct fbuf_rgb_info {
|
||||||
uint8_t blue_mask;
|
uint8_t blue_mask;
|
||||||
} __attribute__ ((__packed__));
|
} __attribute__ ((__packed__));
|
||||||
|
|
||||||
|
struct elf_tag {
|
||||||
|
uint16_t count;
|
||||||
|
uint16_t size;
|
||||||
|
uint16_t shndx;
|
||||||
|
uint16_t padding;
|
||||||
|
} __attribute__ ((__packed__));
|
||||||
|
|
||||||
|
struct module_tag {
|
||||||
|
uint32_t start;
|
||||||
|
uint32_t end;
|
||||||
|
uint8_t argument[1];
|
||||||
|
} __attribute__ ((__packed__));
|
||||||
|
|
||||||
struct boot_device_tag boot_device;
|
struct boot_device_tag boot_device;
|
||||||
bool have_boot_device = false;
|
bool have_boot_device = false;
|
||||||
bool have_mmap = false;
|
bool have_mmap = false;
|
||||||
|
uint32_t text_base;
|
||||||
|
bool have_text_base;
|
||||||
|
|
||||||
enum error_codes {
|
enum error_codes {
|
||||||
NO_BOOT_DEVICE = 0x00000000,
|
NO_BOOT_DEVICE = 0x00000000,
|
||||||
|
@ -137,11 +152,29 @@ uint32_t main(void) {
|
||||||
put_32_hex(tag_pointer->size);
|
put_32_hex(tag_pointer->size);
|
||||||
switch (tag_pointer->type) {
|
switch (tag_pointer->type) {
|
||||||
|
|
||||||
|
case BOOT_COMMAND:
|
||||||
|
put_sz(": boot arguments\n ");
|
||||||
|
put_sz(*(uint8_t *)(tag_pointer + 1) ?
|
||||||
|
(uint8_t *)(tag_pointer + 1) : "No arguments");
|
||||||
|
break;
|
||||||
|
|
||||||
case LOADER_NAME:
|
case LOADER_NAME:
|
||||||
put_sz(": bootloader name\n ");
|
put_sz(": bootloader name\n ");
|
||||||
put_sz((uint8_t *)(tag_pointer + 1));
|
put_sz((uint8_t *)(tag_pointer + 1));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case BOOT_MODULE:
|
||||||
|
put_sz(": boot module\n Loaded at: 0x");
|
||||||
|
struct module_tag *module = (struct module_tag *)(tag_pointer + 1);
|
||||||
|
put_32_hex(module->start);
|
||||||
|
put_sz(" - ");
|
||||||
|
put_32_hex(module->end - 1);
|
||||||
|
if (*module->argument) {
|
||||||
|
put_sz("\n Argument: ");
|
||||||
|
put_sz(module->argument);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case MEMORY_INFO:
|
case MEMORY_INFO:
|
||||||
put_sz(": memory size\n Lower memory: 0x");
|
put_sz(": memory size\n Lower memory: 0x");
|
||||||
put_32_hex((tag_pointer + 1)->type);
|
put_32_hex((tag_pointer + 1)->type);
|
||||||
|
@ -273,7 +306,7 @@ uint32_t main(void) {
|
||||||
struct fbuf_tag *fbuf_info = (struct fbuf_tag *)(tag_pointer + 1);
|
struct fbuf_tag *fbuf_info = (struct fbuf_tag *)(tag_pointer + 1);
|
||||||
put_sz(": framebuffer information\n Address: 0x");
|
put_sz(": framebuffer information\n Address: 0x");
|
||||||
put_32_hex(fbuf_info->address_high);
|
put_32_hex(fbuf_info->address_high);
|
||||||
put_char(':');
|
put_char('.');
|
||||||
put_32_hex(fbuf_info->address_low);
|
put_32_hex(fbuf_info->address_low);
|
||||||
put_sz("\n Pitch: ");
|
put_sz("\n Pitch: ");
|
||||||
put_32_dec(fbuf_info->pitch);
|
put_32_dec(fbuf_info->pitch);
|
||||||
|
@ -309,9 +342,23 @@ uint32_t main(void) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case ELF_SYMBOLS: {
|
||||||
|
struct elf_tag *tag = (struct elf_tag *)(tag_pointer + 1);
|
||||||
|
struct elf_shdr *p = (struct elf_shdr *)(tag + 1);
|
||||||
|
put_sz(": ELF shdr table\n shndx: 0x");
|
||||||
|
put_16_hex(tag->shndx);
|
||||||
|
if (tag->count)
|
||||||
|
for (uint32_t i = 0; i < tag->count; ++i) {
|
||||||
|
;//TODO
|
||||||
|
p = (struct elf_shdr *)((uint32_t)p + tag->size);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case IMAGE_BASE_ADDR:
|
case IMAGE_BASE_ADDR:
|
||||||
put_sz(": image address\n 0x");
|
put_sz(": image address\n 0x");
|
||||||
put_32_hex(*(uint32_t *)(tag_pointer + 1));
|
put_32_hex(text_base = *(uint32_t *)(tag_pointer + 1));
|
||||||
|
have_text_base = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -326,12 +373,26 @@ uint32_t main(void) {
|
||||||
if (!have_mmap)
|
if (!have_mmap)
|
||||||
return NO_MMAP;
|
return NO_MMAP;
|
||||||
|
|
||||||
put_sz("\n\nReady!\n Memory map size: 0x");
|
put_sz("\n\nImportant locations:");
|
||||||
put_32_hex(sizeof(struct mmap_entry) * MMAP_SIZE);
|
if (have_text_base) {
|
||||||
put_sz("\n Process table size: 0x");
|
put_sz("\n Text section: 0x");
|
||||||
put_32_hex(sizeof(struct proc_info) * 65536);
|
put_32_hex(text_base);
|
||||||
put_sz("\n File table size: 0x");
|
}
|
||||||
put_32_hex(sizeof(struct file_info) * 65536);
|
put_sz("\n Memory map: 0x");
|
||||||
|
put_32_hex((uint32_t)mmap_bss);
|
||||||
|
put_sz(" - 0x");
|
||||||
|
put_32_hex((uint32_t)mmap_bss - 1 +
|
||||||
|
sizeof(struct mmap_entry) * MMAP_SIZE);
|
||||||
|
put_sz("\n Process table: 0x");
|
||||||
|
put_32_hex((uint32_t)proc_table);
|
||||||
|
put_sz(" - 0x");
|
||||||
|
put_32_hex((uint32_t)proc_table - 1 +
|
||||||
|
sizeof(struct proc_info) * 65536);
|
||||||
|
put_sz("\n File table: 0x");
|
||||||
|
put_32_hex((uint32_t)file_table);
|
||||||
|
put_sz(" - 0x");
|
||||||
|
put_32_hex((uint32_t)file_table - 1 +
|
||||||
|
sizeof(struct file_info) * 65536);
|
||||||
put_sz("\n\n");
|
put_sz("\n\n");
|
||||||
|
|
||||||
put_sz("No file support yet. Halting.");
|
put_sz("No file support yet. Halting.");
|
||||||
|
|
Reference in a new issue