summaryrefslogtreecommitdiff
path: root/src/kernel/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/main.c')
-rw-r--r--src/kernel/main.c49
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');