Commit | Line | Data |
---|---|---|
c906108c SS |
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. | |
4 | ||
c5aa993b | 5 | This file is part of GDB. |
c906108c | 6 | |
c5aa993b JM |
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. | |
c906108c | 11 | |
c5aa993b JM |
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. | |
c906108c | 16 | |
c5aa993b JM |
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., 59 Temple Place - Suite 330, | |
20 | Boston, MA 02111-1307, USA. */ | |
c906108c SS |
21 | |
22 | #define DEBUG | |
23 | #include "defs.h" | |
24 | #include "frame.h" | |
25 | #include "inferior.h" | |
26 | #include "symtab.h" | |
27 | #include "value.h" | |
28 | ||
29 | #include <sys/types.h> | |
30 | #include <sys/param.h> | |
31 | #include <signal.h> | |
32 | #include <sys/ioctl.h> | |
c5aa993b | 33 | #include <fcntl.h> |
c906108c SS |
34 | |
35 | #include "gdbcore.h" | |
36 | ||
37 | #include <sys/file.h> | |
38 | #include "gdb_stat.h" | |
39 | ||
40 | /* Assorted operating system circumventions */ | |
41 | ||
42 | #ifdef SYM1 | |
43 | ||
44 | /* FIXME: Kludge this for now. It really should be system call. */ | |
45 | int | |
c5aa993b JM |
46 | getpagesize () |
47 | { | |
48 | return (8192); | |
49 | } | |
c906108c SS |
50 | |
51 | /* FIXME: Fake out the fcntl() call, which we don't have. */ | |
c5aa993b JM |
52 | fcntl (fd, cmd, arg) |
53 | int fd, cmd, arg; | |
c906108c SS |
54 | { |
55 | ||
c5aa993b JM |
56 | switch (cmd) |
57 | { | |
58 | case F_GETFL: | |
59 | return (O_RDONLY); | |
60 | break; | |
61 | default: | |
62 | printf_unfiltered ("Ultra3's fcntl() failing, cmd = %d.\n", cmd); | |
63 | return (-1); | |
64 | } | |
c906108c SS |
65 | } |
66 | ||
67 | ||
68 | /* | |
69 | * 4.2 Signal support, requires linking with libjobs. | |
70 | */ | |
c5aa993b | 71 | static int _SigMask; |
c906108c SS |
72 | #define sigbit(s) (1L << ((s)-1)) |
73 | ||
c5aa993b | 74 | init_SigMask () |
c906108c | 75 | { |
c5aa993b JM |
76 | /* Taken from the sym1 kernel in machdep.c:startup() */ |
77 | _SigMask = sigbit (SIGTSTP) | sigbit (SIGTTOU) | sigbit (SIGTTIN) | | |
78 | sigbit (SIGCHLD) | sigbit (SIGTINT); | |
c906108c SS |
79 | } |
80 | ||
c5aa993b JM |
81 | sigmask (signo) |
82 | int signo; | |
c906108c | 83 | { |
c5aa993b | 84 | return (1 << (signo - 1)); |
c906108c SS |
85 | } |
86 | ||
c5aa993b JM |
87 | sigsetmask (sigmask) |
88 | unsigned int sigmask; | |
c906108c | 89 | { |
c5aa993b JM |
90 | int i, mask = 1; |
91 | int lastmask = _SigMask; | |
92 | ||
93 | for (i = 0; i < NSIG; i++) | |
94 | { | |
95 | if (sigmask & mask) | |
96 | { | |
97 | if (!(_SigMask & mask)) | |
98 | { | |
99 | sighold (i + 1); | |
100 | _SigMask |= mask; | |
101 | } | |
102 | } | |
103 | else if (_SigMask & mask) | |
104 | { | |
105 | sigrelse (i + 1); | |
106 | _SigMask &= ~mask; | |
c906108c | 107 | } |
c5aa993b JM |
108 | mask <<= 1; |
109 | } | |
110 | return (lastmask); | |
c906108c SS |
111 | } |
112 | ||
c5aa993b JM |
113 | sigblock (sigmask) |
114 | unsigned int sigmask; | |
c906108c | 115 | { |
c5aa993b JM |
116 | int i, mask = 1; |
117 | int lastmask = _SigMask; | |
118 | ||
119 | for (i = 0; i < NSIG; i++) | |
120 | { | |
121 | if ((sigmask & mask) && !(_SigMask & mask)) | |
122 | { | |
123 | sighold (i + 1); | |
124 | _SigMask |= mask; | |
c906108c | 125 | } |
c5aa993b JM |
126 | mask <<= 1; |
127 | } | |
128 | return (lastmask); | |
c906108c SS |
129 | } |
130 | #endif /* SYM1 */ | |
131 | ||
132 | ||
133 | /* Initialization code for this module. */ | |
134 | ||
135 | void | |
136 | _initialize_ultra3 () | |
137 | { | |
138 | #ifdef SYM1 | |
c5aa993b | 139 | init_SigMask (); |
c906108c SS |
140 | #endif |
141 | } |