mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 08:11:51 +00:00
cellSaveData: Ensure savedata_context members are 16-byte aligned
I saw stvx v128{0} (aligned 16-bytes store) usage on the first 16-bytes of CellSaveDataCBResult before funcStat in fw. Also I saw 4 stw of u32{0} on it as well before funcFile, funcFixed and funcList. So just add the resets for result before all callbacks, and make all members of savedata_ontext 16 -byte aligned in case there are more members guaranteed to be aligned.
This commit is contained in:
parent
ceaee0ec68
commit
01cafc042d
@ -77,15 +77,15 @@ namespace
|
||||
{
|
||||
struct savedata_context
|
||||
{
|
||||
CellSaveDataCBResult result;
|
||||
CellSaveDataListGet listGet;
|
||||
CellSaveDataListSet listSet;
|
||||
CellSaveDataFixedSet fixedSet;
|
||||
CellSaveDataStatGet statGet;
|
||||
CellSaveDataStatSet statSet;
|
||||
CellSaveDataFileGet fileGet;
|
||||
CellSaveDataFileSet fileSet;
|
||||
CellSaveDataDoneGet doneGet;
|
||||
alignas(16) CellSaveDataCBResult result;
|
||||
alignas(16) CellSaveDataListGet listGet;
|
||||
alignas(16) CellSaveDataListSet listSet;
|
||||
alignas(16) CellSaveDataFixedSet fixedSet;
|
||||
alignas(16) CellSaveDataStatGet statGet;
|
||||
alignas(16) CellSaveDataStatSet statSet;
|
||||
alignas(16) CellSaveDataFileGet fileGet;
|
||||
alignas(16) CellSaveDataFileSet fileSet;
|
||||
alignas(16) CellSaveDataDoneGet doneGet;
|
||||
};
|
||||
}
|
||||
|
||||
@ -704,6 +704,8 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
||||
{
|
||||
listSet->focusPosition = CELL_SAVEDATA_FOCUSPOS_LISTHEAD;
|
||||
|
||||
std::memset(result.get_ptr(), 0, ::offset32(&CellSaveDataCBResult::userdata));
|
||||
|
||||
// List Callback
|
||||
funcList(ppu, result, listGet, listSet);
|
||||
|
||||
@ -962,6 +964,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
||||
doneGet->excResult = CELL_SAVEDATA_ERROR_NODATA;
|
||||
}
|
||||
|
||||
std::memset(result.get_ptr(), 0, ::offset32(&CellSaveDataCBResult::userdata));
|
||||
funcDone(ppu, result, doneGet);
|
||||
};
|
||||
|
||||
@ -1060,6 +1063,8 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
||||
{
|
||||
lv2_sleep(ppu, 250);
|
||||
|
||||
std::memset(result.get_ptr(), 0, ::offset32(&CellSaveDataCBResult::userdata));
|
||||
|
||||
// Fixed Callback
|
||||
funcFixed(ppu, result, listGet, fixedSet);
|
||||
|
||||
@ -1358,6 +1363,8 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
||||
statGet->sysSizeKB = 35; // always reported as 35 regardless of actual file sizes
|
||||
statGet->sizeKB = !save_entry.isNew ? ::narrow<s32>((size_bytes / 1024) + statGet->sysSizeKB) : 0;
|
||||
|
||||
std::memset(result.get_ptr(), 0, ::offset32(&CellSaveDataCBResult::userdata));
|
||||
|
||||
// Stat Callback
|
||||
funcStat(ppu, result, statGet, statSet);
|
||||
|
||||
@ -1516,6 +1523,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
||||
{
|
||||
std::memset(fileSet.get_ptr(), 0, fileSet.size());
|
||||
std::memset(fileGet->reserved, 0, sizeof(fileGet->reserved));
|
||||
std::memset(result.get_ptr(), 0, ::offset32(&CellSaveDataCBResult::userdata));
|
||||
|
||||
funcFile(ppu, result, fileGet, fileSet);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user