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.c75
1 files changed, 38 insertions, 37 deletions
diff --git a/src/kernel/main.c b/src/kernel/main.c
index cbdebfa..0c57ef3 100644
--- a/src/kernel/main.c
+++ b/src/kernel/main.c
@@ -3,55 +3,56 @@
#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 "vga.h"
+#include "log.h"
-__attribute__ ((noreturn)) void main() {
+void tree(struct drive *d);
+
+__attribute__ ((noreturn))
+void main() {
char nbuf[11];
init_mmap();
- init_vesa();
init_serial();
+ init_log();
- vga_blank();
- vga_printsz("Portland v0.0.11\n\n");
+ logsz("Portland v0.0.11\n\n");
//list vesa modes?
pci_init();
u16_dec(n_pci_devices, nbuf);
- vga_printsz(nbuf);
- vga_printsz(" PCI device(s) found:\n");
+ logsz(nbuf);
+ logsz(" PCI device(s) found:\n");
for (uint16_t n = 0; n < n_pci_devices; ++n) {
struct pci_device *pd = nth_pci_device(n);
u16_hex(pd->number, nbuf);
- vga_printsz(" ");
- vga_printsz(nbuf);
- vga_printsz(": ");
+ logsz(" ");
+ logsz(nbuf);
+ logsz(": ");
u16_hex(pd->id_vendor, nbuf);
nbuf[4] = '.';
u16_hex(pd->id_device, nbuf + 5);
- vga_printsz(nbuf);
+ logsz(nbuf);
u8_hex(pd->class, nbuf);
nbuf[2] = '.';
u8_hex(pd->subclass, nbuf + 3);
nbuf[5] = '.';
u8_hex(pd->iface, nbuf + 6);
- vga_printsz(" (");
- vga_printsz(nbuf);
- vga_printsz(")\n");
+ logsz(" (");
+ logsz(nbuf);
+ logsz(")\n");
}
- vga_printch('\n');
+ logch('\n');
init_fat();
//other fs drivers
@@ -60,49 +61,49 @@ __attribute__ ((noreturn)) void main() {
//other drive drivers
u8_dec(n_drives, nbuf);
- vga_printsz(nbuf);
- vga_printsz(" drive(s) found:\n");
+ logsz(nbuf);
+ logsz(" drive(s) found:\n");
for (uint8_t n = 0; n < n_drives; ++n) {
struct drive *d = drives + n;
u8_dec(n, nbuf);
- vga_printsz(" sd");
- vga_printsz(nbuf);
- vga_printsz(" (");
- vga_printsz(d->drive_type);
- vga_printsz(", ");
+ logsz(" sd");
+ logsz(nbuf);
+ logsz(" (");
+ logsz(d->drive_type);
+ logsz(", ");
u32_dec(d->n_sectors / 2, nbuf);
- vga_printsz(nbuf);
+ logsz(nbuf);
if (d->n_sectors % 2)
- vga_printsz(".5");
- vga_printsz("k): ");
+ logsz(".5");
+ logsz("k): ");
- vga_printsz(d->fs_type);
+ logsz(d->fs_type);
uint32_t free_sectors = d->get_free_sectors(d);
if (free_sectors != -1) {
u32_dec(free_sectors / 2, nbuf);
- vga_printsz(", ");
- vga_printsz(nbuf);
+ logsz(", ");
+ logsz(nbuf);
if (free_sectors % 2)
- vga_printsz(".5");
- vga_printsz("k free");
+ logsz(".5");
+ logsz("k free");
}
- vga_printsz(".\n");
+ logsz(".\n");
}
- vga_printch('\n');
+ logch('\n');
u32_dec(pages_left * 4, nbuf);
- vga_printsz(nbuf);
- vga_printsz("k dynamic memory free.\n\n");
+ logsz(nbuf);
+ logsz("k dynamic memory free.\n\n");
- vga_printsz("Loading init process.");
+ logsz("sd0 root:\n");
+ tree(&drives[0]);
- vga_printsz("\n\nTODO: load and switch to init process");
while (1)
asm ("hlt");
} \ No newline at end of file