[oi-dev] Broadcom wireless drivers for OpenIndiana

Jean-Pierre jean-pierre.andre at wanadoo.fr
Fri Apr 26 17:57:14 UTC 2013


Jim Klimov wrote:
> On 2013-04-26 18:01, Jean-Pierre wrote:
>>> Does the first 4-byte padding belong in the child struct or in the
>>> parent, prefixing all variations of the union sub-structures?
>>
>> You need two paddings, the way you showed above. I suggest
>> the patch below (possibly damaged by the mailer), which
>> might be overkill :
>
> Thanks, I'll try to test it tonight. Off the top of your head,
> would such padding be needed in other structures that comprise
> the union? I think I saw some such examples when I looked at
> the code yesterday (actually, hence my ideas about padding),
> but I am not sure how many of the variants had that precaution
> in place.

Good point, I forgot one of them in my patch proposal :
there is an isl_write.isl_key in the same union which
has also to be aligned. These isl_key are not used, but
they impact both isl_byteoff, and apparently only the
first one is checked in layout_check().

I had also problems with "struct cm_partial_resource_desc"
in resource_var.h, and in this case the fields with type
"physaddr", which mean 64-bit addresses, must NOT be
aligned to 8 bytes. You may have to replace all the
conditionals in this struct by "#ifdef __amd64__". If
you need to do so, you have to do the same in the
function ndis_convert_res() from kern_ndis.c

Good luck

Jean-Pierre





More information about the oi-dev mailing list