I need help understanding an alignment panic when calling mutex_init
I am looking for help with a STREAM module that compiles and run under Solaris 10 on 32-bit and 64-bit Intel kernels but panics on a 64-bit Sarc kernel.
I have isolated the panic to a data alignment issue when my _init routine calls either the rw_init and mutux_init routines with a pointer to a krwlock_t or kmutex_t structure that is not 8 byte aligned.
I am using "gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath)" from the Solaris 10 install CD's with the following options:
gcc -Wall -fno-builtin -ffreestanding -nodefaultlibs -fpcc-struct-return -D_KERNEL -mno-app-regs -g -m64 -mcpu=v9 -D_SYSCALL32 -D_SYSCALL32_IMPL -D_ELF64 -D__sparcv9cpu -DSYSACCT -DC2_AUDIT
(I know some of these are redundant)
I have 4 locks along with a variety of other members defined in a structure used to by my driver code. If I manually arrange the structure to keep the lock variables on 8 byte boundries the module loads without a panic. However, if I let gcc handle the alignment or specifiy "__attribute__ ((aligned (8)))" on the lock variable definition the module panics on entry to the kernel rw_init or mutex_init routine with a BAD TRAP type 34 alignment error.
At this point I am lost. I'm guessing this is a gcc/sparcv9 issue but I have no idea how to code this properly. I'm hoping someone can help shed some light on the problem.

