forked from PoliEcho-holding-org/kern
Minor changes
This commit is contained in:
@@ -98,7 +98,7 @@ extern uint32_t __kernel_stack_top, __kernel_stack_bottom;
|
||||
#define pr_wrn(_s) printk("[warning] %s\n", (_s))
|
||||
#define pr_err(_s) printk("[error] %s\n", (_s))
|
||||
#define panic(_s) do {\
|
||||
printk("[panic] %s\n", (_s));\
|
||||
printk("[kernel] Panic! %s\n", (_s));\
|
||||
while (1) __asm__ volatile ("cli; hlt");\
|
||||
} while (0)
|
||||
#define BUG() panic("BUG()")
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@ ENTRY(_start)
|
||||
/* Define sections */
|
||||
SECTIONS {
|
||||
. = 0x00100000;
|
||||
kernel_start = .;
|
||||
__kernel_start = .;
|
||||
|
||||
.boot ALIGN(4K) : {
|
||||
*(.multiboot)
|
||||
@@ -31,5 +31,5 @@ SECTIONS {
|
||||
*(.bss)
|
||||
}
|
||||
|
||||
kernel_end = .;
|
||||
__kernel_end = .;
|
||||
}
|
||||
|
||||
+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