diff options
author | Andrew Cagney <cagney@redhat.com> | 2002-11-08 16:52:37 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2002-11-08 16:52:37 +0000 |
commit | 531dcc7fad1c44d134e1f8b8dfbc24aa9b7daf6e (patch) | |
tree | b42578063690316c32102eca1e0fd7ad2176dedf | |
parent | c48c0e62329f386a8e81ff7a8bbddaa623d469e4 (diff) | |
download | gdb-531dcc7fad1c44d134e1f8b8dfbc24aa9b7daf6e.tar.gz |
2002-11-06 Andrew Cagney <cagney@redhat.com>
* i386-tdep.c (i386_mmx_regnum_p): Rename mmx_regnum_p. Update
all callers.
(i386_fp_regnum_p): New function. Use instead of FP_REGNUM_P.
(i386_fpc_regnum_p): New function. Use instead of FPC_REGNUM_P.
(i386_sse_regnum_p): New function. Use instead of SSE_REGNUM_P.
(i386_mxcsr_regnum_p): new function. Use instead of
MXCSR_REGNUM_P.
* i386-tdep.h (SSE_REGNUM_P): Delete macro.
(i386_sse_regnum_p): Declare.
(i386_mxcsr_regnum_p): Declare.
(FP_REGNUM_P, FPC_REGNUM_P): Delete macros.
(i386_fp_regnum_p, i386_fpc_regnum_p): Declare.
(IS_FP_REGNUM): Update definition.
(IS_FPU_CTRL_REGNUM): Update definition..
(IS_SSE_REGNUM): Update definition..
* i386v-nat.c (register_u_addr): Update.
* go32-nat.c (fetch_register): Update.
(store_register): Update.
-rw-r--r-- | gdb/ChangeLog | 21 | ||||
-rw-r--r-- | gdb/go32-nat.c | 4 | ||||
-rw-r--r-- | gdb/i386-tdep.c | 52 | ||||
-rw-r--r-- | gdb/i386-tdep.h | 25 | ||||
-rw-r--r-- | gdb/i386v-nat.c | 2 |
5 files changed, 81 insertions, 23 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 56ab93773d1..d6f94e47110 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,24 @@ +2002-11-06 Andrew Cagney <cagney@redhat.com> + + * i386-tdep.c (i386_mmx_regnum_p): Rename mmx_regnum_p. Update + all callers. + (i386_fp_regnum_p): New function. Use instead of FP_REGNUM_P. + (i386_fpc_regnum_p): New function. Use instead of FPC_REGNUM_P. + (i386_sse_regnum_p): New function. Use instead of SSE_REGNUM_P. + (i386_mxcsr_regnum_p): new function. Use instead of + MXCSR_REGNUM_P. + * i386-tdep.h (SSE_REGNUM_P): Delete macro. + (i386_sse_regnum_p): Declare. + (i386_mxcsr_regnum_p): Declare. + (FP_REGNUM_P, FPC_REGNUM_P): Delete macros. + (i386_fp_regnum_p, i386_fpc_regnum_p): Declare. + (IS_FP_REGNUM): Update definition. + (IS_FPU_CTRL_REGNUM): Update definition.. + (IS_SSE_REGNUM): Update definition.. + * i386v-nat.c (register_u_addr): Update. + * go32-nat.c (fetch_register): Update. + (store_register): Update. + 2002-11-07 Joel Brobecker <brobecker@gnat.com> Preparation work to convert the hppa targets to multiarch partial. diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c index a16b1b37295..6ff2710c22d 100644 --- a/gdb/go32-nat.c +++ b/gdb/go32-nat.c @@ -467,7 +467,7 @@ fetch_register (int regno) { if (regno < FP0_REGNUM) supply_register (regno, (char *) &a_tss + regno_mapping[regno].tss_ofs); - else if (FP_REGNUM_P (regno) || FPC_REGNUM_P (regno)) + else if (i386_fp_regnum_p (regno) || i386_fpc_regnum_p (regno)) i387_supply_register (regno, (char *) &npx); else internal_error (__FILE__, __LINE__, @@ -492,7 +492,7 @@ store_register (int regno) { if (regno < FP0_REGNUM) regcache_collect (regno, (char *) &a_tss + regno_mapping[regno].tss_ofs); - else if (FP_REGNUM_P (regno) || FPC_REGNUM_P (regno)) + else if (i386_fp_regnum_p (regno) || i386_fpc_regnum_p (regno)) i387_fill_fsave ((char *) &npx, regno); else internal_error (__FILE__, __LINE__, diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 91e57142e42..9066a1c6bd3 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -70,11 +70,43 @@ static const int mmx_num_regs = (sizeof (i386_mmx_names) #define MM0_REGNUM (NUM_REGS) static int -mmx_regnum_p (int reg) +i386_mmx_regnum_p (int reg) { return (reg >= MM0_REGNUM && reg < MM0_REGNUM + mmx_num_regs); } +/* FP register? */ + +int +i386_fp_regnum_p (int regnum) +{ + return (regnum < NUM_REGS + && (FP0_REGNUM && FP0_REGNUM <= (regnum) && (regnum) < FPC_REGNUM)); +} + +int +i386_fpc_regnum_p (int regnum) +{ + return (regnum < NUM_REGS + && (FPC_REGNUM <= (regnum) && (regnum) < XMM0_REGNUM)); +} + +/* SSE register? */ + +int +i386_sse_regnum_p (int regnum) +{ + return (regnum < NUM_REGS + && (XMM0_REGNUM <= (regnum) && (regnum) < MXCSR_REGNUM)); +} + +int +i386_mxcsr_regnum_p (int regnum) +{ + return (regnum < NUM_REGS + && (regnum == MXCSR_REGNUM)); +} + /* Return the name of register REG. */ const char * @@ -82,7 +114,7 @@ i386_register_name (int reg) { if (reg < 0) return NULL; - if (mmx_regnum_p (reg)) + if (i386_mmx_regnum_p (reg)) return i386_mmx_names[reg - MM0_REGNUM]; if (reg >= sizeof (i386_register_names) / sizeof (*i386_register_names)) return NULL; @@ -1098,13 +1130,13 @@ i386_register_virtual_type (int regnum) if (regnum == PC_REGNUM || regnum == FP_REGNUM || regnum == SP_REGNUM) return lookup_pointer_type (builtin_type_void); - if (FP_REGNUM_P (regnum)) + if (i386_fp_regnum_p (regnum)) return builtin_type_i387_ext; - if (SSE_REGNUM_P (regnum)) + if (i386_sse_regnum_p (regnum)) return builtin_type_vec128i; - if (mmx_regnum_p (regnum)) + if (i386_mmx_regnum_p (regnum)) return builtin_type_vec64i; return builtin_type_int; @@ -1131,7 +1163,7 @@ static void i386_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, int regnum, void *buf) { - if (mmx_regnum_p (regnum)) + if (i386_mmx_regnum_p (regnum)) { char *mmx_buf = alloca (MAX_REGISTER_RAW_SIZE); int fpnum = mmx_regnum_to_fp_regnum (regcache, regnum); @@ -1147,7 +1179,7 @@ static void i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, int regnum, const void *buf) { - if (mmx_regnum_p (regnum)) + if (i386_mmx_regnum_p (regnum)) { char *mmx_buf = alloca (MAX_REGISTER_RAW_SIZE); int fpnum = mmx_regnum_to_fp_regnum (regcache, regnum); @@ -1171,7 +1203,7 @@ i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, static int i386_register_convertible (int regnum) { - return FP_REGNUM_P (regnum); + return i386_fp_regnum_p (regnum); } /* Convert data from raw format for register REGNUM in buffer FROM to @@ -1181,7 +1213,7 @@ static void i386_register_convert_to_virtual (int regnum, struct type *type, char *from, char *to) { - gdb_assert (FP_REGNUM_P (regnum)); + gdb_assert (i386_fp_regnum_p (regnum)); /* We only support floating-point values. */ if (TYPE_CODE (type) != TYPE_CODE_FLT) @@ -1204,7 +1236,7 @@ static void i386_register_convert_to_raw (struct type *type, int regnum, char *from, char *to) { - gdb_assert (FP_REGNUM_P (regnum)); + gdb_assert (i386_fp_regnum_p (regnum)); /* We only support floating-point values. */ if (TYPE_CODE (type) != TYPE_CODE_FLT) diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h index 646001baa34..e30d7e3c5ad 100644 --- a/gdb/i386-tdep.h +++ b/gdb/i386-tdep.h @@ -113,11 +113,10 @@ struct gdbarch_tdep /* FPU opcode, bottom eleven bits. */ #define FOP_REGNUM (FPC_REGNUM + 7) -/* Return non-zero if N corresponds to a FPU data registers. */ -#define FP_REGNUM_P(n) (FP0_REGNUM && FP0_REGNUM <= (n) && (n) < FPC_REGNUM) - -/* Return non-zero if N corresponds to a FPU control register. */ -#define FPC_REGNUM_P(n) (FPC_REGNUM <= (n) && (n) < XMM0_REGNUM) +/* Return non-zero if REGNUM matches the FP register and the FP + register set is active. */ +extern int i386_fp_regnum_p (int regnum); +extern int i386_fpc_regnum_p (int regnum); /* SSE registers. */ @@ -128,17 +127,23 @@ struct gdbarch_tdep #define MXCSR_REGNUM \ (XMM0_REGNUM + gdbarch_tdep (current_gdbarch)->num_xmm_regs) -/* Return non-zero if N corresponds to a SSE data register. */ -#define SSE_REGNUM_P(n) (XMM0_REGNUM <= (n) && (n) < MXCSR_REGNUM) +/* Return non-zero if REGNUM matches the SSE register and the SSE + register set is active. */ +extern int i386_sse_regnum_p (int regnum); +extern int i386_mxcsr_regnum_p (int regnum); + +/* Return non-zero if REGNUM matches the ORIG_EAX register and the + register hack is active. */ +extern int i386_linux_orig_eax_regnum_p (int regnum); /* FIXME: kettenis/2001-11-24: Obsolete macro's. */ #define FCS_REGNUM FISEG_REGNUM #define FCOFF_REGNUM FIOFF_REGNUM #define FDS_REGNUM FOSEG_REGNUM #define FDOFF_REGNUM FOOFF_REGNUM -#define IS_FP_REGNUM(n) FP_REGNUM_P (n) -#define IS_FPU_CTRL_REGNUM(n) FPC_REGNUM_P (n) -#define IS_SSE_REGNUM(n) SSE_REGNUM_P (n) +#define IS_FP_REGNUM(n) i386_fp_regnum_p (n) +#define IS_FPU_CTRL_REGNUM(n) i386_fpc_regnum_p (n) +#define IS_SSE_REGNUM(n) i386_sse_regnum_p (n) #define I386_NUM_GREGS 16 #define I386_NUM_FREGS 16 diff --git a/gdb/i386v-nat.c b/gdb/i386v-nat.c index 78152e410e1..a6dc505a9e1 100644 --- a/gdb/i386v-nat.c +++ b/gdb/i386v-nat.c @@ -85,7 +85,7 @@ register_u_addr (CORE_ADDR blockend, int regnum) struct user u; CORE_ADDR fpstate; - if (FP_REGNUM_P (regnum)) + if (i386_fp_regnum_p (regnum)) { #ifdef KSTKSZ /* SCO, and others? */ blockend += 4 * (SS + 1) - KSTKSZ; |