Re: [PATCH] Fix sparc-*-linux register fetching/storing

Jakub Jelinek
2001-11-25T17:04:13Z

On Sun, Nov 25, 2001 at 11:54:46AM -0500, Daniel Jacobowitz wrote:
> Well, regcache_collect is the only approved interface to the contents
> of registers[] for one thing.

Even in the routine where half of it is direct registers[] setting?
If that is rewritten, surely it makes sense to access sp that way too.

> It would also prevent the need for the
> cast (although you'd have to clear the upper half of the variable
> first and make sure to stuff it into the low bytes since we're
> big-endian. Ew.).
>
> Andrew? Do we need to have a regcache_collect_core_addr, to sign
> extend and shift appropriately for each architecture?

Without such routine the code would be very ugly:
CORE_ADDR sp = 0;
regcache_collect (SP_REGNUM, ((char *)&sp) + sizeof(CORE_ADDR) - REGISTER_RAW_SIZE(SP_REGNUM));

Jakub