Permalink
Browse files

zero newly minted segment roots

  • Loading branch information...
1 parent aa89aa9 commit 28fb4cbb8df7203e65d16505b533e5f8c5fba287 @wolfwood wolfwood committed Aug 14, 2011
Showing with 27 additions and 0 deletions.
  1. +27 −0 kernel/arch/x86_64/core/paging.d
@@ -282,6 +282,8 @@ static:
addrFrag = cast(ulong)vAddr;
root.walk!(mapSegmentHelper)(addrFrag, flags, success, segmentParent, newRootPhysAddr);
+ root.walk!(zeroPageTableHelper)(addrFrag, segmentParent);
+
getNextIndex(addrFrag, idx);
getNextIndex(addrFrag, idx);
@@ -406,6 +408,8 @@ public:
T* segmentParent;
root.walk!(mapSegmentHelper)(vAddr, flags, success, segmentParent, phys);
+ root.walk!(zeroPageTableHelper)(vAddr, segmentParent);
+
static if(T.level != 1){
// 'map' the segment into the Global Space
if(success && global){
@@ -447,6 +451,29 @@ public:
}
}
+ bool zeroPageTableHelper(U, T)(T table, uint idx, ref U segmentParent){
+ static if(is(T == U)){
+ static if(U.level > 1){
+ auto zeroTarget = table.getTable(idx);
+
+ if(zeroTarget !is null)
+ *zeroTarget = typeof(*zeroTarget).init;
+ }else{
+ // only matters if we allow 4k segment
+ }
+
+ return false;
+ }else{
+ static if(T.level != 1){
+ auto intermediate = table.getOrCreateTable(idx, true);
+
+ if(intermediate is null)
+ return false;
+ }
+ return true;
+ }
+ }
+
// XXX support multiple sizes
bool closeGib(ubyte* location) {
return true;

0 comments on commit 28fb4cb

Please sign in to comment.