Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Crixus wrote:Why all numerical data in mkfs.c XV6 file system image creator, are converted from big<-->little endian and vice versa.
It converts between host-endian and little-endian. On a big-endian host, it converts between big-endian and little-endian. On a little-endian host, the conversion doesn't do anything.
It does that because mkfs needs to be able to run on both big-endian and little-endian CPUs, but the filesystem is always little-endian.
On a Big Endian system:
Original x in memory: [12][34][56][78]
After xint(), y in memory: [78][56][34][12] (bytes are reversed)
This will appear as a change when viewing memory.
On a Little Endian system:
Original x in memory: [78][56][34][12]
After xint(), y in memory: [78][56][34][12] (bytes stay in same order)
This will appear as no change when viewing memory.
And so the disk image is in little endian... when a big endian proc have to use it, it should reverse all numerical data every times ?