1 /* Sequent Symmetry host interface, for GDB when running under Unix.
2 Copyright 1986, 1987, 1989, 1991, 1992 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
20 /* FIXME, some 387-specific items of use taken from i387-tdep.c -- ought to be
29 #include <sys/param.h>
32 #include <sys/ioctl.h>
37 #define TERMINAL struct sgttyb
42 store_inferior_registers(regno
)
45 struct pt_regset regs
;
47 extern char registers
[];
49 regs
.pr_eax
= *(int *)®isters
[REGISTER_BYTE(0)];
50 regs
.pr_ebx
= *(int *)®isters
[REGISTER_BYTE(5)];
51 regs
.pr_ecx
= *(int *)®isters
[REGISTER_BYTE(2)];
52 regs
.pr_edx
= *(int *)®isters
[REGISTER_BYTE(1)];
53 regs
.pr_esi
= *(int *)®isters
[REGISTER_BYTE(6)];
54 regs
.pr_edi
= *(int *)®isters
[REGISTER_BYTE(7)];
55 regs
.pr_esp
= *(int *)®isters
[REGISTER_BYTE(14)];
56 regs
.pr_ebp
= *(int *)®isters
[REGISTER_BYTE(15)];
57 regs
.pr_eip
= *(int *)®isters
[REGISTER_BYTE(16)];
58 regs
.pr_flags
= *(int *)®isters
[REGISTER_BYTE(17)];
59 for (i
= 0; i
< 31; i
++)
61 regs
.pr_fpa
.fpa_regs
[i
] =
62 *(int *)®isters
[REGISTER_BYTE(FP1_REGNUM
+i
)];
64 PTRACE_WRITE_REGS (inferior_pid
, (PTRACE_ARG3_TYPE
) ®s
);
68 fetch_inferior_registers (regno
)
72 struct pt_regset regs
;
73 extern char registers
[];
77 PTRACE_READ_REGS (inferior_pid
, (PTRACE_ARG3_TYPE
) ®s
);
78 *(int *)®isters
[REGISTER_BYTE(EAX_REGNUM
)] = regs
.pr_eax
;
79 *(int *)®isters
[REGISTER_BYTE(EBX_REGNUM
)] = regs
.pr_ebx
;
80 *(int *)®isters
[REGISTER_BYTE(ECX_REGNUM
)] = regs
.pr_ecx
;
81 *(int *)®isters
[REGISTER_BYTE(EDX_REGNUM
)] = regs
.pr_edx
;
82 *(int *)®isters
[REGISTER_BYTE(ESI_REGNUM
)] = regs
.pr_esi
;
83 *(int *)®isters
[REGISTER_BYTE(EDI_REGNUM
)] = regs
.pr_edi
;
84 *(int *)®isters
[REGISTER_BYTE(EBP_REGNUM
)] = regs
.pr_ebp
;
85 *(int *)®isters
[REGISTER_BYTE(ESP_REGNUM
)] = regs
.pr_esp
;
86 *(int *)®isters
[REGISTER_BYTE(EIP_REGNUM
)] = regs
.pr_eip
;
87 *(int *)®isters
[REGISTER_BYTE(EFLAGS_REGNUM
)] = regs
.pr_flags
;
88 for (i
= 0; i
< FPA_NREGS
; i
++)
90 *(int *)®isters
[REGISTER_BYTE(FP1_REGNUM
+i
)] =
91 regs
.pr_fpa
.fpa_regs
[i
];
93 memcpy (®isters
[REGISTER_BYTE(ST0_REGNUM
)], regs
.pr_fpu
.fpu_stack
[0], 10);
94 memcpy (®isters
[REGISTER_BYTE(ST1_REGNUM
)], regs
.pr_fpu
.fpu_stack
[1], 10);
95 memcpy (®isters
[REGISTER_BYTE(ST2_REGNUM
)], regs
.pr_fpu
.fpu_stack
[2], 10);
96 memcpy (®isters
[REGISTER_BYTE(ST3_REGNUM
)], regs
.pr_fpu
.fpu_stack
[3], 10);
97 memcpy (®isters
[REGISTER_BYTE(ST4_REGNUM
)], regs
.pr_fpu
.fpu_stack
[4], 10);
98 memcpy (®isters
[REGISTER_BYTE(ST5_REGNUM
)], regs
.pr_fpu
.fpu_stack
[5], 10);
99 memcpy (®isters
[REGISTER_BYTE(ST6_REGNUM
)], regs
.pr_fpu
.fpu_stack
[6], 10);
100 memcpy (®isters
[REGISTER_BYTE(ST7_REGNUM
)], regs
.pr_fpu
.fpu_stack
[7], 10);
103 /* FIXME: This should be merged with i387-tdep.c as well. */
114 printf_unfiltered("80387:");
115 if (ep
.pr_fpu
.fpu_ip
== 0) {
116 printf_unfiltered(" not in use.\n");
119 printf_unfiltered("\n");
121 if (ep
.pr_fpu
.fpu_status
!= 0) {
122 print_387_status_word (ep
.pr_fpu
.fpu_status
);
124 print_387_control_word (ep
.pr_fpu
.fpu_control
);
125 printf_unfiltered ("last exception: ");
126 printf_unfiltered ("opcode 0x%x; ", ep
.pr_fpu
.fpu_rsvd4
);
127 printf_unfiltered ("pc 0x%x:0x%x; ", ep
.pr_fpu
.fpu_cs
, ep
.pr_fpu
.fpu_ip
);
128 printf_unfiltered ("operand 0x%x:0x%x\n", ep
.pr_fpu
.fpu_data_offset
, ep
.pr_fpu
.fpu_op_sel
);
130 top
= (ep
.pr_fpu
.fpu_status
>> 11) & 7;
132 printf_unfiltered ("regno tag msb lsb value\n");
133 for (fpreg
= 7; fpreg
>= 0; fpreg
--)
137 printf_unfiltered ("%s %d: ", fpreg
== top
? "=>" : " ", fpreg
);
139 switch ((ep
.pr_fpu
.fpu_tag
>> (fpreg
* 2)) & 3)
141 case 0: printf_unfiltered ("valid "); break;
142 case 1: printf_unfiltered ("zero "); break;
143 case 2: printf_unfiltered ("trap "); break;
144 case 3: printf_unfiltered ("empty "); break;
146 for (i
= 9; i
>= 0; i
--)
147 printf_unfiltered ("%02x", ep
.pr_fpu
.fpu_stack
[fpreg
][i
]);
149 i387_to_double (ep
.pr_fpu
.fpu_stack
[fpreg
], (char *)&val
);
150 printf_unfiltered (" %g\n", val
);
152 if (ep
.pr_fpu
.fpu_rsvd1
)
153 warning ("rsvd1 is 0x%x\n", ep
.pr_fpu
.fpu_rsvd1
);
154 if (ep
.pr_fpu
.fpu_rsvd2
)
155 warning ("rsvd2 is 0x%x\n", ep
.pr_fpu
.fpu_rsvd2
);
156 if (ep
.pr_fpu
.fpu_rsvd3
)
157 warning ("rsvd3 is 0x%x\n", ep
.pr_fpu
.fpu_rsvd3
);
158 if (ep
.pr_fpu
.fpu_rsvd5
)
159 warning ("rsvd5 is 0x%x\n", ep
.pr_fpu
.fpu_rsvd5
);
163 print_1167_control_word(pcr
)
169 pcr_tmp
= pcr
& FPA_PCR_MODE
;
170 printf_unfiltered("\tMODE= %#x; RND= %#x ", pcr_tmp
, pcr_tmp
& 12);
171 switch (pcr_tmp
& 12) {
173 printf_unfiltered("RN (Nearest Value)");
176 printf_unfiltered("RZ (Zero)");
179 printf_unfiltered("RP (Positive Infinity)");
182 printf_unfiltered("RM (Negative Infinity)");
185 printf_unfiltered("; IRND= %d ", pcr_tmp
& 2);
186 if (0 == pcr_tmp
& 2) {
187 printf_unfiltered("(same as RND)\n");
189 printf_unfiltered("(toward zero)\n");
191 pcr_tmp
= pcr
& FPA_PCR_EM
;
192 printf_unfiltered("\tEM= %#x", pcr_tmp
);
193 if (pcr_tmp
& FPA_PCR_EM_DM
) printf_unfiltered(" DM");
194 if (pcr_tmp
& FPA_PCR_EM_UOM
) printf_unfiltered(" UOM");
195 if (pcr_tmp
& FPA_PCR_EM_PM
) printf_unfiltered(" PM");
196 if (pcr_tmp
& FPA_PCR_EM_UM
) printf_unfiltered(" UM");
197 if (pcr_tmp
& FPA_PCR_EM_OM
) printf_unfiltered(" OM");
198 if (pcr_tmp
& FPA_PCR_EM_ZM
) printf_unfiltered(" ZM");
199 if (pcr_tmp
& FPA_PCR_EM_IM
) printf_unfiltered(" IM");
200 printf_unfiltered("\n");
201 pcr_tmp
= FPA_PCR_CC
;
202 printf_unfiltered("\tCC= %#x", pcr_tmp
);
203 if (pcr_tmp
& FPA_PCR_20MHZ
) printf_unfiltered(" 20MHZ");
204 if (pcr_tmp
& FPA_PCR_CC_Z
) printf_unfiltered(" Z");
205 if (pcr_tmp
& FPA_PCR_CC_C2
) printf_unfiltered(" C2");
206 if (pcr_tmp
& FPA_PCR_CC_C1
) printf_unfiltered(" C1");
209 printf_unfiltered(" (Equal)");
212 printf_unfiltered(" (Less than)");
215 printf_unfiltered(" (Greater than)");
217 case FPA_PCR_CC_Z
| FPA_PCR_CC_C1
| FPA_PCR_CC_C2
:
218 printf_unfiltered(" (Unordered)");
221 printf_unfiltered(" (Undefined)");
224 printf_unfiltered("\n");
225 pcr_tmp
= pcr
& FPA_PCR_AE
;
226 printf_unfiltered("\tAE= %#x", pcr_tmp
);
227 if (pcr_tmp
& FPA_PCR_AE_DE
) printf_unfiltered(" DE");
228 if (pcr_tmp
& FPA_PCR_AE_UOE
) printf_unfiltered(" UOE");
229 if (pcr_tmp
& FPA_PCR_AE_PE
) printf_unfiltered(" PE");
230 if (pcr_tmp
& FPA_PCR_AE_UE
) printf_unfiltered(" UE");
231 if (pcr_tmp
& FPA_PCR_AE_OE
) printf_unfiltered(" OE");
232 if (pcr_tmp
& FPA_PCR_AE_ZE
) printf_unfiltered(" ZE");
233 if (pcr_tmp
& FPA_PCR_AE_EE
) printf_unfiltered(" EE");
234 if (pcr_tmp
& FPA_PCR_AE_IE
) printf_unfiltered(" IE");
235 printf_unfiltered("\n");
238 print_1167_regs(regs
)
239 long regs
[FPA_NREGS
];
254 for (i
= 0; i
< FPA_NREGS
; i
++) {
256 printf_unfiltered("%%fp%d: raw= %#x, single= %f", i
+1, regs
[i
], xf
.f
);
258 printf_unfiltered("\n");
262 printf_unfiltered(", double= %f\n", xd
.d
);
272 printf_unfiltered("WTL 1167:");
273 if (ep
.pr_fpa
.fpa_pcr
!=0) {
274 printf_unfiltered("\n");
275 print_1167_control_word(ep
.pr_fpa
.fpa_pcr
);
276 print_1167_regs(ep
.pr_fpa
.fpa_regs
);
278 printf_unfiltered(" not in use.\n");
284 char ubuf
[UPAGES
*NBPG
];
285 struct pt_regset regset
;
287 if (have_inferior_p())
289 PTRACE_READ_REGS (inferior_pid
, (PTRACE_ARG3_TYPE
) ®set
);
293 int corechan
= bfd_cache_lookup (core_bfd
);
294 if (lseek (corechan
, 0, 0) < 0)
296 perror ("seek on core file");
298 if (myread (corechan
, ubuf
, UPAGES
*NBPG
) < 0)
300 perror ("read on core file");
302 /* only interested in the floating point registers */
303 regset
.pr_fpu
= ((struct user
*) ubuf
)->u_fpusave
;
304 regset
.pr_fpa
= ((struct user
*) ubuf
)->u_fpasave
;
306 print_fpu_status(regset
);
307 print_fpa_status(regset
);
This page took 0.054329 seconds and 4 git commands to generate.