Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

switch stack sizes with a single parameter

  • Loading branch information...
commit b101284a41b5cfc86255dd589a8fb6ffb3b96d2d 1 parent 49d4c3d
@wolfwood wolfwood authored
Showing with 10 additions and 6 deletions.
  1. +2 −2 libos/libdeepmajik/threadscheduler.d
  2. +8 −4 libos/libdeepmajik/umm.d
View
4 libos/libdeepmajik/threadscheduler.d
@@ -248,7 +248,7 @@ align(1) struct XombThread {
}
// WARNING: deep magic will fail silently if there is no thread
- // Based on the assumption of a 4kstack and that the thread struct is at the top of the stack
+ // Based on the assumption of a fixed-size stack and that the thread struct is at the top of the stack
XombThread* getCurrentThread(){
XombThread* thread;
@@ -256,7 +256,7 @@ align(1) struct XombThread {
mov thread,RSP;
}
- thread = cast(XombThread*)( (cast(ulong)thread & ~0xFFFUL) | (4096 - XombThread.sizeof) );
+ thread = cast(XombThread*)( (cast(ulong)thread & ~(UserspaceMemoryManager.stackSize-1)) | (UserspaceMemoryManager.stackSize - XombThread.sizeof) );
return thread;
}
View
12 libos/libdeepmajik/umm.d
@@ -5,19 +5,23 @@ import Syscall = user.syscall;
import user.environment;
import user.types;
+
class UserspaceMemoryManager{
static:
- const uint pageSize = 4096;
+
+ const ulong stackSize = twoMB;
synchronized void initialize(){
}
synchronized ubyte* getPage(bool spacer = false){
- ubyte[] stacks = Syscall.create(findFreeSegment(false, oneGB/512), AccessMode.User|AccessMode.Writable|AccessMode.AllocOnAccess);
- if(stacks.length < pageSize){return null;}
+ ubyte[] stacks = Syscall.create(findFreeSegment(false, UserspaceMemoryManager.stackSize), AccessMode.User|AccessMode.Writable|AccessMode.AllocOnAccess);
+
+ if(stacks.length < UserspaceMemoryManager.stackSize){return null;}
+
+ Syscall.create(stacks[0..fourKB], AccessMode.Read);
- Syscall.create(stacks[0..4096], AccessMode.Tombstone);
return &stacks[$];
}
Please sign in to comment.
Something went wrong with that request. Please try again.