PM: save process frame length

This commit is contained in:
David van Moolenbroek 2010-09-14 21:21:54 +00:00
parent a5a8c57fe7
commit 7763fd67c7
3 changed files with 10 additions and 6 deletions

View file

@ -562,7 +562,7 @@ int pstat(int p_nr, struct pstat *bufp, int endpoints)
bufp->ps_utime = ps_proc[p_ki].p_user_time;
bufp->ps_stime = ps_proc[p_ki].p_sys_time;
bufp->ps_procargs = ps_mproc[p_nr].mp_procargs;
bufp->ps_procargs = ps_mproc[p_nr].mp_frame_addr;
if (bufp->ps_state == Z_STATE)
bufp->ps_args = "<defunct>";

View file

@ -8,7 +8,7 @@
* - take care of setuid and setgid bits
* - fix up 'mproc' table
* - tell kernel about EXEC
* - save offset to initial argc (for ps)
* - save offset to initial argc (for procfs)
*
* The entry points into this file are:
* do_exec: perform the EXEC system call
@ -95,8 +95,9 @@ PUBLIC int do_exec_newmem()
strncpy(rmp->mp_name, args.progname, PROC_NAME_LEN-1);
rmp->mp_name[PROC_NAME_LEN-1] = '\0';
/* Save offset to initial argc (for ps) */
rmp->mp_procargs = (vir_bytes) stack_top - args.args_bytes;
/* Save offset to initial argc (for procfs) */
rmp->mp_frame_addr = (vir_bytes) stack_top - args.args_bytes;
rmp->mp_frame_len = args.args_bytes;
/* Kill process if something goes wrong after this point. */
rmp->mp_flags |= PARTIAL_EXEC;
@ -183,7 +184,7 @@ vir_bytes pc;
check_sig(rmp->mp_pid, sn, FALSE /* ksig */);
}
new_sp= (char *)rmp->mp_procargs;
new_sp= (char *)rmp->mp_frame_addr;
r= sys_exec(rmp->mp_endpoint, new_sp, rmp->mp_name, pc);
if (r != OK) panic("sys_exec failed: %d", r);
}

View file

@ -50,9 +50,12 @@ EXTERN struct mproc {
unsigned mp_flags; /* flag bits */
unsigned mp_trace_flags; /* trace options */
vir_bytes mp_procargs; /* ptr to proc's initial stack arguments */
message mp_reply; /* reply message to be sent to one */
/* Process execution frame. Both fields are used by procfs. */
vir_bytes mp_frame_addr; /* ptr to proc's initial stack arguments */
size_t mp_frame_len; /* size of proc's initial stack arguments */
/* Scheduling priority. */
signed int mp_nice; /* nice is PRIO_MIN..PRIO_MAX, standard 0. */