+2003-09-28 Mark Kettenis <kettenis@gnu.org>
+
+ * i387-tdep.c (i387_supply_fsave, i387_supply_fxsave): Add
+ regcache argument and reverse the order of the other two
+ arguments. Remove local regcache variable. Determine
+ architecture from REGCACHE. Update comments.
+ * x86-64-tdep.c (x86_64_supply_fxsave): Add regcache argument and
+ reverse the order of the other two arguments. Remove local
+ regcache variable. Determine architecture from REGCACHE. Update
+ comments.
+ * i387-tdep.h (i387_supply_fsave, i387_supply_fxsave): Adjust
+ prototypes. Update comments.
+ * x86-64-tdep.c (x86_64_supply_fxsave): Adjust prototype. Adjust
+ comment.
+ * amd64fbsd-nat.c (supply_fpregset, fetch_inferior_registers):
+ Update.
+ * go32-nat.c (fetch_register, go32_fetch_registers): Update.
+ * i386-interix-nat.c (supply_fpregset): Update.
+ * i386-linux-nat.c (supply_fpregset, supply_fpxregset): Update.
+ * i386-nto-tdep.c (i386nto_supply_fpregset): Update.
+ * i386gnu-nat.c (fetch_fpregs, supply_fpregset): Update.
+ * i386bsd-nat.c (supply_fpregset, fetch_inferior_registers): Update.
+ * i386nbsd-tdep.c (fetch_core_registers, fetch_elfcore_registers):
+ Update.
+ * i386obsd-tdep.c (fetch_core_registers): Update.
+ * i386v4-nat.c (supply_fpregset): Update.
+ * x86-64-linux-nat.c (supply_fpregset): Update.
+ * x86-64-linux-tdep.c (fetch_core_registers): Update.
+
2003-09-27 Mark Kettenis <kettenis@gnu.org>
* i386-tdep.h: Put opaque declarations in alphabetical
void
supply_fpregset (fpregset_t *fpregsetp)
{
- x86_64_supply_fxsave ((const char *) fpregsetp, -1);
+ x86_64_supply_fxsave (current_regcache, -1, fpregsetp);
}
/* Fill register REGNUM (if it is a floating-point register) in
(PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
perror_with_name ("Couldn't get floating point status");
- x86_64_supply_fxsave ((const char *) &fpregs, -1);
+ x86_64_supply_fxsave (current_regcache, -1, &fpregs);
}
}
if (regno < FP0_REGNUM)
supply_register (regno, (char *) &a_tss + regno_mapping[regno].tss_ofs);
else if (i386_fp_regnum_p (regno) || i386_fpc_regnum_p (regno))
- i387_supply_fsave ((const char *) &npx, regno);
+ i387_supply_fsave (current_regcache, regno, &npx);
else
internal_error (__FILE__, __LINE__,
"Invalid register no. %d in fetch_register.", regno);
{
for (regno = 0; regno < FP0_REGNUM; regno++)
fetch_register (regno);
- i387_supply_fsave ((const char *) &npx, -1);
+ i387_supply_fsave (current_regcache, -1, &npx);
}
}
void
supply_fpregset (fpregset_t *fpregsetp)
{
- i387_supply_fsave ((const char *) fpregsetp, -1);
+ i387_supply_fsave (current_regcache, -1, fpregsetp);
}
/* Given a pointer to a floating point register set in (fpregset_t *)
void
supply_fpregset (elf_fpregset_t *fpregsetp)
{
- i387_supply_fsave ((const char *) fpregsetp, -1);
+ i387_supply_fsave (current_regcache, -1, fpregsetp);
dummy_sse_values ();
}
void
supply_fpxregset (elf_fpxregset_t *fpxregsetp)
{
- i387_supply_fxsave ((const char *) fpxregsetp, -1);
+ i387_supply_fxsave (current_regcache, -1, fpxregsetp);
}
/* Fill register REGNO (if it is a floating-point or SSE register) in
i386nto_supply_fpregset (char *fpregs)
{
if (nto_cpuinfo_valid && nto_cpuinfo_flags | X86_CPU_FXSR)
- i387_supply_fxsave (fpregs, -1);
+ i387_supply_fxsave (current_regcache, -1, fpregs);
else
- i387_supply_fsave (fpregs, -1);
+ i387_supply_fsave (current_regcache, -1, fpregs);
}
static void
void
supply_fpregset (fpregset_t *fpregsetp)
{
- i387_supply_fsave ((const char *) fpregsetp, -1);
+ i387_supply_fsave (current_regcache, -1, fpregsetp);
}
/* Fill register REGNO (if it is a floating-point register) in
(PTRACE_ARG3_TYPE) xmmregs, 0) == 0)
{
have_ptrace_xmmregs = 1;
- i387_supply_fxsave (xmmregs, -1);
+ i387_supply_fxsave (current_regcache, -1, xmmregs);
}
else
{
(PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
perror_with_name ("Couldn't get floating point status");
- i387_supply_fsave ((const char *) &fpregs, -1);
+ i387_supply_fsave (current_regcache, -1, &fpregs);
}
#else
if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
(PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
perror_with_name ("Couldn't get floating point status");
- i387_supply_fsave ((const char *) &fpregs, -1);
+ i387_supply_fsave (current_regcache, -1, &fpregs);
#endif
}
}
}
/* Supply the floating-point registers. */
- i387_supply_fsave (state.hw_state, -1);
+ i387_supply_fsave (current_regcache, -1, state.hw_state);
}
#ifdef HAVE_SYS_PROCFS_H
void
supply_fpregset (gdb_fpregset_t *fpregs)
{
- i387_supply_fsave ((const char *) fpregs, -1);
+ i387_supply_fsave (current_regcache, -1, fpregs);
}
#endif
i386nbsd_supply_reg (regs, -1);
/* Floating point registers. */
- i387_supply_fsave (fsave, -1);
+ i387_supply_fsave (current_regcache, -1, fsave);
}
static void
if (core_reg_size != 108)
warning ("Wrong size FP register set in core file.");
else
- i387_supply_fsave (core_reg_sect, -1);
+ i387_supply_fsave (current_regcache, -1, core_reg_sect);
break;
case 3: /* "Extended" floating point registers. This is gdb-speak
if (core_reg_size != 512)
warning ("Wrong size XMM register set in core file.");
else
- i387_supply_fxsave (core_reg_sect, -1);
+ i387_supply_fxsave (current_regcache, -1, core_reg_sect);
break;
default:
i386obsd_supply_reg (regs, -1);
/* Floating point registers. */
- i387_supply_fsave (fsave, -1);
+ i387_supply_fsave (current_regcache, -1, fsave);
}
static struct core_fns i386obsd_core_fns =
if (FP0_REGNUM == 0)
return;
- i387_supply_fsave ((const char *) fpregsetp, -1);
+ i387_supply_fsave (current_regcache, -1, fpregsetp);
}
/* Fill register REGNO (if it is a floating-point register) in
(fsave + fsave_offset[regnum - I387_ST0_REGNUM])
\f
-/* Fill register REGNUM in GDB's register cache with the appropriate
- value from *FSAVE. This function masks off any of the reserved
- bits in *FSAVE. */
+/* Fill register REGNUM in REGCACHE with the appropriate value from
+ *FSAVE. This function masks off any of the reserved bits in
+ *FSAVE. */
void
-i387_supply_fsave (const void *fsave, int regnum)
+i387_supply_fsave (struct regcache *regcache, int regnum, const void *fsave)
{
- struct regcache *regcache = current_regcache;
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
const char *regs = fsave;
int i;
static int i387_tag (const unsigned char *raw);
\f
-/* Fill register REGNUM in GDB's register cache with the appropriate
+/* Fill register REGNUM in REGCACHE with the appropriate
floating-point or SSE register value from *FXSAVE. This function
masks off any of the reserved bits in *FXSAVE. */
void
-i387_supply_fxsave (const void *fxsave, int regnum)
+i387_supply_fxsave (struct regcache *regcache, int regnum, const void *fxsave)
{
- struct regcache *regcache = current_regcache;
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
const char *regs = fxsave;
int i;
#define I387_TDEP_H
struct gdbarch;
-struct ui_file;
struct frame_info;
+struct regcache;
struct type;
+struct ui_file;
/* Because the number of general-purpose registers is different for
AMD64, the floating-point registers and SSE registers get shifted.
#define I387_SIZEOF_FSAVE 108
#define I387_SIZEOF_FXSAVE 512
-/* Fill register REGNUM in GDB's register cache with the appropriate
- value from *FSAVE. This function masks off any of the reserved
- bits in *FSAVE. */
+/* Fill register REGNUM in REGCACHE with the appropriate value from
+ *FSAVE. This function masks off any of the reserved bits in
+ *FSAVE. */
-extern void i387_supply_fsave (const void *fsave, int regnum);
+extern void i387_supply_fsave (struct regcache *regcache, int regnum,
+ const void *fsave);
/* Fill register REGNUM (if it is a floating-point register) in *FSAVE
with the value in GDB's register cache. If REGNUM is -1, do this
extern void i387_fill_fsave (void *fsave, int regnum);
-/* Fill register REGNUM in GDB's register cache with the appropriate
+/* Fill register REGNUM in REGCACHE with the appropriate
floating-point or SSE register value from *FXSAVE. This function
masks off any of the reserved bits in *FXSAVE. */
-extern void i387_supply_fxsave (const void *fxsave, int regnum);
+extern void i387_supply_fxsave (struct regcache *regcache, int regnum,
+ const void *fxsave);
/* Fill register REGNUM (if it is a floating-point or SSE register) in
*FXSAVE with the value in GDB's register cache. If REGNUM is -1, do
void
supply_fpregset (elf_fpregset_t *fpregsetp)
{
- x86_64_supply_fxsave ((const char *) fpregsetp, -1);
+ x86_64_supply_fxsave (current_regcache, -1, fpregsetp);
}
/* Fill register REGNUM (if it is a floating-point or SSE register) in
if (core_reg_size != 512)
warning ("Wrong size XMM register set in core file.");
else
- x86_64_supply_fxsave (core_reg_sect, -1);
+ x86_64_supply_fxsave (current_regcache, -1, core_reg_sect);
break;
default:
bits of these pointers (instead of just the 16-bits of the segment
selector). */
-/* Fill register REGNUM in GDB's register cache with the appropriate
+/* The 64-bit FXSAVE format differs from the 32-bit format in the
+ sense that the instruction pointer and data pointer are simply
+ 64-bit offsets into the code segment and the data segment instead
+ of a selector offset pair. The functions below store the upper 32
+ bits of these pointers (instead of just the 16-bits of the segment
+ selector). */
+
+/* Fill register REGNUM in REGCACHE with the appropriate
floating-point or SSE register value from *FXSAVE. If REGNUM is
-1, do this for all registers. This function masks off any of the
reserved bits in *FXSAVE. */
void
-x86_64_supply_fxsave (const char *fxsave, int regnum)
+x86_64_supply_fxsave (struct regcache *regcache, int regnum,
+ const void *fxsave)
{
- i387_supply_fxsave (fxsave, regnum);
+ i387_supply_fxsave (regcache, regnum, fxsave);
if (fxsave)
{
+ const char *regs = fxsave;
+
if (regnum == -1 || regnum == I387_FISEG_REGNUM)
- supply_register (I387_FISEG_REGNUM, fxsave + 12);
+ regcache_raw_supply (regcache, I387_FISEG_REGNUM, regs + 12);
if (regnum == -1 || regnum == I387_FOSEG_REGNUM)
- supply_register (I387_FOSEG_REGNUM, fxsave + 20);
+ regcache_raw_supply (regcache, I387_FOSEG_REGNUM, regs + 20);
}
}
void x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch);
-/* Fill register REGNUM in GDB's register cache with the appropriate
+/* Fill register REGNUM in REGCACHE with the appropriate
floating-point or SSE register value from *FXSAVE. If REGNUM is
-1, do this for all registers. This function masks off any of the
reserved bits in *FXSAVE. */
-void x86_64_supply_fxsave (const char *fxsave, int regnum);
+extern void x86_64_supply_fxsave (struct regcache *regcache, int regnum,
+ const void *fxsave);
/* Fill register REGNUM (if it is a floating-point or SSE register) in
*FXSAVE with the value in GDB's register cache. If REGNUM is -1, do