qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 09/26] target-xtensa: add special and user regis


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH 09/26] target-xtensa: add special and user registers
Date: Thu, 19 May 2011 13:59:49 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Thunderbird/3.1.10

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

[Prev in Thread] Current Thread [Next in Thread]