diff options
author | Benji Dial <Benji3.141@gmail.com> | 2020-08-13 17:58:50 -0400 |
---|---|---|
committer | Benji Dial <Benji3.141@gmail.com> | 2020-08-13 17:58:50 -0400 |
commit | 2ddbeb9f7214f6d3feef651eba83e6a9d120a743 (patch) | |
tree | 10a2aef195e0f40b0e44ffac82dcf60e426c4385 /src/kernel/main.c | |
parent | 63167f223e1f54910f6b80e698390ee60aec79ee (diff) | |
download | portland-os-2ddbeb9f7214f6d3feef651eba83e6a9d120a743.tar.gz |
lots of progress, including readonly PATA driver and part of FAT16 driver
Diffstat (limited to 'src/kernel/main.c')
-rw-r--r-- | src/kernel/main.c | 49 |
1 files changed, 22 insertions, 27 deletions
diff --git a/src/kernel/main.c b/src/kernel/main.c index e5c0013..cbdebfa 100644 --- a/src/kernel/main.c +++ b/src/kernel/main.c @@ -1,30 +1,20 @@ #include <stdint.h> -#include "vga.h" -#include "fat.h" -#include "ide.h" -#include "panic.h" #include "serial.h" +#include "panic.h" +#include "boot.h" #include "util.h" +#include "vesa.h" +#include "fat.h" +#include "ide.h" #include "mem.h" #include "pci.h" -#include "boot.h" -#include "vesa.h" - -char nbuf[11]; - -#define SOTL(field) field = (void *)((*((uint16_t *)(&field) + 1) << 16) + *(uint16_t *)(&field)); +#include "vga.h" __attribute__ ((noreturn)) void main() { - SOTL(VESA_INFO->oem) - SOTL(VESA_INFO->modes) - SOTL(VESA_INFO->vendor) - SOTL(VESA_INFO->pname) - SOTL(VESA_INFO->prev) + char nbuf[11]; init_mmap(); - init_vesa(); - init_serial(); vga_blank(); @@ -64,8 +54,10 @@ __attribute__ ((noreturn)) void main() { vga_printch('\n'); init_fat(); + //other fs drivers init_ide(); + //other drive drivers u8_dec(n_drives, nbuf); vga_printsz(nbuf); @@ -79,24 +71,27 @@ __attribute__ ((noreturn)) void main() { vga_printsz(nbuf); vga_printsz(" ("); vga_printsz(d->drive_type); - vga_printsz("): "); - - vga_printsz(d->fs_type); vga_printsz(", "); u32_dec(d->n_sectors / 2, nbuf); vga_printsz(nbuf); if (d->n_sectors % 2) vga_printsz(".5"); - vga_printsz("k, "); + vga_printsz("k): "); - uint32_t free_sectors = d->get_free_sectors(d); + vga_printsz(d->fs_type); - u32_dec(free_sectors / 2, nbuf); - vga_printsz(nbuf); - if (d->n_sectors % 2) - vga_printsz(".5"); - vga_printsz("k free.\n"); + uint32_t free_sectors = d->get_free_sectors(d); + if (free_sectors != -1) { + u32_dec(free_sectors / 2, nbuf); + vga_printsz(", "); + vga_printsz(nbuf); + if (free_sectors % 2) + vga_printsz(".5"); + vga_printsz("k free"); + } + + vga_printsz(".\n"); } vga_printch('\n'); |