{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreibamwpoy7ehdiskunjxizvvmchiingger5k6g62zmhadcyfscb32q",
"uri": "at://did:plc:ndtvnkebzmsduapq2rqlsru4/app.bsky.feed.post/3mb7wiwo7eih2"
},
"path": "/syndications/kl-os-2025-12-30/",
"publishedAt": "2025-12-30T00:00:00.000Z",
"site": "https://scientiac.space",
"tags": [
"https://scientiac.space/syndications/kl-os-2025-12-30/POSSE",
"Day 9"
],
"textContent": "Day 9 was about memory management and virtual addressing.\n\nThe structure of the virtual address is defined by the RISC-V paging mechanism called `Sv32`. It uses a two level page table where the 32 bit virtual address is divided into a first-level page table index, a second level and a page offset. The tables are named `VPN[1]` and `VPN[0]` respectively.\n\nFirst the macros for the construction of the page table are defined. Then the function to map pages `map_page` is made which is utilized in process creation. For that we also add an element called `page_table` on the `struct` of process. And to make everything work we define the starting address of the kernel space `__kernel__base` in the linker script just after boot.\n\nTo utilize the above setup of page tables and switch them, we specify the first-level page table in `satp` (Supervisor Address Translation and Protection) register.\n\nI still need to understand more about this. I am not satisfied with the explanation from the resource.",
"title": "KL-OS: Page Table",
"updatedAt": "2026-04-22T08:40:47.378Z"
}