p34: Add page table cloning and ELF loading utilities#353
Open
s-p-1 wants to merge 3 commits intocodenet:p31-umallocfrom
Open
p34: Add page table cloning and ELF loading utilities#353s-p-1 wants to merge 3 commits intocodenet:p31-umallocfrom
s-p-1 wants to merge 3 commits intocodenet:p31-umallocfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
This branch completes the core
vm.cutility suite by addingcopyuvm,loaduvm, andclearpteu. These functions provide the necessary logic for process duplication (fork) and binary loading (exec) once the OS transitions to a full paging model.Changes Made
vm.c: Addedcopyuvmfor deep-copying page directories and physical memory,loaduvmfor reading ELF segments from disk into mapped pages, andclearpteufor stack protection.vm.c(Bug Fix): Updated the bounds check inallocuvmto usePHYSTOPinstead ofKERNBASE. In the current segmentation variant whereKERNBASE=0, the original xv6 check would erroneously reject all memory allocation.defs.h: Added the respective prototypes for the new functions.Integration Note: The Address 0 Collision
During development, a "Shadow Paging" integration was tested by wiring these functions into
proc.c. However, because the kernel currently maps I/O space at virtual address 0 (kmap[0]) and the userinitcodealso targets address 0, a "remap" panic occurs.To maintain a stable, bootable kernel, these functions are currently included as structural scaffolding. They maintain strict parity with
xv6-publicand are ready to be utilized as soon as a subsequent branch shifts the kernel to the high-half (0x80000000), resolving the address collision.