/* Field names for SYS_FORK, _EXEC, _EXIT, GETMCONTEXT, SETMCONTEXT.*/
#define PR_ENDPT m1_i1 /* indicates a process */
-#define PR_PRIORITY m1_i2 /* process priority */
-#define PR_SLOT m1_i2 /* indicates a process slot */
-#define PR_STACK_PTR m1_p1 /* used for stack ptr in sys_exec, sys_getsp */
-#define PR_NAME_PTR m1_p2 /* tells where program name is for dmp */
-#define PR_IP_PTR m1_p3 /* initial value for ip after exec */
-#define PR_PS_STR_PTR m1_p4 /* pointer to ps_strings, expected by __start */
/* Constants for exec. FIXME: these do not belong here. */
#define PMEF_AUXVECTORS 20
} mess_lsys_krn_sys_copy;
_ASSERT_MSG_SIZE(mess_lsys_krn_sys_copy);
+typedef struct {
+ endpoint_t endpt;
+ vir_bytes ip;
+ vir_bytes stack;
+ vir_bytes name;
+ vir_bytes ps_str;
+
+ uint8_t padding[36];
+} mess_lsys_krn_sys_exec;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_exec);
+
typedef struct {
endpoint_t endpt;
endpoint_t slot;
mess_lsys_krn_schedule m_lsys_krn_schedule;
mess_lsys_krn_sys_abort m_lsys_krn_sys_abort;
mess_lsys_krn_sys_copy m_lsys_krn_sys_copy;
+ mess_lsys_krn_sys_exec m_lsys_krn_sys_exec;
mess_lsys_krn_sys_fork m_lsys_krn_sys_fork;
mess_lsys_krn_sys_getinfo m_lsys_krn_sys_getinfo;
mess_lsys_krn_sys_getmcontext m_lsys_krn_sys_getmcontext;
int sys_abort(int how);
int sys_enable_iop(endpoint_t proc_ep);
-int sys_exec(endpoint_t proc_ep, char *stack_ptr, char *progname,
+int sys_exec(endpoint_t proc_ep, vir_bytes stack_ptr, vir_bytes progname,
vir_bytes pc, vir_bytes ps_str);
int sys_fork(endpoint_t parent, endpoint_t child, endpoint_t *,
u32_t vm, vir_bytes *);
* m_type: SYS_EXEC
*
* The parameters for this kernel call are:
- * m1_i1: PR_ENDPT (process that did exec call)
- * m1_p1: PR_STACK_PTR (new stack pointer)
- * m1_p2: PR_NAME_PTR (pointer to program name)
- * m1_p3: PR_IP_PTR (new instruction pointer)
+ * m_lsys_krn_sys_exec.endpt (process that did exec call)
+ * m_lsys_krn_sys_exec.stack (new stack pointer)
+ * m_lsys_krn_sys_exec.name (pointer to program name)
+ * m_lsys_krn_sys_exec.ip (new instruction pointer)
+ * m_lsys_krn_sys_exec.ps_str (struct ps_strings *)
*/
#include "kernel/system.h"
#include <string.h>
int proc_nr;
char name[PROC_NAME_LEN];
- if(!isokendpt(m_ptr->PR_ENDPT, &proc_nr))
+ if(!isokendpt(m_ptr->m_lsys_krn_sys_exec.endpt, &proc_nr))
return EINVAL;
rp = proc_addr(proc_nr);
}
/* Save command name for debugging, ps(1) output, etc. */
- if(data_copy(caller->p_endpoint, (vir_bytes) m_ptr->PR_NAME_PTR,
+ if(data_copy(caller->p_endpoint, m_ptr->m_lsys_krn_sys_exec.name,
KERNEL, (vir_bytes) name,
(phys_bytes) sizeof(name) - 1) != OK)
strncpy(name, "<unset>", PROC_NAME_LEN);
name[sizeof(name)-1] = '\0';
/* Set process state. */
- arch_proc_init(rp, (u32_t) m_ptr->PR_IP_PTR, (u32_t) m_ptr->PR_STACK_PTR,
- (u32_t) m_ptr->PR_PS_STR_PTR, name);
+ arch_proc_init(rp,
+ (u32_t) m_ptr->m_lsys_krn_sys_exec.ip,
+ (u32_t) m_ptr->m_lsys_krn_sys_exec.stack,
+ (u32_t) m_ptr->m_lsys_krn_sys_exec.ps_str, name);
/* No reply to EXEC call */
RTS_UNSET(rp, RTS_RECEIVING);
return(OK);
}
#endif /* USE_EXEC */
-
#include "syslib.h"
-int sys_exec(endpoint_t proc_ep, char *stack_ptr, char *progname,
+int sys_exec(endpoint_t proc_ep, vir_bytes stack_ptr, vir_bytes progname,
vir_bytes pc, vir_bytes ps_str)
{
/* A process has exec'd. Tell the kernel. */
message m;
- m.PR_ENDPT = proc_ep;
- m.PR_STACK_PTR = stack_ptr;
- m.PR_NAME_PTR = progname;
- m.PR_IP_PTR = (char *)pc;
- m.PR_PS_STR_PTR = (char *)ps_str;
+ m.m_lsys_krn_sys_exec.endpt = proc_ep;
+ m.m_lsys_krn_sys_exec.stack = stack_ptr;
+ m.m_lsys_krn_sys_exec.name = progname;
+ m.m_lsys_krn_sys_exec.ip = pc;
+ m.m_lsys_krn_sys_exec.ps_str = ps_str;
return _kernel_call(SYS_EXEC, &m);
}
}
/* Call kernel to exec with SP and PC set by VFS. */
- r = sys_exec(rmp->mp_endpoint, (char *) sp, rmp->mp_name, pc, ps_str);
+ r = sys_exec(rmp->mp_endpoint, sp, (vir_bytes)rmp->mp_name, pc, ps_str);
if (r != OK) panic("sys_exec failed: %d", r);
}
panic("vm: could not copy stack for boot process %s (ep=%d)\n",
execi->progname, vmp->vm_endpoint);
- if(sys_exec(vmp->vm_endpoint, (char *)vsp, execi->progname, execi->pc,
- vsp + ((int)psp - (int)frame)) != OK)
+ if(sys_exec(vmp->vm_endpoint, (vir_bytes)vsp,
+ (vir_bytes)execi->progname, execi->pc,
+ vsp + ((int)psp - (int)frame)) != OK)
panic("vm: boot process exec of process %s (ep=%d) failed\n",
execi->progname,vmp->vm_endpoint);