Author: wmb Date: Mon Jun 6 18:49:08 2011 New Revision: 2250 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2250
Log: Wrapper - fixed alignment and endianness issue introduced by svn 2182. It worked fine when building on an x86 host, which is little-endian and alignment-agnostic. It failed on a little-endian, alignment-required ARM host, and would have failed on a big-endian host.
Modified: forth/wrapper/wrapper.c
Modified: forth/wrapper/wrapper.c ============================================================================== --- forth/wrapper/wrapper.c Mon Jun 6 03:46:57 2011 (r2249) +++ forth/wrapper/wrapper.c Mon Jun 6 18:49:08 2011 (r2250) @@ -2390,9 +2390,16 @@ crc = lbflip(crc); inlen = lbflip(inlen); #endif - *(unsigned long *)&outbuf[10 + datalen + 0] = crc; - *(unsigned long *)&outbuf[10 + datalen + 4] = inlen; - return (10 + datalen + 8); + /* The CRC and input length are little-endian, not necessarily aligned */ + outbuf[10 + datalen] = crc & 0xff; + outbuf[11 + datalen] = (crc>>8) & 0xff; + outbuf[12 + datalen] = (crc>>16) & 0xff; + outbuf[13 + datalen] = (crc>>24) & 0xff; + outbuf[14 + datalen] = inlen & 0xff; + outbuf[15 + datalen] = (inlen>>8) & 0xff; + outbuf[16 + datalen] = (inlen>>16) & 0xff; + outbuf[17 + datalen] = (inlen>>24) & 0xff; + return (18 + datalen); }
INTERNAL long