1 /* Host-dependent code for GDB, for NYU Ultra3 running Sym1 OS.
2 Copyright (C) 1988, 1989, 1991, 1992 Free Software Foundation, Inc.
3 Contributed by David Wood (wood@nyu.edu) at New York University.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
28 #include <sys/types.h>
29 #include <sys/param.h>
31 #include <sys/ioctl.h>
39 /* Assumes support for AMD's Binary Compatibility Standard
40 for ptrace(). If you define ULTRA3, the ultra3 extensions to
41 ptrace() are used allowing the reading of more than one register
44 This file assumes KERNEL_DEBUGGING is turned off. This means
45 that if the user/gdb tries to read gr64-gr95 or any of the
46 protected special registers we silently return -1 (see the
47 CANNOT_STORE/FETCH_REGISTER macros). */
50 #if !defined (offsetof)
51 # define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER)
55 struct ptrace_user pt_struct
;
58 * Takes a register number as defined in tm.h via REGISTER_NAMES, and maps
59 * it to an offset in a struct ptrace_user defined by AMD's BCS.
60 * That is, it defines the mapping between gdb register numbers and items in
61 * a struct ptrace_user.
62 * A register protection scheme is set up here. If a register not
63 * available to the user is specified in 'regno', then an address that
64 * will cause ptrace() to fail is returned.
67 register_addr (regno
,blockend
)
71 if ((regno
>= LR0_REGNUM
) && (regno
< LR0_REGNUM
+ 128)) {
72 return(offsetof(struct ptrace_user
,pt_lr
[regno
-LR0_REGNUM
]));
73 } else if ((regno
>= GR96_REGNUM
) && (regno
< GR96_REGNUM
+ 32)) {
74 return(offsetof(struct ptrace_user
,pt_gr
[regno
-GR96_REGNUM
]));
77 case GR1_REGNUM
: return(offsetof(struct ptrace_user
,pt_gr1
));
78 case CPS_REGNUM
: return(offsetof(struct ptrace_user
,pt_psr
));
79 case NPC_REGNUM
: return(offsetof(struct ptrace_user
,pt_pc0
));
80 case PC_REGNUM
: return(offsetof(struct ptrace_user
,pt_pc1
));
81 case PC2_REGNUM
: return(offsetof(struct ptrace_user
,pt_pc2
));
82 case IPC_REGNUM
: return(offsetof(struct ptrace_user
,pt_ipc
));
83 case IPA_REGNUM
: return(offsetof(struct ptrace_user
,pt_ipa
));
84 case IPB_REGNUM
: return(offsetof(struct ptrace_user
,pt_ipb
));
85 case Q_REGNUM
: return(offsetof(struct ptrace_user
,pt_q
));
86 case BP_REGNUM
: return(offsetof(struct ptrace_user
,pt_bp
));
87 case FC_REGNUM
: return(offsetof(struct ptrace_user
,pt_fc
));
89 fprintf_filtered(stderr
,"register_addr():Bad register %s (%d)\n",
90 reg_names
[regno
],regno
);
91 return(0xffffffff); /* Should make ptrace() fail */
97 /* Assorted operating system circumventions */
101 /* FIXME: Kludge this for now. It really should be system call. */
106 /* FIXME: Fake out the fcntl() call, which we don't have. */
112 case F_GETFL
: return(O_RDONLY
); break;
114 printf("Ultra3's fcntl() failing, cmd = %d.\n",cmd
);
121 * 4.2 Signal support, requires linking with libjobs.
124 #define sigbit(s) (1L << ((s)-1))
128 /* Taken from the sym1 kernel in machdep.c:startup() */
129 _SigMask
= sigbit (SIGTSTP
) | sigbit (SIGTTOU
) | sigbit (SIGTTIN
) |
130 sigbit (SIGCHLD
) | sigbit (SIGTINT
);
136 return (1 << (signo
-1));
140 unsigned int sigmask
;
143 int lastmask
= _SigMask
;
145 for (i
=0 ; i
<NSIG
; i
++) {
146 if (sigmask
& mask
) {
147 if (!(_SigMask
& mask
)) {
151 } else if (_SigMask
& mask
) {
161 unsigned int sigmask
;
164 int lastmask
= _SigMask
;
166 for (i
=0 ; i
<NSIG
; i
++) {
167 if ((sigmask
& mask
) && !(_SigMask
& mask
)) {
178 /* Initialization code for this module. */
180 _initialize_ultra3 ()