Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

PowerPCs have configurable endianness in the MSR register, but boot into big endian mode by default. macOS used it in big endian mode. Linux I can't speak to but believe you can pick based on kernel build config. As for IBM's OS' or the ones running on consoles, I can't speak to that.

The interesting part is that the motherboard also needs to support the specific endianness chosen, and when running in little-endian mode, it needs to perform a 64-bit byte swap on all data going in or out [1].

[1] https://en.wikipedia.org/wiki/PowerPC#Endian_modes



Linux gained support for little endian on IBM Power server CPUs in late 2013, in the lead-up to the release of the POWER8, where LE became the officially recommended option for running Linux. As you say, it's selectable at build time.


The PowerPC instruction set is ideal for emulating other instruction sets, since has byte swap instructions, and the delightful rlwinm instruction, and you could shift and mask for free with many instructions, which is great for decoding opcodes.

https://devblogs.microsoft.com/oldnewthing/20180810-00/?p=99...

Anybody remember Connectix SpeedDoubler for PowerPC Macs? MacOS could emulate old 68K apps correctly but slowly, but Connectix SpeedDoubler recompiled 68K to PPC instructions on the fly! And it flew!

At Interval we were running 68k Mac Common Lisp with Connectix Speed Double on PowerPC Macs, and it would compile huge piles of Lisp code into 68k instructions, then when you ran it, Connectix Speed Doubler would compile that into PPC instructions to execute, and it actually worked quite well!

https://www.macobserver.com/reviews/sd8.shtml

>On systems with PowerPC processors, Speed Doubler provides faster 68k emulation. When Speed Doubler was first released a few years ago, this was a very important feature, as there were still many popular applications which were not PowerPC native; nowadays, not many people use non-native software. Nevertheless, we dug up an old copy of MacDraw Pro, and were quite impressed with the results. Overall, performance was much improved. For example, launching the program took just 5 seconds, compared with 13 seconds without SD8 installed.

>The Mac OS's emulator translates every instruction each time, while Speed Doubler 8 compiles it the first time, so it can be executed immediately on subsequent times because it has already been translated. This technique, called dynamic recompiling, is responsible for SD8's greatly improved emulation.

https://tidbits.com/1995/08/28/speed-doubler-quickens-the-pa...

>Faster Than a Speeding Power Mac — The final component in the Speed Doubler suite is the PowerPC Speed Emulator, and this component is what earns Speed Doubler its name. One of the weak points of a Power Mac is that it must run in the slower emulation mode when working with 68K-based software. Apple took some heat earlier this year for improving the Power Mac 68K emulator for the PowerPC 604-based Macs and not improving emulation in first-generation Power Macs. Well, fret no more. Not only does Speed Emulator improve the speed of your Power Mac when running 68K applications, it’s reputed to be 30 percent faster than Apple’s improved emulator! I’ve noticed a dramatic improvement of at least 50-75 percent over the week I’ve used it. Speed Emulator won’t improve the performance of native software – since native software already takes full advantage of the PowerPC chip – but remember that significant portions of the Mac OS are still non-native and Speed Doubler improves performance in those areas. Of course, Speed Emulator only works with Power Macs and is of no use on 68K-based machines, but Speed Doubler works on any Power Mac, not just Apple’s latest crop.

There was also Connectix RAM Doubler, which compressed stale pages, and even if it didn't literally "double" your RAM, it certainly helped.

https://tidbits.com/2019/01/24/25-years-ago-in-tidbits-ram-d...

>First up—check out this piece I wrote a quarter century ago from Macworld Expo San Francisco: “RAM Doubler” (10 January 1994). Developed by Connectix, RAM Doubler was one of the most magical utilities of the early days of the Macintosh. As its name suggested, RAM Doubler promised to double the amount of usable RAM in your Mac, and amazingly, it generally delivered.

https://tidbits.com/1994/01/10/ram-doubler/

>RAM Doubler is a single small extension that literally doubles your RAM. It’s not guessing at a 2:1 compression ratio, like Salient’s AutoDoubler and DiskDoubler (now owned by Symantec) – you actually see your total memory being twice your built-in memory. Since RAM Doubler is an extension, there are no controls, no configuration. You just install it and it doubles the amount of application RAM you have available.

At the time, MacOS on PowerPCs was fast but flakey, with no protection. So the tiniest little bug in a C program would freeze the machine, and it took ages to reboot, and even longer to get back into the flow of what you were doing when you made a little typo in your C code.

In terms of sheer productivity, it was well worth the cost of the emulation layer to program in a safe language like Mac Common Lisp that didn't crash the system all the time.

What I really wanted was Connectix Reboot Halfer, since that would have saved me even more time if every other reboot were free!


Why does it have a switch for that, and wouldn't it have a big overhead?


IBM has traditionally been a big-endian shop - mainframes are BE, AIX and IBM i on Power are BE. The Motorola 68K, which Apple was using before switching to PowerPC, was also BE.

LE support was in the original PowerPC chips from the 90s, and was used to support the Windows NT port that existed until NT4. Then switchable endianness disappeared for a while, and finally came back in POWER8 when IBM decided it wanted to expand the market for Power and that LE was helpful because it makes porting easier and is more familiar to x86 programmers.

It doesn't, AFAIK, have any overhead - remember that byte swapping can be done in combinational logic.


combinatorial logic... I guess byte order is just about which order you connect the wires between two components, and then it's free modulo "wire" length. That's my circuit board model of it, then.


I honestly have no idea haha. I speculate big machines dealing with legacy data or code not expecting big endian have an escape hatch that doesn't involve a complete rewrite.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: