[rfc] Replace x86 register macros

Ulrich Weigand uweigand@de.ibm.com
Tue Mar 4 00:32:00 GMT 2008


Markus Deuling wrote:

> thanks both for your input. I reworked the patch now. Tested on x86 without regressions 
> Maybe someone can run a test on amd64 as I don't have such a machine?

I've tested this on amd64-linux with no regressions.

> +#define I387_ST0_REGNUM(tdep) (tdep->st0_regnum)
> +#define I387_NUM_XMM_REGS(tdep) (tdep->num_xmm_regs)
> +#define I387_MM0_REGNUM(tdep) (tdep->mm0_regnum)

You need to put parentheses around "tdep" to protect against
macro evaluation issues ...

> +#define I387_FCTRL_REGNUM(tdep)	(I387_ST0_REGNUM(tdep) + 8)
> +#define I387_FSTAT_REGNUM(tdep)	(I387_FCTRL_REGNUM(tdep)+ 1)
> +#define I387_FTAG_REGNUM(tdep)	(I387_FCTRL_REGNUM(tdep)+ 2)
> +#define I387_FISEG_REGNUM(tdep)	(I387_FCTRL_REGNUM(tdep)+ 3)
> +#define I387_FIOFF_REGNUM(tdep)	(I387_FCTRL_REGNUM(tdep)+ 4)
> +#define I387_FOSEG_REGNUM(tdep)	(I387_FCTRL_REGNUM(tdep)+ 5)
> +#define I387_FOOFF_REGNUM(tdep)	(I387_FCTRL_REGNUM(tdep)+ 6)
> +#define I387_FOP_REGNUM(tdep)	(I387_FCTRL_REGNUM(tdep)+ 7)
> +#define I387_XMM0_REGNUM(tdep)	(I387_ST0_REGNUM(tdep)+ 16)
> +#define I387_MXCSR_REGNUM(tdep)	(I387_XMM0_REGNUM(tdep) \
> ++ I387_NUM_XMM_REGS(tdep))

Formatting (whitespace and indentation) is a bit odd here.

Also, you've forgotten to adapt a couple of uses of the I387_
macros in win32-nat.c.

Otherwise, this looks fine to me.

Thanks,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com



More information about the Gdb-patches mailing list