Subject: Re: more gcc4 woes
To: None <port-sparc@netbsd.org>
From: Christos Zoulas <christos@astron.com>
List: port-sparc
Date: 07/02/2006 22:27:23
In article <20060702221317.GE28174@drowsy.duskware.de>,
Martin Husemann  <martin@duskware.de> wrote:
>On Sun, Jul 02, 2006 at 02:51:14PM -0400, Michael Lorenz wrote:
>> trap type 0x7: pc=0xf010ce2c npc=0xf010ce30 psr=44000c6<S,PS>
>> kernel: alignment fault trap
>> Stopped in pid 430.3 (gcvs) at netbsd:sa_upcall_userret+0x1e4:
>> std %g2, [%o0 + 0x18]
>
>Can you show %o0 here?
>
>The code is:
>
>        kup = kmem_zalloc(sizeof(*kup), KM_SLEEP);
>        kup->uc_stack = sau->sau_stack;
>
>where kup is a ucontext_t and the store to kup->uc_stack is faulting.
>I can't see a reason for this to happen unless kmem_zalloc returned
>badly aligned memory (the %o0 should show that).

The vmem stuff is a bit borken:

#define   KMEM_QUANTUM_SIZE       sizeof(void *)  /* XXX */

This will not work on the sparc when it tries to split a block.
Maybe KMEM_QUANTUM_SIZE should be defined on a per arch basis.

For now, try:

#ifdef __sparc__
#define   KMEM_QUANTUM_SIZE       sizeof(long long)
#else
#define   KMEM_QUANTUM_SIZE       sizeof(void *)
#endif

christos