diff options
author | Alexis211 <alexis211@gmail.com> | 2009-10-18 10:34:11 +0200 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2009-10-18 10:34:11 +0200 |
commit | 22c06556ccbd07f4ef7da39a62d10e03fbee3fe0 (patch) | |
tree | 8b45002ef347b625c9134091a7dfad9ed16c5274 /Source/Kernel/Shell | |
parent | 7dc8c19f7d6220c9e3dac43796faf77c4f11974f (diff) | |
download | Melon-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.cpp | 27 |
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; } } } |