Compare commits

...

2 Commits

Author SHA1 Message Date
c017eb630a PPC context header adjustments. (#123) 2025-03-21 17:40:55 +03:00
82b4cd3bb7 Fix return value from longjmp getting forgotten after setjmp. (#122)
Restoring env to ctx was causing this because the return value was getting assigned to r3 before the if check.
2025-03-21 17:38:08 +03:00
2 changed files with 26 additions and 31 deletions

View File

@ -378,8 +378,9 @@ bool Recompiler::Recompile(
else if (address == config.setJmpAddress)
{
println("\t{} = ctx;", env());
println("\t{}.s64 = setjmp(*reinterpret_cast<jmp_buf*>(base + {}.u32));", r(3), r(3));
println("\tif ({}.s64 != 0) ctx = {};", r(3), env());
println("\t{}.s64 = setjmp(*reinterpret_cast<jmp_buf*>(base + {}.u32));", temp(), r(3));
println("\tif ({}.s64 != 0) ctx = {};", temp(), env());
println("\t{} = {};", r(3), temp());
}
else
{

View File

@ -123,21 +123,18 @@ struct PPCFuncMapping
extern PPCFuncMapping PPCFuncMappings[];
struct PPCRegister
union PPCRegister
{
union
{
int8_t s8;
uint8_t u8;
int16_t s16;
uint16_t u16;
int32_t s32;
uint32_t u32;
int64_t s64;
uint64_t u64;
float f32;
double f64;
};
int8_t s8;
uint8_t u8;
int16_t s16;
uint16_t u16;
int32_t s32;
uint32_t u32;
int64_t s64;
uint64_t u64;
float f32;
double f64;
};
struct PPCXERRegister
@ -194,21 +191,18 @@ struct PPCCRRegister
}
};
struct alignas(0x10) PPCVRegister
union alignas(0x10) PPCVRegister
{
union
{
int8_t s8[16];
uint8_t u8[16];
int16_t s16[8];
uint16_t u16[8];
int32_t s32[4];
uint32_t u32[4];
int64_t s64[2];
uint64_t u64[2];
float f32[4];
double f64[2];
};
int8_t s8[16];
uint8_t u8[16];
int16_t s16[8];
uint16_t u16[8];
int32_t s32[4];
uint32_t u32[4];
int64_t s64[2];
uint64_t u64[2];
float f32[4];
double f64[2];
};
#define PPC_ROUND_NEAREST 0x00
@ -270,7 +264,7 @@ struct PPCFPSCRRegister
}
};
struct PPCContext
struct alignas(0x40) PPCContext
{
PPCRegister r3;
#ifndef PPC_CONFIG_NON_ARGUMENT_AS_LOCAL