/* Native-dependent code for NetBSD/i386, for GDB.
- Copyright 1988, 1989, 1991, 1992, 1994, 1996, 2000
+ Copyright 1988, 1989, 1991, 1992, 1994, 1996, 2000, 2001
Free Software Foundation, Inc.
This file is part of GDB.
#include <machine/frame.h>
#include "inferior.h"
#include "gdbcore.h" /* for registers_fetched() */
+#include "regcache.h"
#define RF(dst, src) \
memcpy(®isters[REGISTER_BYTE(dst)], &src, sizeof(src))
};
void
-fetch_inferior_registers (regno)
- int regno;
+fetch_inferior_registers (int regno)
{
struct reg inferior_registers;
struct env387 inferior_fpregisters;
- ptrace (PT_GETREGS, inferior_pid,
+ ptrace (PT_GETREGS, PIDGET (inferior_ptid),
(PTRACE_ARG3_TYPE) &inferior_registers, 0);
- ptrace (PT_GETFPREGS, inferior_pid,
+ ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
(PTRACE_ARG3_TYPE) &inferior_fpregisters, 0);
RF ( 0, inferior_registers.r_eax);
}
void
-store_inferior_registers (regno)
- int regno;
+store_inferior_registers (int regno)
{
struct reg inferior_registers;
struct env387 inferior_fpregisters;
RS (FDOFF_REGNUM, inferior_fpregisters.operand);
RS (FOP_REGNUM, inferior_fpregisters.opcode);
- ptrace (PT_SETREGS, inferior_pid,
+ ptrace (PT_SETREGS, PIDGET (inferior_ptid),
(PTRACE_ARG3_TYPE) &inferior_registers, 0);
- ptrace (PT_SETFPREGS, inferior_pid,
+ ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
(PTRACE_ARG3_TYPE) &inferior_fpregisters, 0);
}
-
+\f
struct md_core
{
struct reg intreg;
- struct fpreg freg;
+ struct env387 freg;
};
-void
-fetch_core_registers (core_reg_sect, core_reg_size, which, ignore)
- char *core_reg_sect;
- unsigned core_reg_size;
- int which;
- CORE_ADDR ignore;
+static void
+fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
+ CORE_ADDR ignore)
{
struct md_core *core_reg = (struct md_core *) core_reg_sect;
/* integer registers */
memcpy (®isters[REGISTER_BYTE (0)], &core_reg->intreg,
sizeof (struct reg));
+
/* floating point registers */
- /* XXX */
+ RF (FP0_REGNUM, core_reg->freg.regs[0]);
+ RF (FP0_REGNUM + 1, core_reg->freg.regs[1]);
+ RF (FP0_REGNUM + 2, core_reg->freg.regs[2]);
+ RF (FP0_REGNUM + 3, core_reg->freg.regs[3]);
+ RF (FP0_REGNUM + 4, core_reg->freg.regs[4]);
+ RF (FP0_REGNUM + 5, core_reg->freg.regs[5]);
+ RF (FP0_REGNUM + 6, core_reg->freg.regs[6]);
+ RF (FP0_REGNUM + 7, core_reg->freg.regs[7]);
+
+ RF (FCTRL_REGNUM, core_reg->freg.control);
+ RF (FSTAT_REGNUM, core_reg->freg.status);
+ RF (FTAG_REGNUM, core_reg->freg.tag);
+ RF (FCS_REGNUM, core_reg->freg.code_seg);
+ RF (FCOFF_REGNUM, core_reg->freg.eip);
+ RF (FDS_REGNUM, core_reg->freg.operand_seg);
+ RF (FDOFF_REGNUM, core_reg->freg.operand);
+ RF (FOP_REGNUM, core_reg->freg.opcode);
+
+ registers_fetched ();
+}
+
+/* Register that we are able to handle i386nbsd core file formats.
+ FIXME: is this really bfd_target_unknown_flavour? */
+
+static struct core_fns i386nbsd_core_fns =
+{
+ bfd_target_unknown_flavour, /* core_flavour */
+ default_check_format, /* check_format */
+ default_core_sniffer, /* core_sniffer */
+ fetch_core_registers, /* core_read_registers */
+ NULL /* next */
+};
+
+void
+_initialize_i386nbsd_nat (void)
+{
+ add_core_fns (&i386nbsd_core_fns);
}