SPURS: More fixes

This commit is contained in:
S Gopal Rajagopal 2015-02-20 01:53:05 +05:30
parent 796d96f06b
commit 68978a0109
4 changed files with 120 additions and 108 deletions

View File

@ -573,6 +573,18 @@ bool get_x64_reg_value(x64_context* context, x64_reg_t reg, size_t d_size, size_
case 8: out_value = (u64)imm_value; return true; // sign-extended case 8: out_value = (u64)imm_value; return true; // sign-extended
} }
} }
else if (reg == X64_IMM16)
{
// load the immediate value (assuming it's at the end of the instruction)
out_value = *(s16*)(RIP(context) + i_size - 2);
return true;
}
else if (reg == X64_IMM8)
{
// load the immediate value (assuming it's at the end of the instruction)
out_value = *(s8*)(RIP(context) + i_size - 1);
return true;
}
else if (reg == X64R_ECX) else if (reg == X64R_ECX)
{ {
out_value = (u32)RCX(context); out_value = (u32)RCX(context);

View File

@ -2767,7 +2767,7 @@ s64 spursCreateTask(vm::ptr<CellSpursTaskset> taskset, vm::ptr<u32> task_id, vm:
alloc_ls_blocks = context_size > 0x3D400 ? 0x7A : ((context_size - 0x400) >> 11); alloc_ls_blocks = context_size > 0x3D400 ? 0x7A : ((context_size - 0x400) >> 11);
if (ls_pattern.addr() != 0) if (ls_pattern.addr() != 0)
{ {
u128 ls_pattern_128 = u128::from64r(ls_pattern->_u64[1], ls_pattern->_u64[0]); u128 ls_pattern_128 = u128::from64r(ls_pattern->_u64[0], ls_pattern->_u64[1]);
u32 ls_blocks = 0; u32 ls_blocks = 0;
for (auto i = 0; i < 128; i++) for (auto i = 0; i < 128; i++)
{ {

View File

@ -1140,7 +1140,7 @@ void spursTasksetStartTask(SPUThread & spu, CellSpursTaskArgument & taskArgs) {
auto taskset = vm::get_ptr<CellSpursTaskset>(spu.ls_offset + 0x2700); auto taskset = vm::get_ptr<CellSpursTaskset>(spu.ls_offset + 0x2700);
spu.GPR[2].clear(); spu.GPR[2].clear();
spu.GPR[3] = u128::from64r(taskArgs._u64[1], taskArgs._u64[0]); spu.GPR[3] = u128::from64r(taskArgs._u64[0], taskArgs._u64[1]);
spu.GPR[4]._u64[1] = taskset->m.args; spu.GPR[4]._u64[1] = taskset->m.args;
spu.GPR[4]._u64[0] = taskset->m.spurs.addr(); spu.GPR[4]._u64[0] = taskset->m.spurs.addr();
for (auto i = 5; i < 128; i++) { for (auto i = 5; i < 128; i++) {
@ -1382,7 +1382,7 @@ s32 spursTasketSaveTaskContext(SPUThread & spu) {
u32 allocLsBlocks = taskInfo->context_save_storage_and_alloc_ls_blocks & 0x7F; u32 allocLsBlocks = taskInfo->context_save_storage_and_alloc_ls_blocks & 0x7F;
u32 lsBlocks = 0; u32 lsBlocks = 0;
u128 ls_pattern = u128::from64r(taskInfo->ls_pattern._u64[1], taskInfo->ls_pattern._u64[0]); u128 ls_pattern = u128::from64r(taskInfo->ls_pattern._u64[0], taskInfo->ls_pattern._u64[1]);
for (auto i = 0; i < 128; i++) { for (auto i = 0; i < 128; i++) {
if (ls_pattern._bit[i]) { if (ls_pattern._bit[i]) {
lsBlocks++; lsBlocks++;
@ -1499,7 +1499,7 @@ void spursTasksetDispatch(SPUThread & spu) {
} }
// If the entire LS is saved then there is no need to load the ELF as it will be be saved in the context save area as well // If the entire LS is saved then there is no need to load the ELF as it will be be saved in the context save area as well
u128 ls_pattern = u128::from64r(taskInfo->ls_pattern._u64[1], taskInfo->ls_pattern._u64[0]); u128 ls_pattern = u128::from64r(taskInfo->ls_pattern._u64[0], taskInfo->ls_pattern._u64[1]);
if (ls_pattern != u128::from64r(0x03FFFFFFFFFFFFFFull, 0xFFFFFFFFFFFFFFFFull)) { if (ls_pattern != u128::from64r(0x03FFFFFFFFFFFFFFull, 0xFFFFFFFFFFFFFFFFull)) {
// Load the ELF // Load the ELF
u32 entryPoint; u32 entryPoint;