Commit | Line | Data |
---|---|---|
c906108c | 1 | /* Host-dependent code for GDB, for NYU Ultra3 running Sym1 OS. |
b6ba6518 KB |
2 | Copyright 1988, 1989, 1991, 1992, 1993, 1995, 2000 |
3 | Free Software Foundation, Inc. | |
c906108c SS |
4 | Contributed by David Wood (wood@nyu.edu) at New York University. |
5 | ||
c5aa993b | 6 | This file is part of GDB. |
c906108c | 7 | |
c5aa993b JM |
8 | This program is free software; you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation; either version 2 of the License, or | |
11 | (at your option) any later version. | |
c906108c | 12 | |
c5aa993b JM |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
c906108c | 17 | |
c5aa993b JM |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software | |
20 | Foundation, Inc., 59 Temple Place - Suite 330, | |
21 | Boston, MA 02111-1307, USA. */ | |
c906108c SS |
22 | |
23 | #define DEBUG | |
24 | #include "defs.h" | |
25 | #include "frame.h" | |
26 | #include "inferior.h" | |
27 | #include "symtab.h" | |
28 | #include "value.h" | |
29 | ||
30 | #include <sys/types.h> | |
31 | #include <sys/param.h> | |
32 | #include <signal.h> | |
33 | #include <sys/ioctl.h> | |
c5aa993b | 34 | #include <fcntl.h> |
c906108c SS |
35 | |
36 | #include "gdbcore.h" | |
37 | ||
38 | #include <sys/file.h> | |
39 | #include "gdb_stat.h" | |
40 | ||
41 | /* Assorted operating system circumventions */ | |
42 | ||
43 | #ifdef SYM1 | |
44 | ||
45 | /* FIXME: Kludge this for now. It really should be system call. */ | |
46 | int | |
fba45db2 | 47 | getpagesize (void) |
c5aa993b JM |
48 | { |
49 | return (8192); | |
50 | } | |
c906108c SS |
51 | |
52 | /* FIXME: Fake out the fcntl() call, which we don't have. */ | |
fba45db2 | 53 | fcntl (int fd, int cmd, int 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 | ||
fba45db2 | 74 | init_SigMask (void) |
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 | ||
fba45db2 | 81 | sigmask (int signo) |
c906108c | 82 | { |
c5aa993b | 83 | return (1 << (signo - 1)); |
c906108c SS |
84 | } |
85 | ||
fba45db2 | 86 | sigsetmask (unsigned int sigmask) |
c906108c | 87 | { |
c5aa993b JM |
88 | int i, mask = 1; |
89 | int lastmask = _SigMask; | |
90 | ||
91 | for (i = 0; i < NSIG; i++) | |
92 | { | |
93 | if (sigmask & mask) | |
94 | { | |
95 | if (!(_SigMask & mask)) | |
96 | { | |
97 | sighold (i + 1); | |
98 | _SigMask |= mask; | |
99 | } | |
100 | } | |
101 | else if (_SigMask & mask) | |
102 | { | |
103 | sigrelse (i + 1); | |
104 | _SigMask &= ~mask; | |
c906108c | 105 | } |
c5aa993b JM |
106 | mask <<= 1; |
107 | } | |
108 | return (lastmask); | |
c906108c SS |
109 | } |
110 | ||
fba45db2 | 111 | sigblock (unsigned int sigmask) |
c906108c | 112 | { |
c5aa993b JM |
113 | int i, mask = 1; |
114 | int lastmask = _SigMask; | |
115 | ||
116 | for (i = 0; i < NSIG; i++) | |
117 | { | |
118 | if ((sigmask & mask) && !(_SigMask & mask)) | |
119 | { | |
120 | sighold (i + 1); | |
121 | _SigMask |= mask; | |
c906108c | 122 | } |
c5aa993b JM |
123 | mask <<= 1; |
124 | } | |
125 | return (lastmask); | |
c906108c SS |
126 | } |
127 | #endif /* SYM1 */ | |
128 | ||
129 | ||
130 | /* Initialization code for this module. */ | |
131 | ||
132 | void | |
fba45db2 | 133 | _initialize_ultra3 (void) |
c906108c SS |
134 | { |
135 | #ifdef SYM1 | |
c5aa993b | 136 | init_SigMask (); |
c906108c SS |
137 | #endif |
138 | } |