Page 1 of 1
Any in-depth sources on PowerPC assembly?
Posted: Tue Dec 29, 2020 9:39 am
by xatja
Recently I decided I would like to build a kernel for my PowerMac G5, just for sport.
Having primarily worked with x86 assembly, ppc assembly looks like absolute bird language to me.
Does anyone know an in-depth source on ppc assembly, that explains the rationale behind its syntax where necessary?
Re: Any in-depth sources on PowerPC assembly?
Posted: Wed Dec 30, 2020 2:26 am
by bloodline
I tried to learn PPC asm back in the late ‘90s, and I found it a real struggle.
The mnemonics are obscure and the operations are very specific... It was clearly designed to be written by a compiler not a human.
It was trying to learn PPC asm which convinced me to properly learn C.
Here’s a link for you:
https://www.ibm.com/developerworks/libr ... index.html
Re: Any in-depth sources on PowerPC assembly?
Posted: Wed Dec 30, 2020 2:42 am
by nullplan
bloodline wrote:I tried to learn PPC asm back in the late ‘90s, and I found it a real struggle.
I have no idea what you mean. I learned PPC assembly a few years ago, when I started to work for a company that uses those chips primarily. And I found it to be an absolute delight. The biggest and most obvious difference to x86 assembly is that all operations are using the three-point form. Which I just found a complete joy to work with. Next thing is that there are few implicit operands, and only in very few operations. x86 has all these weird instructions that have fixed implicit operands you cannot override, and PPC doesn't have a lot of that at all.
OK, so there are tons of mnemonics, but then, x86 has all of these different operations that all have the same mnemonics. I fail to see that as better. And the RISC principle made things very clear to me: You can either be calculating something, or you can be accessing memory, but you can't do both at the same time.
No, the struggle comes in at the system programming level. The userspace is compatible between PowerPC implementations, but the system space can be extremely different. There are implementations that have hardware-based page table walking, and some that don't. There are some with 4 BAT arrays and some with 8. There are some with 1 instruction breakpoint, and some with 2 breakpoints for instructions and data each, and they can be combined to supervise a larger area. And that is just the CPU. The rest of the hardware is so extremely different, you almost need a special OS for each platform on its own. This could in theory happen to you on x86 as well, but the PC is so well established as a platform that few go against the grain there.
Re: Any in-depth sources on PowerPC assembly?
Posted: Wed Dec 30, 2020 9:37 am
by iansjack
The
Compiler Writer's Guide:
https://cr.yp.to/2005-590/powerpc-cwg.pdf is an interesting read. Also the
Programming Environment Manual:
https://wiki.alcf.anl.gov/images/f/fb/P ... nt_2.3.pdf
But the truth is that most coding for a kernel will be done in a higher-level language - in this case, almost certainly C.