Alignment problem on Xscale platform.
Hi,
I'm working on an xscale platform where the /etc/hosts file is corrupted. The IP values stored in HEX format in database are read and converted to IP using inet_ntoa(address) and /etc/hosts file is updated.
But for some reason the values read from the database are misaligned resulting in an invalid IP getting populated in the /etc/hosts file.
**************************************
void *data;
struct in_addr address;
:
:
data = somefunction() // that returns a void*
address.s_addr = *((in_addr_t *) data)
IpAddress = inet_ntoa (address);
printf ("address=%X, address.s_addr)
****************************************
Hex data stored in Database.
AC188800 (equivalent to 172.24.136.0)
On i686 architecture above code prints
address=8818AC
On PPC architecture it prints
address=AC188800
but on Xscale architecture it prints
address=ACACACAC
Eg: 2
Database entry: AC180011
i686 : 110018AC
PPC : AC180011
Xscale: 18000500
I read some posts that xscale platform has some alignment problems. Can you please confirm above code can result in any alignment problems and is there any solution for this problem??
Below is the linux version running on the xscale machine.
Linux baseserver 2.6.10-pne #1 Thu Nov 1 16:23:25 EDT 2012 armv5teb GNU/Linux
Let me know if any other details are needed.
|