think-o: ARM register byte ps VS fps?
Richard Earnshaw
rearnsha@arm.com
Thu Apr 18 02:57:00 GMT 2002
> Hello,
>
> I'm looking at the code:
>
> static int
> arm_register_byte (int regnum)
> {
> if (regnum < ARM_F0_REGNUM)
> return regnum * INT_REGISTER_RAW_SIZE;
> else if (regnum < ARM_PS_REGNUM)
> return (NUM_GREGS * INT_REGISTER_RAW_SIZE
> + (regnum - ARM_F0_REGNUM) * FP_REGISTER_RAW_SIZE);
> else
> return (NUM_GREGS * INT_REGISTER_RAW_SIZE
> + NUM_FREGS * FP_REGISTER_RAW_SIZE
> + (regnum - ARM_FPS_REGNUM) * STATUS_REGISTER_SIZE);
> }
>
> where:
>
> #define ARM_FPS_REGNUM 24 /* floating point status register */
> #define ARM_PS_REGNUM 25 /* Contains processor status */
>
> While I suspect it ``works'', would ``(regnum < ARM_FPS_REGNUM)'' be better?
>
> enjoy,
> Andrew
>
Rewriting it as a table of constants would probably be better still.
I'll add it to my (copious) todo list.
R.
More information about the Gdb
mailing list