Skip to content

R5900 processor specific ABI (psABI)

frno7 edited this page Jan 30, 2022 · 16 revisions

The R5900 is the main processor of the PlayStation 2. The R5900 processor specific application binary interface (ABI), the R5900 psABI, is part of the MIPS psABI and the Linux standard base. The R5900 is a 64-bit MIPS III instruction set architecture (ISA), except the instructions LL, SC, LLD and SCD, that therefore are emulated on software by the R5900 Linux kernel. The R5900 has additional PREFETCH and conditional move instructions from the MIPS IV ISA as well as R5900 specific three-operand multiply and multiply-accumulate (MAC) instructions. The R5900 also has a set of specific 128-bit multimedia instructions. The PlayStation 2 endianness is not configurable and is always little-endian. The R5900 does not implement the CP0.Status bits UX, SX, KX or PX.

In addition to the R5900 executable and linkable format (ELF), R5900 Linux also accepts generic MIPS I, MIPS II and perhaps eventually MIPS III programs. However, due to the R5900 short loop erratum, such programs must be compiled with the GAS and GCC option -mfix-r5900 to have the assembler and compiler generate code that does not cause undefined behaviour, including data corruption or crashes.

The MIPS II and MIPS III ISAs include floating point unit (FPU) instructions. However, the R5900 floating point unit (FPU) is not compliant with the IEEE 754 standard as required by the R5900 psABI. The R5900 Linux kernel therefore traps and emulates all FPU instructions. In practice low FPU performance is to be expected since as there is (at this time) no simple way around the IEEE 754 requirement. See issue #3 for details.

R5900 Linux currently implements the o32 ABI, but not yet the n32 ABI.