Subject: Re: cpufunc.h
To: Ben Harris <>
From: John Fremlin <>
List: port-arm
Date: 05/29/2001 21:22:12
Ben Harris <> writes:

> On 29 May 2001, John Fremlin wrote:
> > > I think it needs to be made clear that __SetCPSR is an internal
> > > function, and things shouldn't call it directly.
> >
> > Why not? It's handy first thing in bootstrap where you don't care what
> > the CPSR was before. It is also handy for the set_stackptr stuff.
> In that case it should have a name that makes it clear how it
> differs from SetCPSR (or SetCPSR should be renamed).  I really don't
> like the idea of having two public functions whose names differ only
> in the number of underscores at the front.

I guess I spend too much time with linux sources. SetCPSR is a damn
fool name anyway and a damn fool primitive. However it is used in a
bunch of places. I've changed __SetCPSR to set_cpsr in my local tree.

> > Is the current assembly SetCPSR even valid? It can clobber a bunch of
> > registers on mode change. Are all these registers caller save in the
> > abi?
> r0-r3, r12 are all caller-saved.

Then the current code setcpsr.S code is screwed because set_cpsr can
clobber "r8","r9","r10","r11","r12","r13","r14". Further that file is

I've changed the relevant inline functions to macros so that gcc can
screw with the stack pointer in more places should it so desire,
without bungling the ?et_stackptr stuff.