On AW.net, people were discussing the difficulty (or otherwise) of fixing the Endian issues in the JavaScript part of WebKit, so that Odyssey can be updated. Made more difficult by the up-stream maintainers not being interested in accepting Big Endian (aka PPC) fixes. But this problem is hardly isolated to that - many programs (of varying sizes) assume x86 endianess, and each time the program is ported/updated, someone has to find & fix all those tricky endian issues.
Wouldn't it be so much easier if AmigaOS directly supported running certain tasks in a special Little Endian mode? PPC can apparently already change it's endianess, so this doesn't seem completely far-fetched. Here's what I posted on AW.net:
Tony rebutted that post, so I then replied with:A crazy idea that's not a short-term solution, but might require less effort in the long term:
What if the (Amiga) OS was modified to allow certain tasks to run in the PPC's "Little Endian" mode? You'd also need to mark memory allocated by it as being "Little Endian", and automatically do endian-swaps when it accessed memory NOT allocated by it. Probably also other situations where endianess would need to be swapped (e.g. calling OS procedures, if the parameters are stored on the stack).
Now surely that is a lot of work, but it would "automagically" mean that any future ports (not just WebKit) would not have any Endianess issues.
Now perhaps someone can tell me why this crazy idea wouldn't be possible?
@tonywI partially already raised that issue & it's solution in my first post. Let me elaborate a bit:It wouldn't be possible because the very first Exec or library call that includes a multi-byte variable in a structure is going to fail. A longword 0x12345678 is going to be read backwards (0x78563412) by a task running in the opposite endian-ness.
A task running in Little Endian mode requests memory from Exec. It gets given memory from special memory pages marked as "Little Endian". The idea here being that the MMU could be used to detect accesses to Little vs Big Endian memory pages, and perform the necessary endian swap. So for Little Endian tasks, the MMU would have to trap access to all non-Little-Endian memory pages (basically all normal Amiga memory), and do a swap.
What I'm not clear on is (1) whether this is actually possible, and (2) how big of performance hit would it cause (probably a fair bit, but as long as L.E. tasks rarely interact with the OS it should be fine).