summaryrefslogtreecommitdiff
path: root/gdb/x86-64-tdep.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/x86-64-tdep.c')
-rw-r--r--gdb/x86-64-tdep.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/gdb/x86-64-tdep.c b/gdb/x86-64-tdep.c
index a2ae63189f4..e855503f2ba 100644
--- a/gdb/x86-64-tdep.c
+++ b/gdb/x86-64-tdep.c
@@ -144,7 +144,7 @@ x86_64_register_type (struct gdbarch *gdbarch, int regnum)
static int x86_64_dwarf_regmap[] =
{
/* General Purpose Registers RAX, RDX, RCX, RBX, RSI, RDI. */
- X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, 3, 2,
+ X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, 2, 1,
4, X86_64_RDI_REGNUM,
/* Frame Pointer Register RBP. */
@@ -172,7 +172,7 @@ static int x86_64_dwarf_regmap[] =
X86_64_XMM0_REGNUM + 14, X86_64_XMM0_REGNUM + 15,
/* Floating Point Registers 0-7. */
- X86_64_ST0_REGNUM + 0, X86_64_ST0_REGNUM + 1,
+ X86_64_ST0_REGNUM + 0, X86_64_ST0_REGNUM + 1,
X86_64_ST0_REGNUM + 2, X86_64_ST0_REGNUM + 3,
X86_64_ST0_REGNUM + 4, X86_64_ST0_REGNUM + 5,
X86_64_ST0_REGNUM + 6, X86_64_ST0_REGNUM + 7
@@ -613,6 +613,7 @@ x86_64_push_arguments (struct regcache *regcache, int nargs,
int stack_values_count = 0;
int *stack_values;
stack_values = alloca (nargs * sizeof (int));
+
for (i = 0; i < nargs; i++)
{
enum x86_64_reg_class class[MAX_CLASSES];
@@ -1195,6 +1196,14 @@ x86_64_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
return frame_id_build (fp + 16, frame_pc_unwind (next_frame));
}
+/* 16 byte align the SP per frame requirements. */
+
+static CORE_ADDR
+x86_64_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
+{
+ return sp & -(CORE_ADDR)16;
+}
+
void
x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
@@ -1238,6 +1247,8 @@ x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Call dummy code. */
set_gdbarch_push_dummy_call (gdbarch, x86_64_push_dummy_call);
+ set_gdbarch_frame_align (gdbarch, x86_64_frame_align);
+ set_gdbarch_frame_red_zone_size (gdbarch, 128);
set_gdbarch_convert_register_p (gdbarch, x86_64_convert_register_p);
set_gdbarch_register_to_value (gdbarch, i387_register_to_value);
@@ -1277,24 +1288,27 @@ x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
bits of these pointers (instead of just the 16-bits of the segment
selector). */
-/* Fill GDB's register array with the floating-point and SSE register
- values in *FXSAVE. This function masks off any of the reserved
- bits in *FXSAVE. */
+/* Fill register REGNUM in GDB's register cache 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 (char *fxsave)
+x86_64_supply_fxsave (const char *fxsave, int regnum)
{
- i387_supply_fxsave (fxsave);
+ i387_supply_fxsave (fxsave, regnum);
if (fxsave)
{
- supply_register (I387_FISEG_REGNUM, fxsave + 12);
+ if (regnum == -1 || regnum == I387_FISEG_REGNUM)
+ supply_register (I387_FISEG_REGNUM, fxsave + 12);
+ if (regnum == -1 || regnum == I387_FOSEG_REGNUM)
supply_register (I387_FOSEG_REGNUM, fxsave + 20);
}
}
/* Fill register REGNUM (if it is a floating-point or SSE register) in
- *FXSAVE with the value in GDB's register array. If REGNUM is -1, do
+ *FXSAVE with the value in GDB's register cache. If REGNUM is -1, do
this for all registers. This function doesn't touch any of the
reserved bits in *FXSAVE. */