summaryrefslogtreecommitdiff
path: root/Source/Kernel
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Kernel')
-rw-r--r--Source/Kernel/Library/SimpleList.class.h11
-rwxr-xr-xSource/Kernel/Melon.kebin574720 -> 609187 bytes
-rw-r--r--Source/Kernel/Shell/KernelShell.class.cpp12
-rw-r--r--Source/Kernel/Shell/KernelShell.class.h3
-rw-r--r--Source/Kernel/TaskManager/Task.ns.cpp24
5 files changed, 27 insertions, 23 deletions
diff --git a/Source/Kernel/Library/SimpleList.class.h b/Source/Kernel/Library/SimpleList.class.h
index 770128e..64e37aa 100644
--- a/Source/Kernel/Library/SimpleList.class.h
+++ b/Source/Kernel/Library/SimpleList.class.h
@@ -45,6 +45,17 @@ class SimpleList {
Mem::kfree(temp);
}
+ SimpleList<T>* removeOnce(const T& value) {
+ if (value == m_value) return delThis();
+ for (SimpleList<T> *iter = this; iter->next() != 0; iter = iter->next()) {
+ if (iter->next()->v() == value) {
+ iter->delNext();
+ break;
+ }
+ }
+ return this;
+ }
+
bool isEnd() {
return m_next == 0;
}
diff --git a/Source/Kernel/Melon.ke b/Source/Kernel/Melon.ke
index f259ad0..61c87df 100755
--- a/Source/Kernel/Melon.ke
+++ b/Source/Kernel/Melon.ke
Binary files differ
diff --git a/Source/Kernel/Shell/KernelShell.class.cpp b/Source/Kernel/Shell/KernelShell.class.cpp
index 3d76ee0..4232cd9 100644
--- a/Source/Kernel/Shell/KernelShell.class.cpp
+++ b/Source/Kernel/Shell/KernelShell.class.cpp
@@ -15,8 +15,8 @@ u32int shellRun(void* ks) {
return ret;
}
-KernelShell::KernelShell(DirectoryNode* cwd) {
- m_vt = new ScrollableVT(15, 76, 200, SHELL_FGCOLOR, SHELL_BGCOLOR);
+void KernelShell::setup(DirectoryNode* cwd, VirtualTerminal *vt) {
+ m_vt = vt;
((ScrollableVT*)m_vt)->map(9);
Kbd::setFocus(m_vt);
m_cwd = cwd;
@@ -25,6 +25,14 @@ KernelShell::KernelShell(DirectoryNode* cwd) {
m_instances++;
}
+KernelShell::KernelShell(DirectoryNode* cwd, VirtualTerminal* vt) {
+ setup(cwd, vt);
+}
+
+KernelShell::KernelShell(DirectoryNode* cwd) {
+ setup(cwd, new ScrollableVT(15, 76, 200, SHELL_FGCOLOR, SHELL_BGCOLOR));
+}
+
KernelShell::~KernelShell() {
delete m_vt;
m_instances--;
diff --git a/Source/Kernel/Shell/KernelShell.class.h b/Source/Kernel/Shell/KernelShell.class.h
index 182aa66..39e1ebd 100644
--- a/Source/Kernel/Shell/KernelShell.class.h
+++ b/Source/Kernel/Shell/KernelShell.class.h
@@ -34,7 +34,10 @@ class KernelShell {
void uptime(Vector<String>& args);
void part(Vector<String>& args);
+ void setup(DirectoryNode* cwd, VirtualTerminal *vt);
+
public:
+ KernelShell(DirectoryNode* cwd, VirtualTerminal *vt);
KernelShell(DirectoryNode* cwd);
static u32int getInstances() { return m_instances; }
diff --git a/Source/Kernel/TaskManager/Task.ns.cpp b/Source/Kernel/TaskManager/Task.ns.cpp
index 8a41340..4db05bc 100644
--- a/Source/Kernel/TaskManager/Task.ns.cpp
+++ b/Source/Kernel/TaskManager/Task.ns.cpp
@@ -7,7 +7,7 @@ extern "C" u32int idle_task(void*);
namespace Task {
-SimpleList <Process*> *processes = 0; //TODO : use a linked list instead
+SimpleList <Process*> *processes = 0;
SimpleList <Thread*> *threads = 0;
SimpleList <Thread*> *currentThread = 0;
@@ -146,16 +146,7 @@ void registerThread(Thread* t) {
void unregisterThread(Thread* t) {
if (threads == 0) return; //Tasking not yet initialized
- if (threads->v() == t) {
- threads = threads->delThis();
- return;
- }
- for (SimpleList<Thread*> *iter = threads; iter->next() != 0; iter = iter->next()) {
- if (iter->next()->v() == t) {
- iter->delNext();
- return;
- }
- }
+ threads = threads->removeOnce(t);
}
void registerProcess(Process* p) {
@@ -165,16 +156,7 @@ void registerProcess(Process* p) {
void unregisterProcess(Process* p) {
if (processes == 0) return; //Tasking not yet initialized
- if (processes->v() == p) {
- processes = processes->delThis();
- return;
- }
- for (SimpleList<Process*> *iter = processes; iter->next() != 0; iter = iter->next()) {
- if (iter->next()->v() == p) {
- iter->delNext();
- return;
- }
- }
+ processes = processes->removeOnce(p);
}
}