Any in-depth sources on PowerPC assembly?

Programming, for all ages and all languages.
Post Reply
xatja
Posts: 2
Joined: Tue Dec 29, 2020 9:26 am
Libera.chat IRC: xatja

Any in-depth sources on PowerPC assembly?

Post 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?
User avatar
bloodline
Member
Member
Posts: 264
Joined: Tue Sep 15, 2020 8:07 am
Location: London, UK

Re: Any in-depth sources on PowerPC assembly?

Post 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. :lol:

Here’s a link for you:
https://www.ibm.com/developerworks/libr ... index.html
CuriOS: A single address space GUI based operating system built upon a fairly pure Microkernel/Nanokernel. Download latest bootable x86 Disk Image: https://github.com/h5n1xp/CuriOS/blob/main/disk.img.zip
Discord:https://discord.gg/zn2vV2Su
nullplan
Member
Member
Posts: 1790
Joined: Wed Aug 30, 2017 8:24 am

Re: Any in-depth sources on PowerPC assembly?

Post 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.
Carpe diem!
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Any in-depth sources on PowerPC assembly?

Post 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.
Post Reply