Re: [RFA] x86-64 segment registers handling

Michal Ludvig
2002-03-26T18:27:11Z

[-- Attachment #1: Type: text/plain, Size: 461 bytes --]

Daniel Jacobowitz wrote:
> Can you update gdbserver/linux-x86-64-low.c with these changes, please?
>
> Also, it appears that you changed the layout of GDB's register cache
> for x86-64. At this time that means you also changed the remote
> protocol. regformats/reg-x86-64.dat also needs to be updated.

Patch appended. Are these changes enough? Can I commit?
Michal Ludvig
--
* SuSE CR, s.r.o * mludvig@suse.cz
* +420 2 9654 5373 * http://www.suse.cz

[-- Attachment #2: x8664-06.diff --]
[-- Type: text/plain, Size: 1932 bytes --]

Index: gdbserver/linux-x86-64-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-x86-64-low.c,v
retrieving revision 1.2
diff -c -3 -p -r1.2 linux-x86-64-low.c
*** linux-x86-64-low.c 2002/03/04 16:28:35 1.2
--- linux-x86-64-low.c 2002/03/26 18:25:09
***************
*** 28,39 ****
#include <sys/procfs.h>
#include <sys/ptrace.h>

! static int regmap[] = {
RAX, RDX, RCX, RBX,
RSI, RDI, RBP, RSP,
R8, R9, R10, R11,
R12, R13, R14, R15,
! RIP, EFLAGS
};

static void
--- 28,42 ----
#include <sys/procfs.h>
#include <sys/ptrace.h>

! #define X86_64_NUM_GREGS 22
!
! static int regmap[X86_64_NUM_GREGS] = {
RAX, RDX, RCX, RBX,
RSI, RDI, RBP, RSP,
R8, R9, R10, R11,
R12, R13, R14, R15,
! RIP, EFLAGS,
! DS, ES, FS, GS
};

static void
*************** x86_64_fill_gregset (void *buf)
*** 41,47 ****
{
int i;

! for (i = 0; i < 18; i++)
collect_register (i, ((char *) buf) + regmap[i]);
}

--- 44,50 ----
{
int i;

! for (i = 0; i < X86_64_NUM_GREGS; i++)
collect_register (i, ((char *) buf) + regmap[i]);
}

*************** x86_64_store_gregset (void *buf)
*** 50,56 ****
{
int i;

! for (i = 0; i < 18; i++)
supply_register (i, ((char *) buf) + regmap[i]);
}

--- 53,59 ----
{
int i;

! for (i = 0; i < X86_64_NUM_GREGS; i++)
supply_register (i, ((char *) buf) + regmap[i]);
}

Index: regformats/reg-x86-64.dat
===================================================================
RCS file: /cvs/src/src/gdb/regformats/reg-x86-64.dat,v
retrieving revision 1.1
diff -c -3 -p -r1.1 reg-x86-64.dat
*** reg-x86-64.dat 2002/02/27 07:07:49 1.1
--- reg-x86-64.dat 2002/03/26 18:25:09
*************** expedite:rbp,rsp,rip
*** 18,23 ****
--- 18,27 ----
64:r15
64:rip
32:eflags
+ 32:ds
+ 32:es
+ 32:fs
+ 32:gs
80:st0
80:st1
80:st2