----- "Luc Chouinard" <Luc.Chouinard@xxxxxxxxxxxxxxxx> wrote: > ACK - and thanks! Can you attach an actual patch that I can download and apply? Thanks, Dave > > > -----Original Message----- > > From: crash-utility-bounces@xxxxxxxxxx [mailto:crash-utility- > > bounces@xxxxxxxxxx] On Behalf Of Michael Holzheu > > Sent: Wednesday, September 16, 2009 1:45 PM > > To: Chouinard, Luc > > Cc: wein@xxxxxxxxxx; crash > > Subject: [PATCH] sial: Fix processing of bitfields > on > > bigendian systems > > > > Hi Luc, > > > > The processing of bit fields on big endian systems in sial is > currently > > broken, because the bits are not copied to the correct position and > are > > not shifted the right way. > > > > To fix this, the following patch does the processing on big endian > > systems as follows: > > 1. sial_exemem(): Copy complete bit field to the "end" (right) of > the > > long long variable. > > 2. get_bit_value(): Shift the bits of the bit field member right to > > the "end" of the long long variable. This results in the value > of > > the requested bitfield member. > > > > Michael > > --- > > extensions/libsial/sial_member.c | 7 +++++-- > > extensions/libsial/sial_type.c | 6 +++++- > > 2 files changed, 10 insertions(+), 3 deletions(-) > > > > Index: crash-4.0.9/extensions/libsial/sial_member.c > > =================================================================== > > --- crash-4.0.9.orig/extensions/libsial/sial_member.c > > +++ crash-4.0.9/extensions/libsial/sial_member.c > > @@ -236,10 +236,13 @@ srcpos_t p; > > } > > /* bit field gymnastic */ > > else if(stm->m.nbits) { > > - > > ull value=0; > > + void *target = &value; > > + > > + if (__BYTE_ORDER != __LITTLE_ENDIAN) > > + target = target + (sizeof(value) - > stm->m.size); > > > > - API_GETMEM(m->mem+stm->m.offset, &value, > stm->m.size); > > + API_GETMEM(m->mem+stm->m.offset, target, > stm->m.size); > > get_bit_value(value, stm->m.nbits, stm->m.fbit, > stm- > > >m.size, v); > > /* no mempos for bit fields ... */ > > > > Index: crash-4.0.9/extensions/libsial/sial_type.c > > =================================================================== > > --- crash-4.0.9.orig/extensions/libsial/sial_type.c > > +++ crash-4.0.9/extensions/libsial/sial_type.c > > @@ -287,7 +287,11 @@ get_bit_value(ull val, int nbits, int bo > > else { > > mask = ((1 << nbits) - 1); > > } > > - val = val >> boff; > > + > > + if (__BYTE_ORDER == __LITTLE_ENDIAN) > > + val = val >> boff; > > + else > > + val = val >> (vnbits - boff - nbits); > > val &= mask; > > > > if(issigned(v)) { > > > > > > -- > > Crash-utility mailing list > > Crash-utility@xxxxxxxxxx > > https://www.redhat.com/mailman/listinfo/crash-utility > > > > -- > Crash-utility mailing list > Crash-utility@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/crash-utility -- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/crash-utility