mov eax , cr0
or eax , 0x01
mov cr0 , eax



back to months list

Project : The "Microkernel" Operating System

Journal Entry Date : 2025.11.10

Today I revised the kernel's flimsy configuration system. I fixed some apparent bugs in the configurator, and I added some configuration variables that'll help customize the layout of kernel memory. The newly added variables are kernel's minimum start address and kernel's higher-half address. Other than this, now kernel's configuration file is two: one for architecture-independent variables like whether to use paging or not, and the other that's inside the architecture folder, for, obviously, arch-dependent variables.

Aside from the configurations, I started working on the actual higher-half kernel stuffs, like page table manipulation and such. So, for that purpose, the page allocation system that I developed in the Janauary of this year(wow..) is now in file page_allocator.cpp, not page_manager.cpp, since we're going to need this file name for actually "managing" the page tables.

The "PageTableData" struct

For managing the page table, I made a struct called "PageTableData". The implementation of this structure will be done in the architecture-dependent side of the code. This structure is going to be used for storing whatever data that is necessary to manipulate the page table. Hence why the method of creating the page table will also be hundred-percent architecture-dependent. Like this :

/* In kernel/include/pages_manager.hpp : */

namespace page {
    void ARCHDEP set_page_table(PageTableData &page_table_data , max_t linear_addr , max_t page_size , max_t physical_address , max_t flags);
    void ARCHDEP register_page_table(PageTableData &page_table_data);
};

/* In arch/x86_64/include/page_table.hpp : */

struct PageTableData ARCHDEP {
    uint64_t pml4t_base_addr;
    uint64_t pdpt_base_addr;
    uint64_t pde_base_addr;
    uint64_t pe_base_addr;
    
    bool is_pml5_enabled;
    ...
};

/* In arch/x86_64/src/page_table.cpp : */

void page::set_page_table(/* same arguments */) {
    /* architecture-dependent implementation of the function */
}