On 05/17/2011 03:32 PM, Max Filippov wrote:
> +enum {
> +    THREADPTR = 231,
> +    FCR = 232,
> +    FSR = 233,
> +};
> +
>  typedef struct XtensaConfig {
>      const char *name;
>      uint64_t options;
> @@ -109,6 +115,7 @@ typedef struct CPUXtensaState {
>      uint32_t regs[16];
>      uint32_t pc;
>      uint32_t sregs[256];
> +    uint32_t uregs[256];

Is it really worthwhile allocating 2k worth of space in the
CPUState when only several of the slots are actually used?

I would think that it might be better to have a function to
map between number to offset/register.  E.g.

int ur_offset(int ur)
{
    switch (ur) {
    case THREADPTR:
        return offsetof(CPUState, ur_threadptr);
    case FCR:
        return offsetof(CPUState, ur_fcr);
    case FSR:
        return offsetof(CPUState, ur_fsr);
    }
    return -1;
}

where the individual slots are allocated by hand in the
CPUState.  The fact that they'll be named in the struct
will also make it easier to dump the value inside gdb and
see what the individual values are.


r~

Reply via email to