summaryrefslogtreecommitdiff
path: root/Source/Kernel/TaskManager
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Kernel/TaskManager')
-rw-r--r--Source/Kernel/TaskManager/Process.class.cpp21
-rw-r--r--Source/Kernel/TaskManager/Process.class.h8
-rw-r--r--Source/Kernel/TaskManager/Thread.class.cpp22
3 files changed, 32 insertions, 19 deletions
diff --git a/Source/Kernel/TaskManager/Process.class.cpp b/Source/Kernel/TaskManager/Process.class.cpp
index a2bbfb4..5256b48 100644
--- a/Source/Kernel/TaskManager/Process.class.cpp
+++ b/Source/Kernel/TaskManager/Process.class.cpp
@@ -33,7 +33,7 @@ Process* Process::createKernel(String cmdline, VirtualTerminal *vt) {
p->m_pagedir = kernelPageDirectory;
p->m_uid = 0;
p->m_userHeap = &Mem::kheap;
- p->m_vt = vt;
+ p->m_inVT = p->m_outVT = vt;
Thread* t = new Thread();
t->m_process = p;
@@ -72,7 +72,8 @@ Process::Process(String cmdline, u32int uid) : Ressource(PRIF_OBJTYPE, m_callTab
m_retval = 0;
m_state = P_STARTING;
m_uid = uid;
- m_vt = Task::currProcess()->getVirtualTerminal();
+ m_inVT = Task::currProcess()->getInVT();
+ m_outVT = Task::currProcess()->getOutVT();
m_fileDescriptors = 0;
//Create page directory and user heap
m_pagedir = new PageDirectory(kernelPageDirectory);
@@ -139,12 +140,20 @@ PageDirectory* Process::getPagedir() {
return m_pagedir;
}
-VirtualTerminal* Process::getVirtualTerminal() {
- return m_vt;
+VirtualTerminal* Process::getInVT() {
+ return m_inVT;
}
-void Process::setVirtualTerminal(VirtualTerminal* vt) {
- m_vt = vt;
+VirtualTerminal* Process::getOutVT() {
+ return m_outVT;
+}
+
+void Process::setInVT(VirtualTerminal* vt) {
+ m_inVT = vt;
+}
+
+void Process::setOutVT(VirtualTerminal* vt) {
+ m_outVT = vt;
}
u32int Process::exitSC() {
diff --git a/Source/Kernel/TaskManager/Process.class.h b/Source/Kernel/TaskManager/Process.class.h
index 89efd0c..eda5fc6 100644
--- a/Source/Kernel/TaskManager/Process.class.h
+++ b/Source/Kernel/TaskManager/Process.class.h
@@ -40,7 +40,7 @@ class Process : public Ressource {
u8int m_state; //Is one of P_* defined above
PageDirectory* m_pagedir;
u32int m_uid; //User ID
- VirtualTerminal *m_vt;
+ VirtualTerminal *m_inVT, *m_outVT;
Heap *m_userHeap;
@@ -72,8 +72,10 @@ class Process : public Ressource {
PageDirectory* getPagedir();
- VirtualTerminal* getVirtualTerminal();
- void setVirtualTerminal(VirtualTerminal* vt);
+ VirtualTerminal* getInVT();
+ VirtualTerminal* getOutVT();
+ void setInVT(VirtualTerminal* vt);
+ void setOutVT(VirtualTerminal* vt);
u32int getState() { return m_state; }
u32int freePageSC(u32int);
};
diff --git a/Source/Kernel/TaskManager/Thread.class.cpp b/Source/Kernel/TaskManager/Thread.class.cpp
index 21ef954..419a954 100644
--- a/Source/Kernel/TaskManager/Thread.class.cpp
+++ b/Source/Kernel/TaskManager/Thread.class.cpp
@@ -152,7 +152,9 @@ void Thread::handleException(registers_t regs, int no) {
"", "", "",
"", ""};
- *(m_process->m_vt) << "\nUnhandled exception " << (s32int)no << " at " << (u32int)regs.cs << ":" <<
+ VirtualTerminal &vt = *(m_process->m_outVT);
+
+ vt << "\nUnhandled exception " << (s32int)no << " at " << (u32int)regs.cs << ":" <<
(u32int)regs.eip << "\n:: " << exceptions[no];
if (m_isKernel) PANIC_DUMP("Exception in kernel thread", &regs);
@@ -163,18 +165,18 @@ void Thread::handleException(registers_t regs, int no) {
int rsvd = regs.err_code & 0x8;
u32int faddr;
asm volatile("mov %%cr2, %0" : "=r"(faddr));
- *(m_process->m_vt) << "\n ";
- if (present) *(m_process->m_vt) << "Present ";
- if (rw) *(m_process->m_vt) << "R/W ";
- if (us) *(m_process->m_vt) << "User ";
- if (rsvd) *(m_process->m_vt) << "Rsvd ";
- *(m_process->m_vt) << "At:" << (u32int)faddr;
-
- *(m_process->m_vt) << "\nThread finishing.\n";
+ vt << "\n ";
+ if (present) vt << "Present ";
+ if (rw) vt << "R/W ";
+ if (us) vt << "User ";
+ if (rsvd) vt << "Rsvd ";
+ vt << "At:" << (u32int)faddr;
+
+ vt << "\nThread finishing.\n";
Task::currentThreadExits(E_PAGEFAULT); //Calling this will setup a new stack
return;
}
- *(m_process->m_vt) << "\nThread finishing.\n";
+ vt << "\nThread finishing.\n";
Task::currentThreadExits(E_UNHANDLED_EXCEPTION);
}