1/*-
2 * Copyright (c) 1982, 1993
3 *	The Regents of the University of California.  All rights reserved.
4 *
5 * %sccs.include.redist.c%
6 *
7 *	@(#)process.rep	8.1 (Berkeley) 06/06/93
8 */
9
10/*
11 * This file defines the representation of a process.
12 * It is MACHINE DEPENDENT.
13 */
14
15#define STOPPED 0177
16#define FINISHED 0
17
18#ifdef vax
19#define NREG 12			/* maximum number of saved registers */
20#endif
21#ifdef tahoe
22#define	NREG 13
23#endif
24#ifdef mc68000
25#define NREG 14			/* maximum number of saved registers */
26#endif
27#define CSIZE 101		/* size of instruction cache */
28
29/*
30 * Cache-ing of instruction segment is done to reduce the number
31 * of calls to ptrace.
32 */
33
34typedef struct {
35	WORD addr;
36	WORD val;
37} CACHEWORD;
38
39/*
40 * This structure holds the information we need from the user structure.
41 */
42
43struct process {
44	int pid;		/* process being traced */
45	WORD reg[NREG];		/* process's registers */
46#ifdef tahoe
47	WORD fp, sp, pc;	/* special registers */
48#else
49	WORD ap, fp, sp, pc;	/* special registers */
50#endif
51	WORD oreg[NREG];	/* registers when process last stopped */
52	WORD oap, ofp, osp, opc;/* special registers when process stopped */
53	int status;		/* either STOPPED or FINISHED */
54	int signo;		/* signal that stopped process */
55	int exitval;		/* return value from exit() */
56	long sigset;		/* bit array of traced signals */
57	CACHEWORD word[CSIZE];	/* text segment cache */
58};
59
60/*
61 * Process manipulation routines local to this module.
62 */
63
64int pstart();			/* start up a process */
65int pcont();			/* continue execution */
66int pstep();			/* single step */
67int pio();			/* process memory move */
68int psigtrace();		/* catch/don't catch a signal */
69int unsetsigtraces();		/* don't catch any signals */
70
71/*
72 * These definitions are for the arguments to "pio".
73 */
74
75typedef enum { PREAD, PWRITE } PIO_OP;
76typedef enum { TEXTSEG, DATASEG } PIO_SEG;
77
78/* macros for things that used to be functions */
79
80#define	iread(buf, addr, nbytes)	dread(buf, addr+ENDOFF, nbytes)
81#define	iwrite(buf, addr, nbytes)	dwrite(buf, addr+ENDOFF, nbytes)
82#define	dread(buf, addr, nbytes)	drdwr(PREAD, buf, addr, nbytes)
83#define	dwrite(buf, addr, nbytes)	drdwr(PWRITE, buf, addr, nbytes)
84