diff options
author | Michal Ludvig <mludvig@suse.cz> | 2002-06-07 16:11:10 +0000 |
---|---|---|
committer | Michal Ludvig <mludvig@suse.cz> | 2002-06-07 16:11:10 +0000 |
commit | 8dda97708fa5c4537d670a063d4a1b9a2690f3b5 (patch) | |
tree | 1236ecda8d006fef66f60592ef4671c8dbb94476 /gdb/x86-64-linux-nat.c | |
parent | eb95bb9a4e738150793d5fdb094b3ebad025174a (diff) | |
download | gdb-8dda97708fa5c4537d670a063d4a1b9a2690f3b5.zip gdb-8dda97708fa5c4537d670a063d4a1b9a2690f3b5.tar.gz gdb-8dda97708fa5c4537d670a063d4a1b9a2690f3b5.tar.bz2 |
2002-06-07 Michal Ludvig <mludvig@suse.cz>
* x86-64-linux-nat.c (x86_64_fxsave_offset): New.
(supply_fpregset, fill_fpregset): Don't call i387_*_fxsave,
better do the things actually here.
* x86-64-tdep.c (x86_64_register_name2nr): New.
(x86_64_register_name): Renamed to x86_64_register_nr2name.
(x86_64_gdbarch_init): Respect the above change.
* x86-64-tdep.h (x86_64_register_name2nr)
(x86_64_register_nr2name): Add prototypes.
* config/i386/x86-64linux.mt (TDEPFILES): Remove i387-tdep.o.
Diffstat (limited to 'gdb/x86-64-linux-nat.c')
-rw-r--r-- | gdb/x86-64-linux-nat.c | 69 |
1 files changed, 59 insertions, 10 deletions
diff --git a/gdb/x86-64-linux-nat.c b/gdb/x86-64-linux-nat.c index f57a5f2..4c4f643 100644 --- a/gdb/x86-64-linux-nat.c +++ b/gdb/x86-64-linux-nat.c @@ -25,7 +25,6 @@ #include "inferior.h" #include "gdbcore.h" #include "regcache.h" -#include "i387-tdep.h" #include "gdb_assert.h" #include "x86-64-tdep.h" @@ -195,23 +194,73 @@ store_regs (int tid, int regno) /* Transfering floating-point registers between GDB, inferiors and cores. */ -/* Fill GDB's register array with the floating-point register values in - *FPREGSETP. */ +static void * +x86_64_fxsave_offset (elf_fpregset_t * fxsave, int regnum) +{ + char *reg_name; + int reg_index; + + gdb_assert (x86_64_num_gregs - 1 < regnum && regnum < x86_64_num_regs); + + reg_name = x86_64_register_nr2name (regnum); + + if (reg_name[0] == 's' && reg_name[1] == 't') + { + reg_index = reg_name[2] - '0'; + return &fxsave->st_space[reg_index * 2]; + } + + if (reg_name[0] == 'x' && reg_name[1] == 'm' && reg_name[2] == 'm') + { + reg_index = reg_name[3] - '0'; + return &fxsave->xmm_space[reg_index * 4]; + } + + if (strcmp (reg_name, "mxcsr") == 0) + return &fxsave->mxcsr; + + return NULL; +} + +/* 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. */ void -supply_fpregset (elf_fpregset_t * fpregsetp) +supply_fpregset (elf_fpregset_t * fxsave) { - i387_supply_fxsave ((char *) fpregsetp); + int i, reg_st0, reg_mxcsr; + + reg_st0 = x86_64_register_name2nr ("st0"); + reg_mxcsr = x86_64_register_name2nr ("mxcsr"); + + gdb_assert (reg_st0 > 0 && reg_mxcsr > reg_st0); + + for (i = reg_st0; i <= reg_mxcsr; i++) + supply_register (i, x86_64_fxsave_offset (fxsave, i)); } -/* Fill register REGNO (if it is a floating-point register) in - *FPREGSETP with the value in GDB's register array. If REGNO is -1, - do this for all registers. */ +/* 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 + this for all registers. This function doesn't touch any of the + reserved bits in *FXSAVE. */ void -fill_fpregset (elf_fpregset_t * fpregsetp, int regno) +fill_fpregset (elf_fpregset_t * fxsave, int regnum) { - i387_fill_fxsave ((char *) fpregsetp, regno); + int i, last_regnum = MXCSR_REGNUM; + void *ptr; + + if (gdbarch_tdep (current_gdbarch)->num_xmm_regs == 0) + last_regnum = FOP_REGNUM; + + for (i = FP0_REGNUM; i <= last_regnum; i++) + if (regnum == -1 || regnum == i) + { + ptr = x86_64_fxsave_offset (fxsave, i); + if (ptr) + regcache_collect (i, ptr); + } } /* Fetch all floating-point registers from process/thread TID and store |