Compare commits

...

2 Commits

Author SHA1 Message Date
Quinten Kock 353adb0800 print stivale2 memmap always 2020-12-04 21:43:29 +01:00
Quinten Kock d20c7723bf add support for custom QEMUFLAGS 2020-12-04 21:42:31 +01:00
6 changed files with 25 additions and 2 deletions

View File

@ -17,7 +17,8 @@ run: $(KERNEL_HDD)
-drive file=$(KERNEL_HDD),format=raw \
-smp 2 \
-enable-kvm \
-debugcon stdio
-debugcon stdio \
$(QEMUFLAGS)
bochs: $(KERNEL_HDD) ext/bochsrc
rm -f $(KERNEL_HDD).lock

View File

@ -25,6 +25,7 @@ struct stivale2_header header2 = {
void stivale2_main(struct stivale2_struct *info) {
parse_stivale2(info);
print_stivale2_memmap(info);
char *argv[3] = {"stivale2", info->bootloader_brand, info->bootloader_version};
kmain(3, argv);

View File

@ -153,3 +153,22 @@ void parse_stivale2(struct stivale2_struct *info) {
}
putchar('\n');
}
void print_stivale2_memmap(struct stivale2_struct *info) {
struct stivale2_tag *tag = (struct stivale2_tag*)(info->tags);
while(tag != 0) {
switch(tag->identifier) {
case STIVALE2_STRUCT_TAG_MEMMAP_ID: {
struct stivale2_struct_tag_memmap *m = (struct stivale2_struct_tag_memmap *)tag;
printf("Memmap (%d entries):\n", m->entries);
for (size_t i = 0; i < m->entries; i++) {
struct stivale2_mmap_entry me = m->memmap[i];
printf("\t[%x+%h] %x\n", (size_t)me.base, (size_t)me.length, me.type);
}
break;
}
}
tag = (struct stivale2_tag *)tag->next;
}
}

View File

@ -1,2 +1,3 @@
void print_stivale2(struct stivale2_struct *info);
void parse_stivale2(struct stivale2_struct *info);
void print_stivale2_memmap(struct stivale2_struct *info);

View File

@ -26,6 +26,7 @@ struct stivale2_header header2 = {
void stivale2_main(struct stivale2_struct *info) {
parse_stivale2(info);
print_stivale2_memmap(info);
char *argv[3] = {"stivale2", info->bootloader_brand, info->bootloader_version};
kmain(3, argv);

View File

@ -59,7 +59,7 @@ static void printdec(size_t num) {
static void printhuman(size_t num) {
const char *unit = UNITS;
while(num >= 2048 && *(unit+1)) {
while(num >= 10240 && *(unit+1)) {
num /= 1024;
unit++;
}