Frederick Gotham <
[email protected]> writes:
So here's the last thing I do:
Step 1) Edit the first 5 bytes in the ELF header of my Dynamo binary
to change it from MSB to LSB
If I were to then run my Dynamo binary, it would of course crash
because all the memory locations are in Big Endian instead of Little
Endian, and so it will segfault. And so that's why I move on to step
2:
Step 2) Use 'readelf' on my binary to find the entry point: "readelf
-h dynamo | grep Entry", and then at that address insert one
instruction "setend be" so that the remainder of the code will be
executed with the CPU in Big Endian mode
So then my program will run in Big Endian mode (even though the statically-linked executable file might be 100 megabytes instead of 5 megabytes).
Will this be possible?
I don’t think the above will work. It will fail the first time that the kernel and application disagree about the endianness of data in the application’s memory.
For this kind of thing to actually work, the application would have to
be marked as MSB and the kernel needs to notice that and swap any
affected data on the way in and out. As far as I can see from a cursory
look, has not been done in Linux.
Any application that depended on communication in native endianness with
other applications would also fail. Obviously that’s very dependent on
what the application does.
--
https://www.greenend.org.uk/rjk/
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)