mirror of
https://github.com/Tom-on64/kern.git
synced 2026-11-03 18:22:22 +00:00
Minor changes
This commit is contained in:
+5
-4
@@ -16,9 +16,6 @@ void kmain(void* ptr, uint32_t magic) {
|
||||
if (serial_init(COM1) != 0) panic("Failed to initialize Serial driver.");
|
||||
debugf("\x1b[H\x1b[J\x1b[0mkern. \x1b[36m(serial console)\x1b[0m\n\n");
|
||||
|
||||
// VGA tty thingy
|
||||
if (tty_init() != 0) panic("Failed to initalize TTY driver.");
|
||||
tty_puts("kern.\n\n");
|
||||
|
||||
// System init
|
||||
if (gdt_init() != 0) panic("Failed to initalize GDT.");
|
||||
@@ -29,7 +26,11 @@ void kmain(void* ptr, uint32_t magic) {
|
||||
if (pmm_init() != 0) panic("Failed to initalize Physical Memory Manager.");
|
||||
if (vmm_init() != 0) panic("Failed to initalize Virtual Memory Manager.");
|
||||
|
||||
debugf("Basic initialization complete!\n");
|
||||
// VGA TTY
|
||||
if (tty_init() != 0) panic("Failed to initalize TTY driver.");
|
||||
tty_puts("kern.\n\n");
|
||||
|
||||
debugf("[kernel] Basic initialization complete!\n");
|
||||
|
||||
panic("kmain() reached end.");
|
||||
}
|
||||
|
||||
@@ -65,6 +65,7 @@ int pmm_init(void) {
|
||||
|
||||
bmap_setarea(&pmm_bitmap, bitmapStartPhys, pmm_bitmap.bytes, 1);
|
||||
bmap_setarea(&pmm_bitmap, pageFrameStart, ptcount * PAGE_SIZE, 1);
|
||||
|
||||
bmap_set(&pmm_bitmap, 0, 1); // Reserve block 0 - NULL page
|
||||
|
||||
// Beatifull print statement :)
|
||||
|
||||
@@ -16,13 +16,10 @@ int vmm_init(void) {
|
||||
vmm_bitmap.bytes = dceil(vmm_bitmap.blocks, 8);
|
||||
uint32_t bitmaploc = 0xC6000000;
|
||||
|
||||
debugf("%d blocks in %d bytes\n", vmm_bitmap.blocks, vmm_bitmap.bytes);
|
||||
size_t pagecount = dceil(vmm_bitmap.bytes, PAGE_SIZE);
|
||||
for (size_t i = 0; i < pagecount; i++) {
|
||||
void* fr = pmm_allocPage();
|
||||
debugf("Allocating page %d/%d...\n", i+1, pagecount);
|
||||
if (fr == NULL) return 1;
|
||||
debugf("Mapping page at 0x%08x to 0x%08x\n", fr, bitmaploc + i * PAGE_SIZE);
|
||||
pag_mapPage(bitmaploc + i * PAGE_SIZE, (uint32_t)fr, 0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user