Hi Paul, Paul Mackerras wrote: > Michael Kerrisk writes: > >> Thanks for taking the time time to provide all that detail. Is that >> otherwise documented somewhere? > > The little-endian mode is documented in the Power Architecture > specification, available from the page at: > > http://www.power.org/resources/downloads/ > > Most of what I wrote was just expanding on the consequences of both > instructions and data changing endianness. > >> And by the way, what do you call this system call? > > endian_switch(), I guess. > >> So I'm not quite comprehending something in the example program. It's >> changing from big-endian to little-endian, right? So what happens >> when do_le_switch() returns? (Or is this function simply inlined >> code?) Above, you just said the stack frames will no longer make >> sense... (I suppose more generally, I'm wondering: given that the >> endianess of instructions changes dynamically after this call, it >> sounds to me like compiled C code would no longer execute after the >> switch. Clearly, I'm missing something.) > > The ".long 0x02000044" is a system call instruction in little-endian > format. So the "sc" (system call) in the asm switches from big-endian > to little-endian, and the ".long 0x02000044" immediately switches back > to big-endian (since the syscall doesn't alter the syscall number in > r0, it's still valid for the second syscall).
Thanks. That was the missing piece ;-). > If the endianness doesn't get change to little-endian, then since > 0x02000044 is an illegal instruction in big-endian mode, the program > will get a SIGILL, which it catches and reports failure. Okay. Thanks! Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ man-pages online: http://www.kernel.org/doc/man-pages/online_pages.html Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
