[Kernel] Return POSIX results from _open and keep sceKernelOpen raw
Co-authored-by: Sekai <140012992+SekaixX@users.noreply.github.com>
This commit is contained in:
parent
8c0ca1a2a7
commit
d3deab28aa
|
|
@ -399,7 +399,7 @@ public static class KernelExports
|
||||||
ExportName = "sceKernelOpen",
|
ExportName = "sceKernelOpen",
|
||||||
Target = Generation.Gen4 | Generation.Gen5,
|
Target = Generation.Gen4 | Generation.Gen5,
|
||||||
LibraryName = "libKernel")]
|
LibraryName = "libKernel")]
|
||||||
public static int KernelOpen(CpuContext ctx) => KernelMemoryCompatExports.KernelOpenUnderscore(ctx);
|
public static int KernelOpen(CpuContext ctx) => KernelMemoryCompatExports.KernelOpenCore(ctx);
|
||||||
|
|
||||||
[SysAbiExport(
|
[SysAbiExport(
|
||||||
Nid = "mqQMh1zPPT8",
|
Nid = "mqQMh1zPPT8",
|
||||||
|
|
|
||||||
|
|
@ -1440,7 +1440,9 @@ public static partial class KernelMemoryCompatExports
|
||||||
ExportName = "_open",
|
ExportName = "_open",
|
||||||
Target = Generation.Gen4 | Generation.Gen5,
|
Target = Generation.Gen4 | Generation.Gen5,
|
||||||
LibraryName = "libKernel")]
|
LibraryName = "libKernel")]
|
||||||
public static int KernelOpenUnderscore(CpuContext ctx)
|
public static int KernelOpenUnderscore(CpuContext ctx) => PosixOpen(ctx);
|
||||||
|
|
||||||
|
internal static int KernelOpenCore(CpuContext ctx)
|
||||||
{
|
{
|
||||||
var pathAddress = ctx[CpuRegister.Rdi];
|
var pathAddress = ctx[CpuRegister.Rdi];
|
||||||
var flags = unchecked((int)ctx[CpuRegister.Rsi]);
|
var flags = unchecked((int)ctx[CpuRegister.Rsi]);
|
||||||
|
|
@ -1678,11 +1680,11 @@ public static partial class KernelMemoryCompatExports
|
||||||
}
|
}
|
||||||
|
|
||||||
// POSIX open(2): translates a failed raw open into -1/errno. On success
|
// POSIX open(2): translates a failed raw open into -1/errno. On success
|
||||||
// KernelOpenUnderscore already writes the fd into RAX (the import bridge
|
// KernelOpenCore already writes the fd into RAX (the import bridge
|
||||||
// prefers a written RAX over the return value), so returning 0 is correct.
|
// prefers a written RAX over the return value), so returning 0 is correct.
|
||||||
public static int PosixOpen(CpuContext ctx)
|
public static int PosixOpen(CpuContext ctx)
|
||||||
{
|
{
|
||||||
var result = KernelOpenUnderscore(ctx);
|
var result = KernelOpenCore(ctx);
|
||||||
return result == (int)OrbisGen2Result.ORBIS_GEN2_OK
|
return result == (int)OrbisGen2Result.ORBIS_GEN2_OK
|
||||||
? 0
|
? 0
|
||||||
: PosixFailure(ctx, result);
|
: PosixFailure(ctx, result);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue