ack/plat/linuxppc/emu
2018-06-17 11:00:01 +02:00
..
build.lua Implement a non-functional skeleton of the PowerPC emulator (with, hopefully, 2018-06-14 03:07:36 -07:00
emu.c Fix edge case in rlwnm when the mask is 32 bits wide. All tests now pass. 2018-06-17 11:00:01 +02:00
emu.h Do a bit of floating point stuff; added brk(); fixed a horrible bug where 2018-06-16 22:55:23 +02:00
instructions.dat Turns out that andi and andis only have . forms. Fixed; another test passes. 2018-06-17 10:43:39 +02:00
main.c Turns out I was returning values from syscalls in the wrong register; fixed. 2018-06-17 10:22:20 +02:00
mkdispatcher.lua Implement a non-functional skeleton of the PowerPC emulator (with, hopefully, 2018-06-14 03:07:36 -07:00
README.md Lots of floating point, bugfixes, and system calls. Most of the tests pass now. 2018-06-17 09:24:01 +02:00

This is just a naive domestic PowerPC simulator, but I think you'll be amused by its presumption.

The simulator implements just enough of the instruction set to make the tests pass. Certain features aren't supported at all (and an effort has been made to detect this and error out). The FPU is crudely approximated using the native floating-point support, doesn't support reading and writing FPSCR, and will almost certainly produce incorrect results. Plus, there are bugs. It's also likely to be very, very slow.

However, it should be easily extensible and the emulator core is only about 500 lines of code.

Instructions are defined in instructions.dat; mkdispatcher.lua reads these in and generates the instruction decoder. emu.c contains the main emulator core. main.c contains the application front end and the incredibly crude syscall interface.

TODO:

  • overflow bit support (instructions that try to set OV error out)
  • mtcrf
  • read string / write string
  • factor out the ELF loader, and linux68k/emu uses it too
  • floating point condition bits
  • bit-for-bit FPU emulation, although this looks like a huge amount of work

It was written from scratch for the ACK by me, David Given.