[OpenBIOS] [PATCH] ppc: fix stack usage in mmu_claim, mem_claim

Segher Boessenkool segher at kernel.crashing.org
Thu Jun 18 01:37:36 CEST 2015


On Wed, Jun 17, 2015 at 11:30:37PM +0100, Mark Cave-Ayland wrote:
> >> The 'phys' argument to mem_claim() and 'virt' argument to mmu_claim() are now
> >> only popped from the stack if the 'align' argument is provided.
> > 
> > You probably also want to mention you no longer THROW when the
> > return value is -1 (and explain why).
> 
> I'm not too worried about missing the throw here right now.

Neither am I, but it's a silent change; the commit message should say.
I think the original code is simply wrong fwiw, the client interface
shouldn't throw (but return an error).

> One of the more recent changes I managed to do was to unmap page 0 on
> all 3 of SPARC32, SPARC64 and PPC and still have everything boot.

:-)

> >> +	phys_addr_t phys = -1UL;
> > 
> > Is this the common style in this code?  Will "long int" always fit
> > phys_addr_t?  Seems shaky.
> 
> In the original OFMEM implementation sizeof(phys_addr_t) == sizeof(virt)
> == word size of machine. The only reason phys_addr_t is different here
> was since SPARC32 was switched over to OFMEM as SPARC32 has a 36-bit
> physical address space vs. a 32-bit virtual address space just to make
> things more interesting :)  I haven't compile-tested this yet but if you
> can suggest a better alternative, please do.

-1ULL should work.  Plain -1 works fine, too.  -1UL doesn't work correctly
(if phys_addr_t is bigger than long int).  So just -1 is my preference.


Segher



More information about the OpenBIOS mailing list