This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfc] [05/05] Get rid of current_gdbarch in xtensa


Markus Deuling wrote:

> -#define AREG_NUMBER(r, wb) \
> -  ((((r) - (gdbarch_tdep (current_gdbarch)->a0_base + 0) + (((wb) \
> -  & ((gdbarch_tdep (current_gdbarch)->num_aregs - 1) >> 2)) << WB_SHIFT)) & \
> -  (gdbarch_tdep (current_gdbarch)->num_aregs - 1)) \
> -  + gdbarch_tdep (current_gdbarch)->ar_base)


> +/* Convert a live Ax register number to the corresponding Areg number.  */
> +static int
> +areg_number (struct gdbarch *gdbarch, int regnum, ULONGEST wb)
> +{
> +  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
> +  int areg;
> +
> +  areg = regnum - tdep->a0_base + tdep->ar_base;
> +  areg += (wb & ((tdep->num_aregs - 1) >> 2)) << WB_SHIFT;
> +  areg &= tdep->num_aregs - 1;
> +
> +  return areg;
> +}

The function does not look equivalent to the macro, that should be

  areg = regnum - tdep->a0_base;
  areg += (wb & ((tdep->num_aregs - 1) >> 2)) << WB_SHIFT;
  areg &= tdep->num_aregs - 1;

  return areg + tdep->ar_base;


> +      regnum = areg_number(gdbarch, regnum, extract_unsigned_integer (buf, 4));
Space before '('.


Otherwise, I didn't see anything wrong.  But I agree that it would
be good to test a change of this complexity; can you set up a simulator
test environment for xtensa?

Bye,
Ulrich

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]