diff options
author | Alexis211 <alexis211@gmail.com> | 2009-10-23 08:13:50 +0200 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2009-10-23 08:13:50 +0200 |
commit | df179c18baab4b5d85a283924fb23dfee7ea7fdb (patch) | |
tree | 626168e219b883a4a13f3b7ab512ece91ebdc3c4 /Source/Kernel | |
parent | 6a8a4b7e9affb35851a8f5c27a81c707a3090954 (diff) | |
parent | 5e5b36b281d951433d8db71ae898a9dc3272384a (diff) | |
download | Melon-df179c18baab4b5d85a283924fb23dfee7ea7fdb.tar.gz Melon-df179c18baab4b5d85a283924fb23dfee7ea7fdb.zip |
Merge branch 'master' into usermgmt
Diffstat (limited to 'Source/Kernel')
-rw-r--r-- | Source/Kernel/SyscallManager/IDT.ns.h | 1 | ||||
-rw-r--r-- | Source/Kernel/SyscallManager/IDT.wtf.asm | 6 | ||||
-rw-r--r-- | Source/Kernel/TaskManager/Task.ns.cpp | 6 | ||||
-rw-r--r-- | Source/Kernel/TaskManager/Thread.class.cpp | 1 |
4 files changed, 10 insertions, 4 deletions
diff --git a/Source/Kernel/SyscallManager/IDT.ns.h b/Source/Kernel/SyscallManager/IDT.ns.h index e73a885..ea8372a 100644 --- a/Source/Kernel/SyscallManager/IDT.ns.h +++ b/Source/Kernel/SyscallManager/IDT.ns.h @@ -4,6 +4,7 @@ #include <common.h> struct registers_t { + u32int cr3; //Page directory u32int ds; // Data segment selector u32int edi, esi, ebp, esp, ebx, edx, ecx, eax; // Pushed by pusha. u32int int_no, err_code; // Interrupt number and error code (if applicable) diff --git a/Source/Kernel/SyscallManager/IDT.wtf.asm b/Source/Kernel/SyscallManager/IDT.wtf.asm index b94612e..630b2fb 100644 --- a/Source/Kernel/SyscallManager/IDT.wtf.asm +++ b/Source/Kernel/SyscallManager/IDT.wtf.asm @@ -116,8 +116,14 @@ interrupt_common_stub: mov fs, ax mov gs, ax + mov eax, cr3 + push eax + call interrupt_handler + pop eax + mov cr3, eax + pop eax ; reload the original data segment descriptor mov ds, ax mov es, ax diff --git a/Source/Kernel/TaskManager/Task.ns.cpp b/Source/Kernel/TaskManager/Task.ns.cpp index aef07f3..75f9c3d 100644 --- a/Source/Kernel/TaskManager/Task.ns.cpp +++ b/Source/Kernel/TaskManager/Task.ns.cpp @@ -70,7 +70,7 @@ SimpleList<Thread*> *nextThread() { void doSwitch() { if (currentThread == NULL or currentProcess == NULL) return; - u32int esp, ebp, eip, cr3; + u32int esp, ebp, eip; asm volatile("mov %%esp, %0" : "=r"(esp)); asm volatile("mov %%ebp, %0" : "=r"(ebp)); @@ -91,7 +91,6 @@ void doSwitch() { esp = t->getEsp(); ebp = t->getEbp(); eip = t->getEip(); - cr3 = currentProcess->getPagedir()->physicalAddr; asm volatile("cli"); @@ -101,10 +100,9 @@ void doSwitch() { mov %0, %%ebp; \ mov %1, %%esp; \ mov %2, %%ecx; \ - mov %3, %%cr3; \ mov $0x12345, %%eax; \ jmp *%%ecx;" - : : "r"(ebp), "r"(esp), "r"(eip), "r"(cr3)); + : : "r"(ebp), "r"(esp), "r"(eip)); } void triggerSwitch() { diff --git a/Source/Kernel/TaskManager/Thread.class.cpp b/Source/Kernel/TaskManager/Thread.class.cpp index 419a954..a9c53ed 100644 --- a/Source/Kernel/TaskManager/Thread.class.cpp +++ b/Source/Kernel/TaskManager/Thread.class.cpp @@ -18,6 +18,7 @@ u32int Thread::scall(u8int wat, u32int a, u32int b, u32int c, u32int d) { } void runThread(Thread* thread, void* data, thread_entry_t entry_point) { + thread->m_process->getPagedir()->switchTo(); if (thread->m_isKernel) { asm volatile("sti"); u32int ret = entry_point(data); //Run ! |