summaryrefslogtreecommitdiff
path: root/gdb/i386-tdep.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2003-10-05 21:31:33 +0000
committerMark Kettenis <kettenis@gnu.org>2003-10-05 21:31:33 +0000
commit9d1b72a8f0db7a88dadf337975db3a229d7a7e37 (patch)
tree7fb984d58f8ba37626763aa26d79489da8bc7ec6 /gdb/i386-tdep.c
parente9548f01b60f398149636bc4e9944f8c31028fca (diff)
downloadgdb-9d1b72a8f0db7a88dadf337975db3a229d7a7e37.tar.gz
* i386-tdep.h (struct gdbarch_tdep): Add members gregset,
gregset_reg_offset, gregset_num_regs, sizeof_gregset, fpregset, sizeof_fpregset. * i386-tdep.c: Include "regset.h". (i386_supply_gregset): New function. (i386_supply_fpregset): New function. (i386_gdbarch_init): Initialze register set-related members of TDEP. * x86-64-tdep.c (x86_64_supply_fpregset): New function. (x86_64_init_abi): Initialize TDEP->sizeof_fpregset.
Diffstat (limited to 'gdb/i386-tdep.c')
-rw-r--r--gdb/i386-tdep.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index d3e33576cd6..27f3d272e5c 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -37,6 +37,7 @@
#include "osabi.h"
#include "regcache.h"
#include "reggroups.h"
+#include "regset.h"
#include "symfile.h"
#include "symtab.h"
#include "target.h"
@@ -1548,7 +1549,42 @@ i386_value_to_register (struct frame_info *frame, int regnum,
}
}
+/* Supply register REGNUM from the general-purpose register set REGSET
+ to register cache REGCACHE. If REGNUM is -1, do this for all
+ registers in REGSET. */
+static void
+i386_supply_gregset (const struct regset *regset, struct regcache *regcache,
+ int regnum, const void *gregs, size_t len)
+{
+ const struct gdbarch_tdep *tdep = regset->descr;
+ const char *regs = gregs;
+ int i;
+
+ gdb_assert (len == tdep->sizeof_gregset);
+
+ for (i = 0; i < tdep->gregset_num_regs; i++)
+ {
+ if ((regnum == i || regnum == -1)
+ && tdep->gregset_reg_offset[i] != -1)
+ regcache_raw_supply (regcache, i, regs + tdep->gregset_reg_offset[i]);
+ }
+}
+
+/* Supply register REGNUM from the floating-point register set REGSET
+ to register cache REGCACHE. If REGNUM is -1, do this for all
+ registers in REGSET. */
+
+static void
+i386_supply_fpregset (const struct regset *regset, struct regcache *regcache,
+ int regnum, const void *fpregs, size_t len)
+{
+ const struct gdbarch_tdep *tdep = regset->descr;
+
+ gdb_assert (len == tdep->sizeof_fpregset);
+ i387_supply_fsave (regcache, regnum, fpregs);
+}
+
#ifdef STATIC_TRANSFORM_NAME
/* SunPRO encodes the static variables. This is not related to C++
@@ -1803,6 +1839,16 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep = XMALLOC (struct gdbarch_tdep);
gdbarch = gdbarch_alloc (&info, tdep);
+ /* General-purpose registers. */
+ tdep->gregset = NULL;
+ tdep->gregset_reg_offset = NULL;
+ tdep->gregset_num_regs = I386_NUM_GREGS;
+ tdep->sizeof_gregset = 0;
+
+ /* Floating-point registers. */
+ tdep->fpregset = NULL;
+ tdep->sizeof_fpregset = I387_SIZEOF_FSAVE;
+
/* The default settings include the FPU registers, the MMX registers
and the SSE registers. This can be overidden for a specific ABI
by adjusting the members `st0_regnum', `mm0_regnum' and