summaryrefslogtreecommitdiff
path: root/Source/Kernel
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-10-21 17:32:50 +0200
committerAlexis211 <alexis211@gmail.com>2009-10-21 17:32:50 +0200
commit7708a5f335c6b3256290775e7f5deb43b681bf03 (patch)
tree8ddb55ee633a70ea298a812d5ffec97373631534 /Source/Kernel
parent9836acd720988af30250c2c1ec18d618664dea4e (diff)
downloadMelon-7708a5f335c6b3256290775e7f5deb43b681bf03.tar.gz
Melon-7708a5f335c6b3256290775e7f5deb43b681bf03.zip
More work
Diffstat (limited to 'Source/Kernel')
-rw-r--r--Source/Kernel/Shell/KernelShell-fs.class.cpp3
-rw-r--r--Source/Kernel/Shell/KernelShell.class.cpp3
-rw-r--r--Source/Kernel/SyscallManager/IDT.ns.cpp4
-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
-rw-r--r--Source/Kernel/VTManager/VirtualTerminal.proto.cpp3
7 files changed, 40 insertions, 24 deletions
diff --git a/Source/Kernel/Shell/KernelShell-fs.class.cpp b/Source/Kernel/Shell/KernelShell-fs.class.cpp
index cd52810..a13ae6e 100644
--- a/Source/Kernel/Shell/KernelShell-fs.class.cpp
+++ b/Source/Kernel/Shell/KernelShell-fs.class.cpp
@@ -113,7 +113,8 @@ void KernelShell::run(Vector<String>& args) {
if (p == 0) {
*m_vt << "Error while launching process.\n";
} else {
- p->setVirtualTerminal(m_vt);
+ p->setInVT(m_vt);
+ p->setOutVT(m_vt);
p->start();
while (p->getState() != P_FINISHED) Task::currThread()->sleep(10);
delete p;
diff --git a/Source/Kernel/Shell/KernelShell.class.cpp b/Source/Kernel/Shell/KernelShell.class.cpp
index d90fc4c..232facf 100644
--- a/Source/Kernel/Shell/KernelShell.class.cpp
+++ b/Source/Kernel/Shell/KernelShell.class.cpp
@@ -19,7 +19,8 @@ u32int shellRun(void* ks) {
void KernelShell::setup(DirectoryNode* cwd, VirtualTerminal *vt) {
m_vt = vt;
- Task::currProcess()->setVirtualTerminal(vt);
+ Task::currProcess()->setInVT(vt);
+ Task::currProcess()->setOutVT(vt);
((ScrollableVT*)m_vt)->map(9);
Kbd::setFocus(m_vt);
m_cwd = cwd;
diff --git a/Source/Kernel/SyscallManager/IDT.ns.cpp b/Source/Kernel/SyscallManager/IDT.ns.cpp
index 63b340a..f447e6f 100644
--- a/Source/Kernel/SyscallManager/IDT.ns.cpp
+++ b/Source/Kernel/SyscallManager/IDT.ns.cpp
@@ -80,11 +80,11 @@ extern "C" void interrupt_handler(registers_t regs) {
u8int wat = (regs.eax & 0xFF);
if (res == 0xFFFFFF) {
if (regs.eax == 0xFFFFFF01) {
- Task::currProcess()->getVirtualTerminal()->put(WChar(regs.ebx));
+ Task::currProcess()->getOutVT()->put(WChar(regs.ebx));
} else if (regs.eax == 0xFFFFFF02) {
Task::currThread()->sleep(regs.ebx);
} else if (regs.eax == 0xFFFFFF03) {
- Task::currProcess()->getVirtualTerminal()->writeHex(regs.ebx);
+ Task::currProcess()->getOutVT()->writeHex(regs.ebx);
}
} else {
regs.eax = Res::call(res, wat, regs.ebx, regs.ecx, regs.edx, regs.edi, regs.esi);
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);
}
diff --git a/Source/Kernel/VTManager/VirtualTerminal.proto.cpp b/Source/Kernel/VTManager/VirtualTerminal.proto.cpp
index 9b0b862..2587369 100644
--- a/Source/Kernel/VTManager/VirtualTerminal.proto.cpp
+++ b/Source/Kernel/VTManager/VirtualTerminal.proto.cpp
@@ -19,7 +19,8 @@ call_t VirtualTerminal::m_callTable[] = {
};
u32int VirtualTerminal::scall(u8int wat, u32int a, u32int b, u32int c, u32int d) {
- if (wat == VTIF_SGETPRVT) return Task::currProcess()->getVirtualTerminal()->resId();
+ if (wat == VTIF_SGETPRINVT) return Task::currProcess()->getInVT()->resId();
+ if (wat == VTIF_SGETPROUTVT) return Task::currProcess()->getOutVT()->resId();
return (u32int) - 1;
}