Message ID | 20151206211538.GK17730@nataraja |
---|---|
State | Superseded |
Headers | show |
Hi, Thanks! Apparently it doesn't work correctly, but I'm now trying with: #if OSMO_IS_LITTLE_ENDIAN == 1 instead, and I have big hopes. (OSMO_IS_LITTLE_ENDIAN is always defined, 1 for low-endian archs and 0 for big-endian archs.) Cheers, Ruben 2015-12-06 22:15 GMT+01:00 Harald Welte <laforge@gnumonks.org>: > Hi Ruben, > > On Sun, Dec 06, 2015 at 04:53:09PM +0100, Ruben Undheim wrote: >> While building the package for Debian, apparently there is a problem >> related to big-endian architectures. > > While I still own several PPC machines, I haven't booted any of them in > years, and don't have a build setup ready. Please try the patch > below and report back if it works. If yes, we can merge it. > > From 51ae645e220556bbeabce3ac57304639328e2164 Mon Sep 17 00:00:00 2001 > From: Harald Welte <laforge@gnumonks.org> > Date: Sun, 6 Dec 2015 22:12:43 +0100 > Subject: [PATCH] untested fix for gsm_03_41.h and big-endian machines > > Our gsm_03_41 structs use bit-fields, but don't do the usual > little/big-endian jumping. > --- > include/osmocom/gsm/protocol/gsm_03_41.h | 27 +++++++++++++++++++++++++++ > 1 file changed, 27 insertions(+) > > diff --git a/include/osmocom/gsm/protocol/gsm_03_41.h b/include/osmocom/gsm/protocol/gsm_03_41.h > index 0ece6cc..f007cc1 100644 > --- a/include/osmocom/gsm/protocol/gsm_03_41.h > +++ b/include/osmocom/gsm/protocol/gsm_03_41.h > @@ -2,6 +2,7 @@ > > #include <stdint.h> > > +#include <osmocom/core/endian.h> > #include <osmocom/gsm/protocol/gsm_04_12.h> > > /* GSM TS 03.41 definitions also TS 23.041*/ > @@ -13,19 +14,36 @@ > /* Chapter 9.3.2 */ > struct gsm341_ms_message { > struct { > +#ifdef OSMO_IS_LITTLE_ENDIAN > uint8_t code_hi:6; > uint8_t gs:2; > uint8_t update:4; > uint8_t code_lo:4; > +#else > + uint8_t code_lo:4; > + uint8_t update:4; > + uint8_t gs:2; > + uint8_t code_hi:6; > +#endif > } serial; > uint16_t msg_id; > struct { > +#ifdef OSMO_IS_LITTLE_ENDIAN > uint8_t language:4; > uint8_t group:4; > +#else > + uint8_t group:4; > + uint8_t language:4; > +#endif > } dcs; > struct { > +#ifdef OSMO_IS_LITTLE_ENDIAN > uint8_t total:4; > uint8_t current:4; > +#else > + uint8_t current:4; > + uint8_t total:4; > +#endif > } page; > uint8_t data[0]; > } __attribute__((packed)); > @@ -33,12 +51,21 @@ struct gsm341_ms_message { > /* Chapter 9.4.1.3 */ > struct gsm341_etws_message { > struct { > +#ifdef OSMO_IS_LITTLE_ENDIAN > uint8_t code_hi:4; > uint8_t popup:1; > uint8_t alert:1; > uint8_t gs:2; > uint8_t update:4; > uint8_t code_lo:4; > +#else > + uint8_t code_lo:4; > + uint8_t update:4; > + uint8_t gs:2; > + uint8_t alert:1; > + uint8_t popup:1; > + uint8_t code_hi:4; > +#endif > } serial; > uint16_t msg_id; > uint16_t warning_type; > -- > 2.6.2 > > -- > - Harald Welte <laforge@gnumonks.org> http://laforge.gnumonks.org/ > ============================================================================ > "Privacy in residential applications is a desirable marketing option." > (ETSI EN 300 175-7 Ch. A6)
Hi, thanks, I encountered the same in Fedora on ppc machines. Unfortunately, the patch even with '#if OSMO_IS_LITTLE_ENDIAN == 1' doesn't seem to resolve the problem for me, the test is still failing. I am going to check this deeper thanks & regards Jaroslav ----- Original Message ----- > Hi, > > Thanks! > > Apparently it doesn't work correctly, but I'm now trying with: > #if OSMO_IS_LITTLE_ENDIAN == 1 > > instead, and I have big hopes. > > (OSMO_IS_LITTLE_ENDIAN is always defined, 1 for low-endian archs and 0 > for big-endian archs.) > > Cheers, > Ruben > > 2015-12-06 22:15 GMT+01:00 Harald Welte <laforge@gnumonks.org>: > > Hi Ruben, > > > > On Sun, Dec 06, 2015 at 04:53:09PM +0100, Ruben Undheim wrote: > >> While building the package for Debian, apparently there is a problem > >> related to big-endian architectures. > > > > While I still own several PPC machines, I haven't booted any of them in > > years, and don't have a build setup ready. Please try the patch > > below and report back if it works. If yes, we can merge it. > > > > From 51ae645e220556bbeabce3ac57304639328e2164 Mon Sep 17 00:00:00 2001 > > From: Harald Welte <laforge@gnumonks.org> > > Date: Sun, 6 Dec 2015 22:12:43 +0100 > > Subject: [PATCH] untested fix for gsm_03_41.h and big-endian machines > > > > Our gsm_03_41 structs use bit-fields, but don't do the usual > > little/big-endian jumping. > > --- > > include/osmocom/gsm/protocol/gsm_03_41.h | 27 +++++++++++++++++++++++++++ > > 1 file changed, 27 insertions(+) > > > > diff --git a/include/osmocom/gsm/protocol/gsm_03_41.h > > b/include/osmocom/gsm/protocol/gsm_03_41.h > > index 0ece6cc..f007cc1 100644 > > --- a/include/osmocom/gsm/protocol/gsm_03_41.h > > +++ b/include/osmocom/gsm/protocol/gsm_03_41.h > > @@ -2,6 +2,7 @@ > > > > #include <stdint.h> > > > > +#include <osmocom/core/endian.h> > > #include <osmocom/gsm/protocol/gsm_04_12.h> > > > > /* GSM TS 03.41 definitions also TS 23.041*/ > > @@ -13,19 +14,36 @@ > > /* Chapter 9.3.2 */ > > struct gsm341_ms_message { > > struct { > > +#ifdef OSMO_IS_LITTLE_ENDIAN > > uint8_t code_hi:6; > > uint8_t gs:2; > > uint8_t update:4; > > uint8_t code_lo:4; > > +#else > > + uint8_t code_lo:4; > > + uint8_t update:4; > > + uint8_t gs:2; > > + uint8_t code_hi:6; > > +#endif > > } serial; > > uint16_t msg_id; > > struct { > > +#ifdef OSMO_IS_LITTLE_ENDIAN > > uint8_t language:4; > > uint8_t group:4; > > +#else > > + uint8_t group:4; > > + uint8_t language:4; > > +#endif > > } dcs; > > struct { > > +#ifdef OSMO_IS_LITTLE_ENDIAN > > uint8_t total:4; > > uint8_t current:4; > > +#else > > + uint8_t current:4; > > + uint8_t total:4; > > +#endif > > } page; > > uint8_t data[0]; > > } __attribute__((packed)); > > @@ -33,12 +51,21 @@ struct gsm341_ms_message { > > /* Chapter 9.4.1.3 */ > > struct gsm341_etws_message { > > struct { > > +#ifdef OSMO_IS_LITTLE_ENDIAN > > uint8_t code_hi:4; > > uint8_t popup:1; > > uint8_t alert:1; > > uint8_t gs:2; > > uint8_t update:4; > > uint8_t code_lo:4; > > +#else > > + uint8_t code_lo:4; > > + uint8_t update:4; > > + uint8_t gs:2; > > + uint8_t alert:1; > > + uint8_t popup:1; > > + uint8_t code_hi:4; > > +#endif > > } serial; > > uint16_t msg_id; > > uint16_t warning_type; > > -- > > 2.6.2 > > > > -- > > - Harald Welte <laforge@gnumonks.org> > > http://laforge.gnumonks.org/ > > ============================================================================ > > "Privacy in residential applications is a desirable marketing option." > > (ETSI EN 300 175-7 Ch. > > A6) >
On Wed, Dec 09, 2015 at 03:30:25AM -0500, Jaroslav Skarvada wrote: > Hi, > > thanks, I encountered the same in Fedora on ppc machines. > Unfortunately, the patch even with '#if OSMO_IS_LITTLE_ENDIAN == 1' Has the status changed with the patch? According to https://buildd.debian.org/status/fetch.php?pkg=libosmocore&arch=powerpc&ver=0.9.0-3&stamp=1449648141 from https://buildd.debian.org/status/package.php?p=libosmocore the test suite has succeeded on powerpc. Does that mean the problem is resolved? (Previously, the test smscb failed, now it says "smscb ok") If not, I could try it, too; asking my fellow geeky neighbor for a BE machine... As a side note, even though the above "#if" should work, to me it looks unusual to explicitly write "== 1". It suffices to remove the "def" from "#ifdef": #if OSMO_IS_LITTLE_ENDIAN ... #endif which is skipped when OSMO_IS_LITTLE_ENDIAN == 0 and is run when OSMO_IS_LITTLE_ENDIAN != 0, more like your typical int-as-boolean logic, and would also work as expected if OSMO_IS_LITTLE_ENDIAN were 2 ;) ~Neels
diff --git a/include/osmocom/gsm/protocol/gsm_03_41.h b/include/osmocom/gsm/protocol/gsm_03_41.h index 0ece6cc..f007cc1 100644 --- a/include/osmocom/gsm/protocol/gsm_03_41.h +++ b/include/osmocom/gsm/protocol/gsm_03_41.h @@ -2,6 +2,7 @@ #include <stdint.h> +#include <osmocom/core/endian.h> #include <osmocom/gsm/protocol/gsm_04_12.h> /* GSM TS 03.41 definitions also TS 23.041*/ @@ -13,19 +14,36 @@ /* Chapter 9.3.2 */ struct gsm341_ms_message { struct { +#ifdef OSMO_IS_LITTLE_ENDIAN uint8_t code_hi:6; uint8_t gs:2; uint8_t update:4; uint8_t code_lo:4; +#else + uint8_t code_lo:4; + uint8_t update:4; + uint8_t gs:2; + uint8_t code_hi:6; +#endif } serial; uint16_t msg_id; struct { +#ifdef OSMO_IS_LITTLE_ENDIAN uint8_t language:4; uint8_t group:4; +#else + uint8_t group:4; + uint8_t language:4; +#endif } dcs; struct { +#ifdef OSMO_IS_LITTLE_ENDIAN uint8_t total:4; uint8_t current:4; +#else + uint8_t current:4; + uint8_t total:4; +#endif } page; uint8_t data[0]; } __attribute__((packed)); @@ -33,12 +51,21 @@ struct gsm341_ms_message { /* Chapter 9.4.1.3 */ struct gsm341_etws_message { struct { +#ifdef OSMO_IS_LITTLE_ENDIAN uint8_t code_hi:4; uint8_t popup:1; uint8_t alert:1; uint8_t gs:2; uint8_t update:4; uint8_t code_lo:4; +#else + uint8_t code_lo:4; + uint8_t update:4; + uint8_t gs:2; + uint8_t alert:1; + uint8_t popup:1; + uint8_t code_hi:4; +#endif } serial; uint16_t msg_id; uint16_t warning_type;