summaryrefslogtreecommitdiff
path: root/Source/Kernel/TaskManager/V86/V86.ns.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Kernel/TaskManager/V86/V86.ns.cpp')
-rw-r--r--Source/Kernel/TaskManager/V86/V86.ns.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/Source/Kernel/TaskManager/V86/V86.ns.cpp b/Source/Kernel/TaskManager/V86/V86.ns.cpp
index 11a1626..bd16e06 100644
--- a/Source/Kernel/TaskManager/V86/V86.ns.cpp
+++ b/Source/Kernel/TaskManager/V86/V86.ns.cpp
@@ -12,18 +12,25 @@ void run(v86_function_t& entry, registers_t &regs, u32int data) {
while (!ret.finished) Task::currThread()->sleep(10);
}
-u16int allocSeg(u16int length) {
+u16int allocSeg(u16int length, Process* p) {
+ if (p == 0) p = Task::currProcess();
if (length & 0xF) length = (length & 0xFFFF0) + 0x10;
u16int segments = length / 16;
if (seg < V86_ALLOC_START) seg = V86_ALLOC_START;
if (seg + segments > V86_ALLOC_END) seg = V86_ALLOC_START;
u16int ret = seg;
seg += segments;
+
+ void* ptr = FP_TO_LINEAR(ret, 0);
+ for (u32int i = (u32int)ptr & 0xFFFFF000; i < (u32int)ptr + length; i += 0x1000) {
+ p->getPagedir()->allocFrame(i, true, true);
+ }
+
return ret;
}
-void* alloc(u32int length) {
- return FP_TO_LINEAR(allocSeg(length), 0);
+void* alloc(u16int length, Process* p) {
+ return FP_TO_LINEAR(allocSeg(length, p), 0);
}
}