/* Sequent Symmetry host interface, for GDB when running under Unix.
- Copyright (C) 1986, 1987, 1989, 1991 Free Software Foundation, Inc.
+ Copyright 1986, 1987, 1989, 1991, 1992 Free Software Foundation, Inc.
This file is part of GDB.
-GDB is free software; you can redistribute it and/or modify
+This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 1, or (at your option)
-any later version.
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
-GDB is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-/* many 387-specific items of use taken from i386-dep.c */
+/* FIXME, some 387-specific items of use taken from i387-tdep.c -- ought to be
+ merged back in. */
-#include <stdio.h>
#include "defs.h"
-#include "param.h"
#include "frame.h"
#include "inferior.h"
#include "symtab.h"
#include <sys/stat.h>
#include "gdbcore.h"
#include <fcntl.h>
-
-static long i386_get_frame_setup ();
-static i386_follow_jump ();
-
#include <sgtty.h>
#define TERMINAL struct sgttyb
+#include "gdbcore.h"
+
+void
store_inferior_registers(regno)
int regno;
{
else
{
reg_tmp = *(int *)®isters[REGISTER_BYTE(regno)];
- ptrace(XPT_RREGS, inferior_pid, ®s, 0);
+ ptrace(XPT_RREGS, inferior_pid, (PTRACE_ARG3_TYPE) ®s, 0);
switch (regno)
{
case 0:
}
}
#endif /* 0 */
- ptrace(XPT_WREGS, inferior_pid, ®s, 0);
+ ptrace(XPT_WREGS, inferior_pid, (PTRACE_ARG3_TYPE) ®s, 0);
}
void
-fetch_inferior_registers()
+fetch_inferior_registers (regno)
+ int regno;
{
int i;
struct pt_regset regs;
registers_fetched ();
- ptrace(XPT_RREGS, inferior_pid, ®s, 0);
+ ptrace(XPT_RREGS, inferior_pid, (PTRACE_ARG3_TYPE) ®s, 0);
*(int *)®isters[REGISTER_BYTE(0)] = regs.pr_eax;
*(int *)®isters[REGISTER_BYTE(5)] = regs.pr_ebx;
*(int *)®isters[REGISTER_BYTE(2)] = regs.pr_ecx;
/* Work with core dump and executable files, for GDB.
This code would be in core.c if it weren't machine-dependent. */
-#include "gdbcore.h"
-
void
core_file_command (filename, from_tty)
char *filename;
corefile = savestring (filename, strlen (filename));
else
{
- corefile = concat (current_directory, "/", filename);
+ corefile = concat (current_directory, "/", filename, NULL);
}
set_current_frame(create_new_frame(read_register(FP_REGNUM),
printf ("No core file now.\n");
}
-/* from i386-dep.c */
-static
-print_387_control_word (control)
-unsigned short control;
-{
- printf ("control 0x%04x: ", control);
- printf ("compute to ");
- switch ((control >> 8) & 3)
- {
- case 0: printf ("24 bits; "); break;
- case 1: printf ("(bad); "); break;
- case 2: printf ("53 bits; "); break;
- case 3: printf ("64 bits; "); break;
- }
- printf ("round ");
- switch ((control >> 10) & 3)
- {
- case 0: printf ("NEAREST; "); break;
- case 1: printf ("DOWN; "); break;
- case 2: printf ("UP; "); break;
- case 3: printf ("CHOP; "); break;
- }
- if (control & 0x3f)
- {
- printf ("mask:");
- if (control & 0x0001) printf (" INVALID");
- if (control & 0x0002) printf (" DENORM");
- if (control & 0x0004) printf (" DIVZ");
- if (control & 0x0008) printf (" OVERF");
- if (control & 0x0010) printf (" UNDERF");
- if (control & 0x0020) printf (" LOS");
- printf (";");
- }
- printf ("\n");
- if (control & 0xe080) printf ("warning: reserved bits on 0x%x\n",
- control & 0xe080);
-}
-
-static
-print_387_status_word (status)
- unsigned short status;
-{
- printf ("status %#04x: ", status);
- if (status & 0xff) {
- printf ("exceptions:"); /* exception names match <machine/fpu.h> */
- if (status & 0x0001) printf (" FLTINV");
- if (status & 0x0002) printf (" FLTDEN");
- if (status & 0x0004) printf (" FLTDIV");
- if (status & 0x0008) printf (" FLTOVF");
- if (status & 0x0010) printf (" FLTUND");
- if (status & 0x0020) printf (" FLTPRE");
- if (status & 0x0040) printf (" FLTSTK");
- printf ("; ");
- }
- printf ("flags: %d%d%d%d; ",
- (status & 0x4000) != 0,
- (status & 0x0400) != 0,
- (status & 0x0200) != 0,
- (status & 0x0100) != 0);
-
- printf ("top %d\n", (status >> 11) & 7);
-}
-
+/* FIXME: This should be merged with i387-tdep.c as well. */
static
print_fpu_status(ep)
struct pt_regset ep;
-
{
int i;
int bothstatus;
printf (" %g\n", val);
}
if (ep.pr_fpu.fpu_rsvd1)
- printf ("warning: rsvd1 is 0x%x\n", ep.pr_fpu.fpu_rsvd1);
+ warning ("rsvd1 is 0x%x\n", ep.pr_fpu.fpu_rsvd1);
if (ep.pr_fpu.fpu_rsvd2)
- printf ("warning: rsvd2 is 0x%x\n", ep.pr_fpu.fpu_rsvd2);
+ warning ("rsvd2 is 0x%x\n", ep.pr_fpu.fpu_rsvd2);
if (ep.pr_fpu.fpu_rsvd3)
- printf ("warning: rsvd3 is 0x%x\n", ep.pr_fpu.fpu_rsvd3);
+ warning ("rsvd3 is 0x%x\n", ep.pr_fpu.fpu_rsvd3);
if (ep.pr_fpu.fpu_rsvd5)
- printf ("warning: rsvd5 is 0x%x\n", ep.pr_fpu.fpu_rsvd5);
+ warning ("rsvd5 is 0x%x\n", ep.pr_fpu.fpu_rsvd5);
}
}
i386_float_info ()
-
{
char ubuf[UPAGES*NBPG];
struct pt_regset regset;
extern int corechan;
if (have_inferior_p()) {
- call_ptrace(XPT_RREGS, inferior_pid, ®set, 0);
+ call_ptrace(XPT_RREGS, inferior_pid, (PTRACE_ARG3_TYPE) ®set, 0);
} else {
if (lseek (corechan, 0, 0) < 0) {
perror ("seek on core file");
print_fpu_status(regset);
print_fpa_status(regset);
}
-
-i387_to_double (from, to)
- char *from;
- char *to;
-{
- long *lp;
- /* push extended mode on 387 stack, then pop in double mode
- *
- * first, set exception masks so no error is generated -
- * number will be rounded to inf or 0, if necessary
- */
- asm ("pushl %eax"); /* grab a stack slot */
- asm ("fstcw (%esp)"); /* get 387 control word */
- asm ("movl (%esp),%eax"); /* save old value */
- asm ("orl $0x3f,%eax"); /* mask all exceptions */
- asm ("pushl %eax");
- asm ("fldcw (%esp)"); /* load new value into 387 */
-
- asm ("movl 8(%ebp),%eax");
- asm ("fldt (%eax)"); /* push extended number on 387 stack */
- asm ("fwait");
- asm ("movl 12(%ebp),%eax");
- asm ("fstpl (%eax)"); /* pop double */
- asm ("fwait");
-
- asm ("popl %eax"); /* flush modified control word */
- asm ("fnclex"); /* clear exceptions */
- asm ("fldcw (%esp)"); /* restore original control word */
- asm ("popl %eax"); /* flush saved copy */
-}
-
-double_to_i387 (from, to)
- char *from;
- char *to;
-{
- /* push double mode on 387 stack, then pop in extended mode
- * no errors are possible because every 64-bit pattern
- * can be converted to an extended
- */
- asm ("movl 8(%ebp),%eax");
- asm ("fldl (%eax)");
- asm ("fwait");
- asm ("movl 12(%ebp),%eax");
- asm ("fstpt (%eax)");
- asm ("fwait");
-}