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

Daniel Jacobowitz
2001-11-25T17:08:26Z

On Sun, Nov 25, 2001 at 12:02:50PM -0500, Jakub Jelinek wrote:
> 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.

Yes. Accessing registers[] is deprecated.

> > 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));

I guess we do, then :) I'll wait for Andrew's thoughts, this is his
turf. But other than this, your patch looks good. Since Sparc is
listed as maintenance only (i.e. no active maintainer), you can go
ahead and commit it, I think; we'll clean up the registers[] stuff
later.

--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer