From 2ddbeb9f7214f6d3feef651eba83e6a9d120a743 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Thu, 13 Aug 2020 17:58:50 -0400 Subject: lots of progress, including readonly PATA driver and part of FAT16 driver --- src/kernel/main.c | 49 ++++++++++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 27 deletions(-) (limited to 'src/kernel/main.c') 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 -#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'); -- cgit v1.2.3