sdbfs/kernel: add fixendian flag and code to reverse words
If the host is little-endian and the bus is directly connected as 32
bits, byte access would be wrong. This commit detects the thing from
the magic number value and reversed the words of the SDB records.
Missing that, strings would be reversed and 16-bit fields would be in
the wrong byte offset. Please note that the resulting SDB record
still has big-endian fields.
This problem results from bit 0 being mapped to bit 0 and bit 31 being
mapped to bit 31 (i.e., 32-bit words are native mapped on both sides
of the bridge). However, on the sdb bus bit 31 (MSB) lives at byte 0,
while the little-endian host stores it at byte 3.
Signed-off-by:
Alessandro Rubini <rubini@gnudd.com>
Please register or sign in to comment