* bfd.c (union tdata): Add nlm_obj_data;
[deliverable/binutils-gdb.git] / gdb / delta68-nat.c
1 #include "defs.h"
2 #include <sys/signal.h> /* for MAXSIG in sys/user.h */
3 #include <sys/types.h> /* for ushort in sys/dir.h */
4 #include <sys/dir.h> /* for struct direct in sys/user.h */
5 #include <sys/user.h>
6
7 #include <nlist.h>
8
9 #if !defined (offsetof)
10 #define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER)
11 #endif
12
13 /* Return the address in the core dump or inferior of register REGNO.
14 BLOCKEND is the address of the end of the user structure. */
15
16 unsigned int
17 register_addr (regno, blockend)
18 int regno;
19 int blockend;
20 {
21 static int sysv68reg[] =
22 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, -1, 15, 16 };
23
24 if (regno >= 0 && regno < sizeof(sysv68reg) / sizeof(sysv68reg[0]))
25 return blockend + sysv68reg[regno] * 4;
26 else if (regno < FPC_REGNUM)
27 return offsetof (struct user, u_fpu.regs.reg[regno - FP0_REGNUM]
28 else if (regno == FPC_REGNUM)
29 return offsetof (struct user, u_fpu.regs.control);
30 else if (regno == FPS_REGNUM)
31 return offsetof (struct user, u_fpu.regs.status);
32 else if (regno == FPI_REGNUM)
33 return offsetof (struct user, u_fpu.regs.iaddr);
34 else
35 {
36 fprintf (stderr, "\
37 Internal error: invalid register number %d in REGISTER_U_ADDR\n",
38 regno);
39 return blockend;
40 }
41 }
42
43 CORE_ADDR kernel_u_addr;
44 static struct nlist nl[] = {{ "_u", -1, }, { (char *) 0, }};
45
46 /* Read the value of the u area from the kernel. */
47 void _initialize_kernel_u_addr ()
48 {
49 if (nlist ("/sysV68", nl) == 0)
50 kernel_u_addr = nl[0].n_value;
51 else
52 {
53 perror ("Cannot get kernel u area address");
54 exit (1);
55 }
56 }
This page took 0.036713 seconds and 4 git commands to generate.