BSD 4_3_Net_2 release
[unix-history] / usr / src / usr.bin / pascal / pdx / process / process.rep
CommitLineData
505bf312
KB
1/*-
2 * Copyright (c) 1982 The Regents of the University of California.
3 * All rights reserved.
4 *
af359dea
C
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
023ccbaf 20 *
af359dea
C
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
023ccbaf 32 *
af359dea 33 * @(#)process.rep 5.5 (Berkeley) 4/16/91
50ad1403 34 */
ca0bf12f 35
7a1812dd
ML
36/*
37 * This file defines the representation of a process.
38 * It is MACHINE DEPENDENT.
39 */
40
41#define STOPPED 0177
42#define FINISHED 0
43
ca0bf12f 44#ifdef vax
7a1812dd 45#define NREG 12 /* maximum number of saved registers */
82d3cd01
KM
46#endif
47#ifdef tahoe
48#define NREG 13
49#endif
50#ifdef mc68000
ca0bf12f
ML
51#define NREG 14 /* maximum number of saved registers */
52#endif
7a1812dd
ML
53#define CSIZE 101 /* size of instruction cache */
54
55/*
56 * Cache-ing of instruction segment is done to reduce the number
57 * of calls to ptrace.
58 */
59
60typedef struct {
61 WORD addr;
62 WORD val;
63} CACHEWORD;
64
65/*
66 * This structure holds the information we need from the user structure.
67 */
68
69struct process {
70 int pid; /* process being traced */
71 WORD reg[NREG]; /* process's registers */
82d3cd01
KM
72#ifdef tahoe
73 WORD fp, sp, pc; /* special registers */
74#else
7a1812dd 75 WORD ap, fp, sp, pc; /* special registers */
82d3cd01 76#endif
7a1812dd
ML
77 WORD oreg[NREG]; /* registers when process last stopped */
78 WORD oap, ofp, osp, opc;/* special registers when process stopped */
79 int status; /* either STOPPED or FINISHED */
80 int signo; /* signal that stopped process */
81 int exitval; /* return value from exit() */
82 long sigset; /* bit array of traced signals */
83 CACHEWORD word[CSIZE]; /* text segment cache */
84};
85
86/*
87 * Process manipulation routines local to this module.
88 */
89
7d4de299
KB
90int pstart(); /* start up a process */
91int pcont(); /* continue execution */
92int pstep(); /* single step */
93int pio(); /* process memory move */
94int psigtrace(); /* catch/don't catch a signal */
95int unsetsigtraces(); /* don't catch any signals */
7a1812dd
ML
96
97/*
98 * These definitions are for the arguments to "pio".
99 */
100
101typedef enum { PREAD, PWRITE } PIO_OP;
102typedef enum { TEXTSEG, DATASEG } PIO_SEG;
82d3cd01
KM
103
104/* macros for things that used to be functions */
105
106#define iread(buf, addr, nbytes) dread(buf, addr+ENDOFF, nbytes)
107#define iwrite(buf, addr, nbytes) dwrite(buf, addr+ENDOFF, nbytes)
7d4de299
KB
108#define dread(buf, addr, nbytes) drdwr(PREAD, buf, addr, nbytes)
109#define dwrite(buf, addr, nbytes) drdwr(PWRITE, buf, addr, nbytes)