Change defn of LOCAL_LABEL_PREFIX to ""
[external/binutils.git] / gdb / ultra3-xdep.c
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
5    This file is part of GDB.
6
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.
11
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.
16
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.  */
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>
33 #include <fcntl.h>
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
46 getpagesize (void)
47 {
48   return (8192);
49 }
50
51 /* FIXME: Fake out the fcntl() call, which we don't have.  */
52 fcntl (int fd, int cmd, int arg)
53 {
54
55   switch (cmd)
56     {
57     case F_GETFL:
58       return (O_RDONLY);
59       break;
60     default:
61       printf_unfiltered ("Ultra3's fcntl() failing, cmd = %d.\n", cmd);
62       return (-1);
63     }
64 }
65
66
67 /* 
68  * 4.2 Signal support, requires linking with libjobs.
69  */
70 static int _SigMask;
71 #define sigbit(s)       (1L << ((s)-1))
72
73 init_SigMask (void)
74 {
75   /* Taken from the sym1 kernel in machdep.c:startup() */
76   _SigMask = sigbit (SIGTSTP) | sigbit (SIGTTOU) | sigbit (SIGTTIN) |
77     sigbit (SIGCHLD) | sigbit (SIGTINT);
78 }
79
80 sigmask (int signo)
81 {
82   return (1 << (signo - 1));
83 }
84
85 sigsetmask (unsigned int sigmask)
86 {
87   int i, mask = 1;
88   int lastmask = _SigMask;
89
90   for (i = 0; i < NSIG; i++)
91     {
92       if (sigmask & mask)
93         {
94           if (!(_SigMask & mask))
95             {
96               sighold (i + 1);
97               _SigMask |= mask;
98             }
99         }
100       else if (_SigMask & mask)
101         {
102           sigrelse (i + 1);
103           _SigMask &= ~mask;
104         }
105       mask <<= 1;
106     }
107   return (lastmask);
108 }
109
110 sigblock (unsigned int sigmask)
111 {
112   int i, mask = 1;
113   int lastmask = _SigMask;
114
115   for (i = 0; i < NSIG; i++)
116     {
117       if ((sigmask & mask) && !(_SigMask & mask))
118         {
119           sighold (i + 1);
120           _SigMask |= mask;
121         }
122       mask <<= 1;
123     }
124   return (lastmask);
125 }
126 #endif /* SYM1 */
127
128
129 /* Initialization code for this module.  */
130
131 void
132 _initialize_ultra3 (void)
133 {
134 #ifdef SYM1
135   init_SigMask ();
136 #endif
137 }