summaryrefslogtreecommitdiff
path: root/Source/Kernel/Shell
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-10-18 10:34:11 +0200
committerAlexis211 <alexis211@gmail.com>2009-10-18 10:34:11 +0200
commit22c06556ccbd07f4ef7da39a62d10e03fbee3fe0 (patch)
tree8b45002ef347b625c9134091a7dfad9ed16c5274 /Source/Kernel/Shell
parent7dc8c19f7d6220c9e3dac43796faf77c4f11974f (diff)
downloadMelon-22c06556ccbd07f4ef7da39a62d10e03fbee3fe0.tar.gz
Melon-22c06556ccbd07f4ef7da39a62d10e03fbee3fe0.zip
Loading binaries now is done through a much more unified interface.
Diffstat (limited to 'Source/Kernel/Shell')
-rw-r--r--Source/Kernel/Shell/KernelShell-fs.class.cpp27
1 files changed, 7 insertions, 20 deletions
diff --git a/Source/Kernel/Shell/KernelShell-fs.class.cpp b/Source/Kernel/Shell/KernelShell-fs.class.cpp
index b34fa7f..fe1ecbf 100644
--- a/Source/Kernel/Shell/KernelShell-fs.class.cpp
+++ b/Source/Kernel/Shell/KernelShell-fs.class.cpp
@@ -109,27 +109,14 @@ void KernelShell::run(Vector<String>& args) {
if (args.size() == 1) {
*m_vt << "No app to run !\n";
} else {
- File f(args[1], FM_READ, m_cwd);
- if (f.valid()) {
- u32int magic = 0;
- f.read<u32int>(&magic);
- if (magic == 0xFEEDBEEF) {
- u32int size;
- f.read<u32int>(&size);
- Process* p;
- p = new Process(args[1], 0);
- p->setVirtualTerminal(m_vt);
- u8int *ptr = (u8int*)p->heap().alloc(size);
- f.read(size, ptr);
- new Thread(p, (thread_entry_t)ptr, 0);
- kernelPageDirectory->switchTo();
- while (p->getState() != P_FINISHED) Task::currThread()->sleep(10);
- delete p;
- } else {
- *m_vt << "Bad magic number : " << (u32int)magic << "\n";
- }
+ Process* p = Process::run(args[1], m_cwd, 0);
+ if (p == 0) {
+ *m_vt << "Error while launching process.\n";
} else {
- *m_vt << "Unable to read from file.\n";
+ p->setVirtualTerminal(m_vt);
+ p->start();
+ while (p->getState() != P_FINISHED) Task::currThread()->sleep(10);
+ delete p;
}
}
}