diff options
author | Alex AUVOLAT <alexis211@gmail.com> | 2012-05-18 15:15:57 +0200 |
---|---|---|
committer | Alex AUVOLAT <alexis211@gmail.com> | 2012-05-18 15:15:57 +0200 |
commit | daa6c2450fa0646619698f0dc01b0456b2541317 (patch) | |
tree | 1065acdd5e1f2c0febafa345e4a36c9a35dbb100 /src/kernel/core | |
parent | 7d5a38ada35ac196919c26675f211adb995b84ae (diff) | |
download | TCE-daa6c2450fa0646619698f0dc01b0456b2541317.tar.gz TCE-daa6c2450fa0646619698f0dc01b0456b2541317.zip |
Added process arguments when loaded as modules.
Diffstat (limited to 'src/kernel/core')
-rw-r--r-- | src/kernel/core/kmain.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/kernel/core/kmain.cpp b/src/kernel/core/kmain.cpp index 58a3c48..96c4050 100644 --- a/src/kernel/core/kmain.cpp +++ b/src/kernel/core/kmain.cpp @@ -80,7 +80,25 @@ extern "C" void kmain(multiboot_info_t* mbd, int32_t magic) { char* cmd = (char*)mods[i].string; *ke_vt << " * " << cmd << " \t"; if (elf_check((uint8_t*)mods[i].mod_start) == 0) { - process *pr = elf_exec((uint8_t*)mods[i].mod_start, PL_USER); + + char *args[16] = { cmd, 0 }; + int a = 1; + for (char* c = cmd; c != 0; c++) { + if (*c == ' ') { + *c = 0; + args[a] = c + 1; + a++; + if (a == 15) { + args[a] = 0; + break; + } + } else if (*c == 0) { + args[a] = 0; + break; + } + } + + process *pr = elf_exec((uint8_t*)mods[i].mod_start, PL_USER, args); // todo add args if (pr == 0) { *ke_vt << "Error loading\n"; } else { |