Current Limitations and Unimplemented PS5 Kernel Functions in SharpEmu

SharpEmu's PS5 kernel compatibility layer consists primarily of empty stub implementations and placeholder comments, leaving critical system APIs like threading, memory allocation, and socket operations non-functional.

SharpEmu is an experimental PlayStation 5 emulator developed by par274 that models the PS5 system software (PSS) kernel through .NET-based HLE (High-Level Emulation). According to the source code in the par274/sharpemu repository, the kernel subsystem located under src/SharpEmu.Libs/Kernel currently provides only scaffolding for exported functions using the SysAbiExportAttribute generator, while the actual implementations remain incomplete.

Empty Kernel Export Registry

The central registry for kernel exports, KernelExports.cs, serves as the intended entry point for all PS5 kernel function mappings. However, as implemented in src/SharpEmu.Libs/Kernel/KernelExports.cs, this class contains only placeholder comments:

public static class KernelExports
{
    // TODO: ... ... ...
    // TODO ...
    // ...
}

This empty structure means that the majority of PS5 kernel entry points are not yet registered or mapped to the emulator's HLE layer.

Memory Allocation Stubs

Virtual memory management is critical for PS5 emulation, but KernelVirtualRangeAllocator.cs provides only non-functional stubs. Located at src/SharpEmu.Libs/Kernel/KernelVirtualRangeAllocator.cs, the allocator's methods return hardcoded zero values instead of managing actual address ranges:

public class KernelVirtualRangeAllocator
{
    public void AddRange(ulong start, ulong end)
    {
        // TODO: implement allocation logic ...
    }

    public ulong Allocate(ulong size, ulong alignment = 4096)
    {
        // TODO: allocate a range ...
        return 0;
    }
}

Calling Allocate() with any size parameter will always return 0x0, preventing proper virtual memory mapping for guest applications.

Threading API Placeholders

The POSIX threading compatibility layer in KernelPthreadCompatExports.cs declares functions like scePthreadCreate but lacks actual threading logic. The implementation in src/SharpEmu.Libs/Kernel/KernelPthreadCompatExports.cs simply returns zero without creating threads or managing attributes:

[SysAbiExport("scePthreadCreate", 0x12345678)]
public static ulong PthreadCreate(HostContext ctx, ulong threadId, ulong attr)
{
    // Not yet implemented
    return 0;
}

This stub prevents any multi-threaded PS5 applications from functioning, as thread creation calls complete without error but produce no actual execution contexts.

Network and IPC Subsystems

Socket operations and inter-process communication remain entirely unimplemented. The KernelSocketCompatExports.cs file at src/SharpEmu.Libs/Kernel/KernelSocketCompatExports.cs contains only a TODO comment:

public static class KernelSocketCompatExports
{
    // TODO: Implement socket related functions
}

Similarly, the repository analysis indicates that KernelSemaphoreCompatExports.cs, KernelEventQueueCompatExports.cs, and KernelEventFlagCompatExports.cs exist as placeholder classes without functional implementations for synchronization primitives or event notification systems.

Runtime and File System Gaps

According to the repository analysis, additional critical subsystems including KernelRuntimeCompatExports.cs (process control), KernelMemoryCompatExports.cs (memory allocation), and KernelFileExtendedExports.cs (file I/O operations) contain only placeholder comments. These files lack implementations for essential functions such as sceKernelExitProcess, sceKernelAllocateMemory, and file descriptor operations.

Practical Impact on Emulation

When guest code invokes these unimplemented kernel functions, the emulator returns default values without performing the requested operations. For example, attempting to create a pthread or allocate virtual memory results in immediate zero returns:

// Attempting to create a thread returns 0 without spawning anything
ulong result = SharpEmu.Libs.Kernel.KernelPthreadCompatExports.PthreadCreate(ctx, 0, 0);
Console.WriteLine($"scePthreadCreate returned: {result}"); // Output: 0

// Attempting to allocate memory returns 0x0
var allocator = new SharpEmu.Libs.Kernel.KernelVirtualRangeAllocator();
ulong addr = allocator.Allocate(size: 0x1000);
Console.WriteLine($"Allocated address: 0x{addr:X}"); // Output: 0x0

This behavior limits SharpEmu to very simple workloads that do not invoke kernel services, as any dependency on threading, memory management, or I/O will encounter silent failures.

Summary

  • KernelExports.cs is empty, providing no central registry for PS5 kernel functions
  • KernelVirtualRangeAllocator.cs returns zero via stub methods, preventing virtual memory allocation
  • KernelPthreadCompatExports.cs contains non-functional scePthreadCreate that returns 0 without spawning threads
  • KernelSocketCompatExports.cs exists only as a skeleton with TODO comments, lacking socket operations
  • Semaphore, event, and file I/O subsystems are entirely unimplemented according to the source analysis
  • Memory and runtime compatibility exports contain only placeholder comments without actual logic

Frequently Asked Questions

Why do PS5 kernel functions return zero in SharpEmu?

The return value of 0 indicates a placeholder implementation. According to the source code in KernelPthreadCompatExports.cs and KernelVirtualRangeAllocator.cs, these methods contain only comments like // Not yet implemented or // TODO: allocate a range, causing them to return default zero values instead of actual handles or error codes.

Which PS5 kernel subsystems are completely missing from SharpEmu?

Based on the repository analysis, the following are entirely stubbed with no implementation logic: socket operations (KernelSocketCompatExports), semaphore management (KernelSemaphoreCompatExports), event queues and flags (KernelEventQueueCompatExports, KernelEventFlagCompatExports), asynchronous procedure calls (KernelAprCompatExports), and extended file operations (KernelFileExtendedExports).

Can SharpEmu run PS5 applications that require kernel services?

Currently, SharpEmu cannot run commercial PS5 software that depends on kernel APIs. The emulator's HLE layer only provides scaffolding via SysAbiExportAttribute annotations. Any guest code calling scePthreadCreate, Allocate, or socket functions will receive null results or zero returns, causing immediate runtime failures for applications requiring threading, memory management, or I/O operations.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →