]> git.corax.cc Git - corax/commitdiff
Don't leave the cr3 variable in pg_init() uninitialized; remove unused braces and...
authorMatthias Kruk <m@m10k.eu>
Tue, 3 Sep 2019 16:02:29 +0000 (01:02 +0900)
committerMatthias Kruk <m@m10k.eu>
Tue, 3 Sep 2019 16:02:29 +0000 (01:02 +0900)
kernel/arch/paging.c

index 91b3ee60af3d77638767c94805659472506b77f8..09ed515592adba349c62e9b76c8f9503c8cac666 100644 (file)
@@ -89,6 +89,7 @@ void* pg_init(struct multiboot_info *info) {
     _mem_start = (u32_t)&_mem_start + sizeof(u32_t);
     mmap = (struct memory_map*)info->mmap_addr;
     mem_size = 0;
+       cr3 = 0;
 
     /* TODO: get rid of this */
     while((u32_t)mmap < (info->mmap_addr + info->mmap_length)) {
@@ -115,13 +116,14 @@ void* pg_init(struct multiboot_info *info) {
     _frame_map = _phys_alloc(_nframes << 2, 4);
 
     switch(_pg_flags & PG_MODE_MASK) {
-        case PG_MODE_LEGACY: {
+        case PG_MODE_LEGACY:
             cr3 = (u32_t)_phys_alloc(sizeof(page_table_t), PAGE_ALIGN);
             break;
-        }
+
         case PG_MODE_PAE:
             cr3 = (u32_t)_phys_alloc(sizeof(pdpt_t), PDPT_ALIGN);
             break;
+
         case PG_MODE_INTEL64:
         case PG_MODE_IA32E:
             PANIC("IA-32e mode paging not yet supported\n");
@@ -131,7 +133,7 @@ void* pg_init(struct multiboot_info *info) {
     while((u32_t)mmap < (info->mmap_addr + info->mmap_length)) {
         u32_t attrs;
         u64_t addr;
-#if 1
+#if 0
         dbg_printf("Region: 0x%016llx - 0x%016llx [%u]\n",
                                   mmap->addr, mmap->addr + mmap->len, mmap->type);
 #endif