ppc750cl/README.md

67 lines
1.9 KiB
Markdown
Raw Permalink Normal View History

2021-08-07 17:59:07 -07:00
# ppc750cl
Rust tools for working with the PowerPC 750CL family of processors.
2022-04-06 16:48:21 -07:00
### Rust crates
```shell
rustup components add rustfmt
cargo run --package ppc750cl-genisa
cargo build --release
```
2021-08-16 15:53:29 -07:00
2022-04-06 16:48:21 -07:00
### Python module
2021-08-16 15:53:29 -07:00
```shell
python -m venv env
source ./env/bin/activate
pip install maturin
maturin build -m ./disasm-py/Cargo.toml
```
2022-04-06 16:48:21 -07:00
2022-04-06 20:57:45 -07:00
Install module in dev env
```
maturin develop -m ./disasm-py/Cargo.toml
python
>>> import ppc750cl
2022-04-09 07:30:48 -07:00
>>> ins = ppc750cl.Ins(addr=0x80006969, code=0x10400420)
>>> str(ins)
2022-04-06 20:57:45 -07:00
'ps_merge00 f2, f0, f0'
2022-04-09 08:19:50 -07:00
>>> ins.fields()
[('frD', 2), ('frA', 0), ('frB', 0)]
2022-04-09 07:30:48 -07:00
>>> ins.frD
2
2022-04-06 20:57:45 -07:00
```
2022-04-06 16:48:21 -07:00
### Instruction Set
For those unfamiliar with PowerPC, here are some basics.
- PowerPC 7xx is a family of RISC CPUs produced from 1997 to 2012.
- They operate with 32-bit words and every instruction is 32-bits wide.
- This project focuses (only) on compatibility with the PowerPC 750CL.
- This chip is famously packaged as codename "Broadway" for the Nintendo Wii.
- Its predecessor PowerPC 750CXe is used in the Nintendo GameCube.
- It adds a "paired-singles" SIMD unit and a bunch of other instructions.
### isa.yaml
The file [isa.yaml](./isa.yaml) contains a full definition of the PowerPC 750CL instruction set.
It powers the disassembler, assembler, and Rust/Python bindings code analysis tools.
Similarly to LLVM TableGen, the program `ppc750cl-genisa` generates a Rust file implementing an instruction decoder.
2022-04-06 21:20:53 -07:00
### Safety & Correctness
- This project does not use `unsafe` Rust code outside of testing utils.
- The disassembler has been fuzzed over all ~4.29 billion possible instructions (via `ppc750cl-fuzz`).
- It is safe to run the disassembler over untrusted byte arrays.
- However no guarantees on correctness are made (yet). Expect bugs.
### Performance
- Performance isn't great but acceptable.
- Disassembling & printing: 600k insn/s (2.4 MB/s)
- Disassembling only: 6M insn/s (24 MB/s)