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