chen-charles / psp2cldr

Loading userspace PSP2 VELFs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

psp2cldr - PSP2 Custom Loader

Loading userspace PSP2 VELFs.

Native

psp2cldr runs directly on arm32v7-linux and thus also on aarch64 with CONFIG_COMPAT kernels.

via QEMU System Emulation

virt platform with smp=4 and 4G memory

via QEMU User Mode Emulation (qemu-linux-user)

Memory leak is under investigation #2.
arm-none-linux-gnueabihf
Make sure to use a recent release of qemu-arm. (for the record, qemu-arm version 2.11.1 is not one of them).
Tested with qemu-arm version 6.1.0 (qemu-6.1.0-10.fc35).

via Docker

Memory leak is under investigation #2.

arm32v7/fedora:33, arm32v7/fedora:34, arm32v7/fedora:35

  • Recommended, comes with a working CMake, GCC 10/11.

arm32v7/ubuntu:focal

arm64v8/ubuntu:jammy

  • Demonstrates we could run natively on aarch64.

Native_MSVC

psp2cldr also runs directly on arm64-windows (not arm-uwp) when compiled for the ARM target (e.g., amd64_arm, x86_arm, arm64_arm).
MSVC Redistributable for ARM seems to be missing on arm64-windows #4. Extracted runtime libraries can be found here.

Usage

  1. Display information of the supplied VELF
    psp2cldr --readelf XXX.velf
  2. Load ELFs, and optionally VELFs (see usage via psp2cldr -h)

Routine Providers

See Guide
See Sample
See psp2cldr Newlib OS Support Reference Implementation

Supplementary ELFs

psp2cldr provides a mechanism to load supplementary ELFs into the address space of the target. DT_NEEDED tag is respected.
Supplementary ELFs need to be built for the target platform. A custom toolchain has been assembled to permit C(newlib + pthread-embedded) and C++ library usages.

arm-vita-eabi-g++ -shared a.cc -o supp_elf.so

The following libraries need to be loaded from the toolchain,

libc.so
libm.so
libpthread.so
libgcc_s.so
libstdc++.so

Known Limitations

  • Only e_type == ET_SCE_RELEXEC is supported, partly because in native mode we cannot enforce the binary to be loaded at an exact location.
  • Only relocation type 0 and 1 are implemented. User VELFs tend to not use types 2 to 9.

Dependencies

Installed automatically if not found

Building

See Dockerfile

License

MIT

About

Loading userspace PSP2 VELFs

License:MIT License


Languages

Language:C 49.0%Language:C++ 48.0%Language:CMake 1.7%Language:Dockerfile 1.3%