Skip to content

include: declare exported libkernel memory and thread APIs - #72

Closed
mihawk-99 wants to merge 1 commit into
ps5-payload-dev:masterfrom
mihawk-99:add-libkernel-header
Closed

mihawk-99 wants to merge 1 commit into
ps5-payload-dev:masterfrom
mihawk-99:add-libkernel-header

Conversation

@mihawk-99

Copy link
Copy Markdown
Contributor

The SDK already provides link stubs for the kernel memory and thread functions used by my homebrew ports, but each consumer has to supply its own C declarations. This adds <ps5/libkernel.h> so those declarations can be shared.

The header covers 20 existing exports: direct and flexible memory, virtual reservations and protection, the JIT shared-memory interface, timestamps, CPU affinity, and system-software version queries. It includes the associated constants and version record already used in my platform header.

<ps5/kernel.h> keeps its existing kernel-introspection role. This change adds no library, allocator, runtime behavior, or stub symbols. The normal header installation already picks up the new file.

Example:

#include <ps5/libkernel.h>

struct ps5_kernel_sw_version version = {.size = sizeof(version)};
/* Check the return value before reading the record. */
int result = sceKernelGetSystemSwVersion(&version);

Validation

Compiled the header as C11 and C++11 with Clang 23.1.1 targeting PS5, with -Wall -Wextra -Werror. Checked the version record's size (40 bytes) and version-field offset (36). A test object takes the address of every declaration; all 20 names remain unmangled in C++, match libkernel_web stubs, and link into a normal SDK payload.

Draft: these checks establish source and link compatibility with the existing downstream declarations. They do not independently verify every function signature on every firmware. In particular, an exported JIT API can still be refused by the process's privileges. Header placement, naming, and ABI coverage are open for review before this is treated as a stable public interface.

Refs #70.

@john-tornblom

Copy link
Copy Markdown
Contributor

See #71 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants