Parse commandline strings, move away from old env vars
This commit is contained in:
@@ -162,23 +162,6 @@ static void intr_exception(struct saved_regs* regs) {
|
||||
regs->error, regs->rip, regs->cs, regs->rflags, regs->rsp, regs->ss, cr2, cr3,
|
||||
regs->rbx);
|
||||
|
||||
debugprintf("call stack:\n");
|
||||
|
||||
uint64_t rbp = regs->rbp;
|
||||
|
||||
for (size_t depth = 0; depth < 20; depth++) {
|
||||
if (rbp == 0)
|
||||
break;
|
||||
|
||||
uint64_t rip = *(uint64_t*)(rbp + 8);
|
||||
debugprintf(" #%d %016lx\n", depth, rip);
|
||||
|
||||
rbp = *(uint64_t*)rbp;
|
||||
|
||||
if (rbp == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (regs->cs == (GDT_UCODE | 0x03)) {
|
||||
biglock_lock();
|
||||
|
||||
|
||||
@@ -340,10 +340,11 @@ DEFINE_SYSCALL(sys_exec) {
|
||||
return SYSRESULT(pid);
|
||||
}
|
||||
|
||||
/* int exec_partial (char* volume, char* path) */
|
||||
/* int exec_partial (char* volume, char* path, char* cmdline) */
|
||||
DEFINE_SYSCALL(sys_exec_partial) {
|
||||
uintptr_t uvaddr_volume = a1;
|
||||
uintptr_t uvaddr_path = a2;
|
||||
uintptr_t uvaddr_cmdline = a3;
|
||||
|
||||
struct limine_hhdm_response* hhdm = limine_hhdm_request.response;
|
||||
|
||||
@@ -367,12 +368,21 @@ DEFINE_SYSCALL(sys_exec_partial) {
|
||||
|
||||
const char* volume = (const char*)((uintptr_t)hhdm->offset + out_paddr);
|
||||
|
||||
out_paddr = mm_v2p(&procgroup->pd, uvaddr_cmdline);
|
||||
|
||||
char* cmdline = (out_paddr != 0) ? (char*)((uintptr_t)hhdm->offset + out_paddr) : NULL;
|
||||
|
||||
struct proc* new = proc_from_file(proc, volume, path, rctx);
|
||||
|
||||
if (new == NULL) {
|
||||
return SYSRESULT(-ST_EXEC_ERROR);
|
||||
}
|
||||
|
||||
if (cmdline != NULL) {
|
||||
void* cmdline_dest = (void*)((uintptr_t)hhdm->offset + new->procgroup->paddr_cmdline);
|
||||
strncpy(cmdline_dest, cmdline, PAGE_SIZE);
|
||||
}
|
||||
|
||||
int pid = new->pid;
|
||||
new->exec_pid = pid1;
|
||||
new->state = PROC_PARTIAL;
|
||||
|
||||
Reference in New Issue
Block a user