Skip to content

p33: Add user-space virtual memory lifecycle utilities#352

Open
s-p-1 wants to merge 2 commits intocodenet:p31-umallocfrom
s-p-1:p33-uvm-alloc
Open

p33: Add user-space virtual memory lifecycle utilities#352
s-p-1 wants to merge 2 commits intocodenet:p31-umallocfrom
s-p-1:p33-uvm-alloc

Conversation

@s-p-1
Copy link
Copy Markdown
Contributor

@s-p-1 s-p-1 commented Apr 22, 2026

Objective

This branch introduces the fundamental user-space page table lifecycle utilities (inituvm, allocuvm, deallocuvm, and freevm) in strict parity with xv6-public. It also adds the pgdir pointer to struct proc.

Changes Made

  • proc.h: Added pde_t* pgdir; to struct proc (currently unused in runtime, added for structural parity).
  • mmu.h: Added PGADDR macro required by deallocuvm.
  • vm.c: Appended the four user-space memory functions. Replaced the temporary kfree in setupkvm's error path with the now-available freevm.
  • defs.h: Added respective function prototypes.

Architectural Note: KERNBASE

In this branch, these functions act purely as structural scaffolding and are not yet executed. Because the OS has not yet migrated to a high-half kernel memory model, KERNBASE evaluates to 0. Consequently, the bounds check if(newsz >= KERNBASE) in allocuvm will currently reject any memory growth. These functions will become runtime-active once paging is fully enabled and KERNBASE is shifted to 0x80000000 in a subsequent branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant