A Rust runtime, SDK, and toolchain for the Sony PlayStation 3 (Cell Broadband Engine) (formerly hello-cell).
#![no_std]
#![no_main]
use ps3::alloc::boxed::Box;
use ps3::alloc::format;
use ps3::allocator;
use ps3::println;
use ps3::sys::syscalls;
#[ps3::main]
fn main() -> i32 {
println!("Hello PlayStation 3 from Rust!");
let boxed_val = Box::new(0x1337_4242_u64);
println!("Boxed Value: {:#X}", *boxed_val);
let stats = allocator::get_heap_stats();
println!("Active Allocs: {}, Active Bytes: {} bytes", stats.active_allocations, stats.active_bytes);
0
}See examples/ directory for sample programs (examples/hello-world and examples/http-server).
-
core&allocsupport (talcfast allocator backed bysys_memory_allocate/sys_memory_free) - PowerPC64 ELFv1 ABI support (Big-Endian Cell PPU)
- LV2 Syscall dispatcher (direct inline assembly syscalls via
sc 11) - TTY / Standard I/O output via
sys_tty_write -
moldier: ELF post-linker and OPD function descriptor patcher formold - Automated SPRX dynamic stub generator (
sprx.toml) and linker binding - Network socket layer (
sys_net/cellSysmodulestubs, TCP listener & streams) - Direct compilation via Rust
json-target-specwithout legacy cross-compiler toolchains - SPU (Synergistic Processing Unit) toolchain & inter-processor communication (MFC DMA / mailboxes)
- RSX / libgcm 3D graphics hardware acceleration
-
stdsupport - Automated self /
EBOOT.BINpackaging
Traditional PS3 homebrew relies on the legacy GCC-based PSL1GHT SDK or the official Sony Cell SDK.
rust-ps3 (formerly hello-cell) is a standalone, modern toolchain and runtime built directly on top of upstream LLVM/rustc:
- Targets 64-bit PowerPC ELFv1 (
powerpc64-unknown-linux-gnureference target spec, customized topowerpc64-sony-ps3for CellOS and PPU). - Links binaries using the modern high-performance
moldlinker. - Patches the final binary with
moldier, a small(ish) post-linker tool that generates SPRX import stubs from TOML definitions and patches Sony LV2 Official Procedure Descriptors (OPD) and TOC relocations directly into the final ELF.
To compile for the PS3, you will need a Rust nightly toolchain with the rust-src component:
$ rustup default nightly && rustup component add rust-srcYou also need the mold linker installed and available in your PATH:
# macOS (Homebrew)
$ brew install mold
# Arch Linux
$ pacman -S mold
# Ubuntu / Debian
$ apt install mold(Optional) If you want to automatically generate signed EBOOT.BIN files for retail/CFW PS3s, install make_fself into your PATH.
To build one of the examples (e.g. hello-world or http-server), run:
# Linux / macOS
$ ./scripts/build.sh hello-world
# or
$ ./scripts/build.sh http-server
# Windows (PowerShell)
$ .\scripts\build.ps1 -TargetExample hello-world
# or
$ .\scripts\build.ps1 -TargetExample http-serverThe build script will:
- Compile the host tool
moldier. - Generate assembly stubs (
ps3/src/sys/sprx.s) fromps3/sprx.toml. - Compile and link the chosen example package using
rustcandmold. - Run
moldier patchon the output ELF to resolve LV2 OPD descriptors and SPRX imports. - Produce
EBOOT.ELF(andEBOOT.BINifmake_fselfis available) in the project root.
You can run EBOOT.ELF directly in RPCS3.
- Place
EBOOT.BINinside a game directory on your PS3 internal HDD or USB drive:/dev_hdd0/game/HELLOCELL/USRDIR/EBOOT.BIN - Alternatively, mount and run directly via
webMAN MODor/app_home/PS3_GAME/. - Even more alternatively, use a Target Manager to upload the binary to your PS3 and run it.
rust-ps3 allows defining Sony PRX module imports cleanly in sprx.toml. moldier parses this file, generates the appropriate assembly stubs, and binds them to the binary:
[libraries.cellSysmodule]
module_id = 0x0009
functions = [
{ name = "sysModuleLoad", fnid = 0x32267A31 },
{ name = "sysModuleUnload", fnid = 0x112A5EE9 },
]
[libraries.sys_net]
module_id = 0x0009
functions = [
{ name = "netInitializeNetworkEx", fnid = 0x139a9e9b },
{ name = "netSocket", fnid = 0x9c056962 },
{ name = "netConnect", fnid = 0x64f66d35 },
{ name = "netBind", fnid = 0xb0a59804 },
{ name = "netListen", fnid = 0x28e208bb },
{ name = "netAccept", fnid = 0xc94f6939 },
]Debug symbols are preserved in EBOOT.ELF. You can inspect and debug binaries using:
- RPCS3 Built-in Debugger / GDB Server: Enable GDB debugging in RPCS3 settings and connect
gdb-multiarchorpowerpc64-linux-gnu-gdb. - TTY Output: View real-time standard output and panic messages via
sys_tty_writein the RPCS3 log window or PS3 Net Server.
- OpenTM - A fully open-source Target Manager for the PlayStation 3.
- scetool - A tool for signing and verifying PS3 EBOOTs and SPRXs.
See LICENSE.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.