/* Additional parameters for PM_EXEC_REPLY and PM_CORE_REPLY */
# define PM_STATUS m1_i2 /* OK or failure */
+# define PM_PC m1_p1 /* program counter */
/* Additional parameters for PM_FORK and PM_SRV_FORK */
# define PM_PPROC m1_i2 /* parent process endpoint */
/* Parameters for the EXEC_RESTART call */
#define EXC_RS_PROC m1_i1 /* process that needs to be restarted */
#define EXC_RS_RESULT m1_i2 /* result of the exec */
+#define EXC_RS_PC m1_p1 /* program counter */
/*===========================================================================*
* Messages used from VFS to file servers *
{
int proc_e, proc_n, result;
struct mproc *rmp;
+ vir_bytes pc;
if (who_e != RS_PROC_NR)
return EPERM;
}
rmp= &mproc[proc_n];
result= m_in.EXC_RS_RESULT;
+ pc= (vir_bytes)m_in.EXC_RS_PC;
- exec_restart(rmp, result);
+ exec_restart(rmp, result, pc);
return OK;
}
/*===========================================================================*
* exec_restart *
*===========================================================================*/
-PUBLIC void exec_restart(rmp, result)
+PUBLIC void exec_restart(rmp, result, pc)
struct mproc *rmp;
int result;
+vir_bytes pc;
{
int r, sn;
- vir_bytes pc;
char *new_sp;
if (result != OK)
}
new_sp= (char *)rmp->mp_procargs;
- pc= 0; /* for now */
r= sys_exec(rmp->mp_endpoint, new_sp, rmp->mp_name, pc);
if (r != OK) panic("sys_exec failed: %d", r);
}
break;
case PM_EXEC_REPLY:
- exec_restart(rmp, m_in.PM_STATUS);
+ exec_restart(rmp, m_in.PM_STATUS, (vir_bytes)m_in.PM_PC);
break;
_PROTOTYPE( int do_exec, (void) );
_PROTOTYPE( int do_exec_newmem, (void) );
_PROTOTYPE( int do_execrestart, (void) );
-_PROTOTYPE( void exec_restart, (struct mproc *rmp, int result) );
+_PROTOTYPE( void exec_restart, (struct mproc *rmp, int result,
+ vir_bytes pc) );
/* forkexit.c */
_PROTOTYPE( int do_fork, (void) );
dev_t st_dev, ino_t st_ino, time_t st_ctime, char *progname,
int new_uid, int new_gid,
vir_bytes *stack_topp, int *load_textp, int *allow_setuidp) );
-FORWARD _PROTOTYPE( int exec_restart, (int proc_e, int result) );
+FORWARD _PROTOTYPE( int exec_restart, (int proc_e, int result,
+ vir_bytes pc) );
FORWARD _PROTOTYPE( void patch_ptr, (char stack[ARG_MAX],
vir_bytes base) );
FORWARD _PROTOTYPE( int read_seg, (char *exec, size_t exec_len, off_t off,
goto fail;
}
- return exec_restart(proc_e, OK);
+ return exec_restart(proc_e, OK, pc);
fail:
printf("do_exec(fail): error = %d\n", error);
if (need_restart)
- exec_restart(proc_e, error);
+ exec_restart(proc_e, error, pc);
return error;
}
/*===========================================================================*
* exec_restart *
*===========================================================================*/
-PRIVATE int exec_restart(proc_e, result)
+PRIVATE int exec_restart(proc_e, result, pc)
int proc_e;
int result;
+vir_bytes pc;
{
int r;
message m;
m.m_type= EXEC_RESTART;
m.EXC_RS_PROC= proc_e;
m.EXC_RS_RESULT= result;
+ m.EXC_RS_PC= (void*)pc;
r= sendrec(PM_PROC_NR, &m);
if (r != OK)
return r;
/*===========================================================================*
* pm_exec *
*===========================================================================*/
-PUBLIC int pm_exec(proc_e, path, path_len, frame, frame_len)
+PUBLIC int pm_exec(proc_e, path, path_len, frame, frame_len, pc)
int proc_e;
char *path;
vir_bytes path_len;
char *frame;
vir_bytes frame_len;
+vir_bytes *pc;
{
/* Perform the execve(name, argv, envp) call. The user library builds a
* complete stack image, including pointers, args, environ, etc. The stack
* is copied to a buffer inside VFS, and then to the new core image.
*/
int r, r1, sep_id, round, proc_s, hdrlen, load_text, allow_setuid;
- vir_bytes text_bytes, data_bytes, bss_bytes, pc;
+ vir_bytes text_bytes, data_bytes, bss_bytes;
phys_bytes tot_bytes; /* total space for program, including gap */
vir_bytes stack_top, vsp;
off_t off;
/* Read the file header and extract the segment sizes. */
r = read_header(vp, &sep_id, &text_bytes, &data_bytes, &bss_bytes,
- &tot_bytes, &pc, &hdrlen);
+ &tot_bytes, pc, &hdrlen);
if (r != ESCRIPT || round != 0)
break;
PRIVATE void service_pm()
{
int r;
+ vir_bytes pc;
switch (call_nr) {
case PM_SETUID:
case PM_EXEC:
r = pm_exec(m_in.PM_PROC, m_in.PM_PATH, m_in.PM_PATH_LEN,
- m_in.PM_FRAME, m_in.PM_FRAME_LEN);
+ m_in.PM_FRAME, m_in.PM_FRAME_LEN, &pc);
/* Reply status to PM */
m_out.m_type = PM_EXEC_REPLY;
m_out.PM_PROC = m_in.PM_PROC;
+ m_out.PM_PC = (void*)pc;
m_out.PM_STATUS = r;
break;
/* exec.c */
_PROTOTYPE( int pm_exec, (int proc_e, char *path, vir_bytes path_len,
- char *frame, vir_bytes frame_len) );
+ char *frame, vir_bytes frame_len, vir_bytes *pc));
/* filedes.c */
_PROTOTYPE( struct filp *find_filp, (struct vnode *vp, mode_t bits) );