#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 */
-#define PR_FORK_FLAGS m1_i3 /* optional flags for fork operation */
-#define PR_FORK_MSGADDR m1_p1 /* reply message address of forked child */
/* 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;
+ endpoint_t slot;
+ uint32_t flags;
+
+ uint8_t padding[44];
+} mess_lsys_krn_sys_fork;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_fork);
+
+typedef struct {
+ endpoint_t endpt;
+ vir_bytes msgaddr;
+
+ uint8_t padding[48];
+} mess_krn_lsys_sys_fork;
+_ASSERT_MSG_SIZE(mess_krn_lsys_sys_fork);
+
typedef struct {
int request;
endpoint_t endpt;
mess_sigcalls m_sigcalls;
mess_krn_lsys_schedule m_krn_lsys_schedule;
+ mess_krn_lsys_sys_fork m_krn_lsys_sys_fork;
mess_krn_lsys_sys_getwhoami m_krn_lsys_sys_getwhoami;
mess_krn_lsys_sys_irqctl m_krn_lsys_sys_irqctl;
mess_krn_lsys_sys_times m_krn_lsys_sys_times;
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_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;
mess_lsys_krn_sys_iopenable m_lsys_krn_sys_iopenable;
* m_type: SYS_FORK
*
* The parameters for this kernel call are:
- * m1_i1: PR_ENDPT (parent, process that forked)
- * m1_i2: PR_SLOT (child's process table slot)
- * m1_p1: PR_MEM_PTR (new memory map for the child)
- * m1_i3: PR_FORK_FLAGS (fork flags)
+ * m_lsys_krn_sys_fork.endpt (parent, process that forked)
+ * m_lsys_krn_sys_fork.slot (child's process table slot)
+ * m_lsys_krn_sys_fork.flags (fork flags)
+ * m_krn_lsys_sys_fork.endpt (endpoint of the child)
+ * m_krn_lsys_sys_fork.msgaddr (new memory map for the child)
*/
#include "kernel/system.h"
*===========================================================================*/
int do_fork(struct proc * caller, message * m_ptr)
{
-/* Handle sys_fork(). PR_ENDPT has forked. The child is PR_SLOT. */
+/* Handle sys_fork().
+ * m_lsys_krn_sys_fork.endpt has forked.
+ * The child is m_lsys_krn_sys_fork.slot.
+ */
#if defined(__i386__)
char *old_fpu_save_area_p;
#endif
int p_proc;
int namelen;
- if(!isokendpt(m_ptr->PR_ENDPT, &p_proc))
+ if(!isokendpt(m_ptr->m_lsys_krn_sys_fork.endpt, &p_proc))
return EINVAL;
rpp = proc_addr(p_proc);
- rpc = proc_addr(m_ptr->PR_SLOT);
+ rpc = proc_addr(m_ptr->m_lsys_krn_sys_fork.slot);
if (isemptyp(rpp) || ! isemptyp(rpc)) return(EINVAL);
assert(!(rpp->p_misc_flags & MF_DELIVERMSG));
#endif
if(++gen >= _ENDPOINT_MAX_GENERATION) /* increase generation */
gen = 1; /* generation number wraparound */
- rpc->p_nr = m_ptr->PR_SLOT; /* this was obliterated by copy */
+ rpc->p_nr = m_ptr->m_lsys_krn_sys_fork.slot; /* this was obliterated by copy */
rpc->p_endpoint = _ENDPOINT(gen, rpc->p_nr); /* new endpoint of slot */
rpc->p_reg.retreg = 0; /* child sees pid = 0 to know it is child */
}
/* Calculate endpoint identifier, so caller knows what it is. */
- m_ptr->PR_ENDPT = rpc->p_endpoint;
- m_ptr->PR_FORK_MSGADDR = (char *) rpp->p_delivermsg_vir;
+ m_ptr->m_krn_lsys_sys_fork.endpt = rpc->p_endpoint;
+ m_ptr->m_krn_lsys_sys_fork.msgaddr = rpp->p_delivermsg_vir;
/* Don't schedule process in VM mode until it has a new pagetable. */
- if(m_ptr->PR_FORK_FLAGS & PFF_VMINHIBIT) {
+ if(m_ptr->m_lsys_krn_sys_fork.flags & PFF_VMINHIBIT) {
RTS_SET(rpc, RTS_VMINHIBIT);
}
}
#endif /* USE_FORK */
-
message m;
int r;
- m.PR_ENDPT = parent;
- m.PR_SLOT = child;
- m.PR_FORK_FLAGS = flags;
+ m.m_lsys_krn_sys_fork.endpt = parent;
+ m.m_lsys_krn_sys_fork.slot = child;
+ m.m_lsys_krn_sys_fork.flags = flags;
r = _kernel_call(SYS_FORK, &m);
- *child_endpoint = m.PR_ENDPT;
- *msgaddr = (vir_bytes) m.PR_FORK_MSGADDR;
+ *child_endpoint = m.m_krn_lsys_sys_fork.endpt;
+ *msgaddr = m.m_krn_lsys_sys_fork.msgaddr;
return r;
}