On Tue, Apr 2, 2013 at 9:45 PM, Mark Cave-Ayland mark.cave-ayland@ilande.co.uk wrote:
On 02/04/13 20:12, Artyom Tarasenko wrote:
After some debugging, I think the problem is in the current obp_memalloc realization: it calls ofmem_claim_virt which expects the address to be precise and thus can not be called twice for the same virtual address.
Looking at the OpenSolaris headers ( http://fxr.watson.org/fxr/source/sun/sys/promif.h?v=OPENSOLARIS#L83 )
extern caddr_t prom_alloc(caddr_t virthint, size_t size, uint_t align);
it seems that "virthint" is just a hint for a virtual address, so prom_alloc (which is our obp_memalloc) shall not fail unless the whole RAM is exhausted. The comment on lines 70-71 says:
"The alloc function should guarantee that it will never return an invalid pointer."
Someone cares to fix?
Ah I think I may see the bug here - what if you change arch/sparc32/lib.c line 276 in obp_memalloc() from:
virt = ofmem_claim_virt(pointer2cell(va), size, 0);
to:
virt = ofmem_claim_virt(pointer2cell(va), size, align);
Does that fix the bug for you?
At least, it seems to die some instructions later, thanks! Will debug more. Does it mean that obp_memalloc is actually using the first argument just as a hint? As the OpenSolaris header suggests?
Artyom
-- Regards, Artyom Tarasenko
linux/sparc and solaris/sparc under qemu blog: http://tyom.blogspot.com/search/label/qemu