示例#1
0
 NIns *Assembler::genEpilogue()
 {
     underrunProtect(12);
     RESTORE(G0, G0, G0); //restore
     JMPLI(I7, 8, G0); //ret
     ORI(O0, 0, I0);
     return  _nIns;
 }
示例#2
0
	// Quick Call
	// dest = LIS(imm) + ORI(+imm)
	void PPCXEmitter::MOVI2R(PPCReg dest, unsigned int imm) {
		if ((s32) (s16) (imm) == (s32) (imm)) {
			// 16bit
			LI(dest, imm & 0xFFFF);
		} else {	
			// HI 16bit
			LIS(dest, imm>>16);
			if ((imm & 0xFFFF) != 0) {
				// LO 16bit
				ORI(dest, dest, imm & 0xFFFF);
			}
		}
	}
示例#3
0
/* Process 2OPI Integer instructions */
bool eval_2OPI_Int(struct lilith* vm, struct Instruction* c)
{
	#ifdef DEBUG
	char Name[20] = "ILLEGAL_2OPI";
	#endif

	/* 0x0E ... 0x2B */
	/* 0xB0 ... 0xDF */
	switch(c->raw2)
	{
		case 0x0E: /* ADDI */
		{
			#ifdef DEBUG
			strncpy(Name, "ADDI", 19);
			#elif TRACE
			record_trace("ADDI");
			#endif

			ADDI(vm, c);
			break;
		}
		case 0x0F: /* ADDUI */
		{
			#ifdef DEBUG
			strncpy(Name, "ADDUI", 19);
			#elif TRACE
			record_trace("ADDUI");
			#endif

			ADDUI(vm, c);
			break;
		}
		case 0x10: /* SUBI */
		{
			#ifdef DEBUG
			strncpy(Name, "SUBI", 19);
			#elif TRACE
			record_trace("SUBI");
			#endif

			SUBI(vm, c);
			break;
		}
		case 0x11: /* SUBUI */
		{
			#ifdef DEBUG
			strncpy(Name, "SUBUI", 19);
			#elif TRACE
			record_trace("SUBUI");
			#endif

			SUBUI(vm, c);
			break;
		}
		case 0x12: /* CMPI */
		{
			#ifdef DEBUG
			strncpy(Name, "CMPI", 19);
			#elif TRACE
			record_trace("CMPI");
			#endif

			CMPI(vm, c);
			break;
		}
		case 0x13: /* LOAD */
		{
			#ifdef DEBUG
			strncpy(Name, "LOAD", 19);
			#elif TRACE
			record_trace("LOAD");
			#endif

			LOAD(vm, c);
			break;
		}
		case 0x14: /* LOAD8 */
		{
			#ifdef DEBUG
			strncpy(Name, "LOAD8", 19);
			#elif TRACE
			record_trace("LOAD8");
			#endif

			LOAD8(vm, c);
			break;
		}
		case 0x15: /* LOADU8 */
		{
			#ifdef DEBUG
			strncpy(Name, "LOADU8", 19);
			#elif TRACE
			record_trace("LOADU8");
			#endif

			LOADU8(vm, c);
			break;
		}
		case 0x16: /* LOAD16 */
		{
			#ifdef DEBUG
			strncpy(Name, "LOAD16", 19);
			#elif TRACE
			record_trace("LOAD16");
			#endif

			LOAD16(vm, c);
			break;
		}
		case 0x17: /* LOADU16 */
		{
			#ifdef DEBUG
			strncpy(Name, "LOADU16", 19);
			#elif TRACE
			record_trace("LOADU16");
			#endif

			LOADU16(vm, c);
			break;
		}
		case 0x18: /* LOAD32 */
		{
			#ifdef DEBUG
			strncpy(Name, "LOAD32", 19);
			#elif TRACE
			record_trace("LOAD32");
			#endif

			LOAD32(vm, c);
			break;
		}
		case 0x19: /* LOADU32 */
		{
			#ifdef DEBUG
			strncpy(Name, "LOADU32", 19);
			#elif TRACE
			record_trace("LOADU32");
			#endif

			LOADU32(vm, c);
			break;
		}
		case 0x1F: /* CMPUI */
		{
			#ifdef DEBUG
			strncpy(Name, "CMPUI", 19);
			#elif TRACE
			record_trace("CMPUI");
			#endif

			CMPUI(vm, c);
			break;
		}
		case 0x20: /* STORE */
		{
			#ifdef DEBUG
			strncpy(Name, "STORE", 19);
			#elif TRACE
			record_trace("STORE");
			#endif

			STORE(vm, c);
			break;
		}
		case 0x21: /* STORE8 */
		{
			#ifdef DEBUG
			strncpy(Name, "STORE8", 19);
			#elif TRACE
			record_trace("STORE8");
			#endif

			STORE8(vm, c);
			break;
		}
		case 0x22: /* STORE16 */
		{
			#ifdef DEBUG
			strncpy(Name, "STORE16", 19);
			#elif TRACE
			record_trace("STORE16");
			#endif

			STORE16(vm, c);
			break;
		}
		case 0x23: /* STORE32 */
		{
			#ifdef DEBUG
			strncpy(Name, "STORE32", 19);
			#elif TRACE
			record_trace("STORE32");
			#endif

			STORE32(vm, c);
			break;
		}
		case 0xB0: /* ANDI */
		{
			#ifdef DEBUG
			strncpy(Name, "ANDI", 19);
			#elif TRACE
			record_trace("ANDI");
			#endif

			ANDI(vm, c);
			break;
		}
		case 0xB1: /* ORI */
		{
			#ifdef DEBUG
			strncpy(Name, "ORI", 19);
			#elif TRACE
			record_trace("ORI");
			#endif

			ORI(vm, c);
			break;
		}
		case 0xB2: /* XORI */
		{
			#ifdef DEBUG
			strncpy(Name, "XORI", 19);
			#elif TRACE
			record_trace("XORI");
			#endif

			XORI(vm, c);
			break;
		}
		case 0xB3: /* NANDI */
		{
			#ifdef DEBUG
			strncpy(Name, "NANDI", 19);
			#elif TRACE
			record_trace("NANDI");
			#endif

			NANDI(vm, c);
			break;
		}
		case 0xB4: /* NORI */
		{
			#ifdef DEBUG
			strncpy(Name, "NORI", 19);
			#elif TRACE
			record_trace("NORI");
			#endif

			NORI(vm, c);
			break;
		}
		case 0xB5: /* XNORI */
		{
			#ifdef DEBUG
			strncpy(Name, "XNORI", 19);
			#elif TRACE
			record_trace("XNORI");
			#endif

			XNORI(vm, c);
			break;
		}
		case 0xC0: /* CMPJUMPI.G */
		{
			#ifdef DEBUG
			strncpy(Name, "CMPJUMPI.G", 19);
			#elif TRACE
			record_trace("CMPJUMPI.G");
			#endif

			CMPJUMPI_G(vm, c);
			break;
		}
		case 0xC1: /* CMPJUMPI.GE */
		{
			#ifdef DEBUG
			strncpy(Name, "CMPJUMPI.GE", 19);
			#elif TRACE
			record_trace("CMPJUMPI.GE");
			#endif

			CMPJUMPI_GE(vm, c);
			break;
		}
		case 0xC2: /* CMPJUMPI.E */
		{
			#ifdef DEBUG
			strncpy(Name, "CMPJUMPI.E", 19);
			#elif TRACE
			record_trace("CMPJUMPI.E");
			#endif

			CMPJUMPI_E(vm, c);
			break;
		}
		case 0xC3: /* CMPJUMPI.NE */
		{
			#ifdef DEBUG
			strncpy(Name, "CMPJUMPI.NE", 19);
			#elif TRACE
			record_trace("CMPJUMPI.NE");
			#endif

			CMPJUMPI_NE(vm, c);
			break;
		}
		case 0xC4: /* CMPJUMPI.LE */
		{
			#ifdef DEBUG
			strncpy(Name, "CMPJUMPI.LE", 19);
			#elif TRACE
			record_trace("CMPJUMPI.LE");
			#endif

			CMPJUMPI_LE(vm, c);
			break;
		}
		case 0xC5: /* CMPJUMPI.L */
		{
			#ifdef DEBUG
			strncpy(Name, "CMPJUMPI.L", 19);
			#elif TRACE
			record_trace("CMPJUMPI.L");
			#endif

			CMPJUMPI_L(vm, c);
			break;
		}
		case 0xD0: /* CMPJUMPUI.G */
		{
			#ifdef DEBUG
			strncpy(Name, "CMPJUMPUI.G", 19);
			#elif TRACE
			record_trace("CMPJUMPUI.G");
			#endif

			CMPJUMPUI_G(vm, c);
			break;
		}
		case 0xD1: /* CMPJUMPUI.GE */
		{
			#ifdef DEBUG
			strncpy(Name, "CMPJUMPUI.GE", 19);
			#elif TRACE
			record_trace("CMPJUMPUI.GE");
			#endif

			CMPJUMPUI_GE(vm, c);
			break;
		}
		case 0xD4: /* CMPJUMPUI.LE */
		{
			#ifdef DEBUG
			strncpy(Name, "CMPJUMPUI.LE", 19);
			#elif TRACE
			record_trace("CMPJUMPUI.LE");
			#endif

			CMPJUMPUI_LE(vm, c);
			break;
		}
		case 0xD5: /* CMPJUMPUI.L */
		{
			#ifdef DEBUG
			strncpy(Name, "CMPJUMPUI.L", 19);
			#elif TRACE
			record_trace("CMPJUMPUI.L");
			#endif

			CMPJUMPUI_L(vm, c);
			break;
		}
		default:
		{
			illegal_instruction(vm, c);
			break;
		}
	}
	#ifdef DEBUG
	fprintf(stdout, "# %s reg%u reg%u %i\n", Name, c->reg0, c->reg1, c->raw_Immediate);
	#endif
	return false;
}
示例#4
0
uint8_t condition_psp_keys = 0;
uint8_t condition_psp_change_emu = 0;
uint8_t condition_psp_prometheus = 0;
uint64_t vsh_check;
//uint8_t condition_game_ext_psx=0;

//uint8_t block_peek = 0;

// Plugins
sys_prx_id_t vsh_plugins[MAX_VSH_PLUGINS];
static int loading_vsh_plugin;

SprxPatch decr_vsh_patches[] =
{
	//{ decr_game_update_offset, LI(R3, -1), &condition_disable_gameupdate }, [DISABLED by DEFAULT since 4.46]
	{ decr_ps2tonet_patch, ORI(R3, R3, 0x8204), &condition_ps2softemu },
	{ decr_ps2tonet_size_patch, LI(R5, 0x40), &condition_ps2softemu },
	//{ decr_psp_newdrm_patch, LI(R3, 0), &condition_true }, // Fixes the issue (80029537) with PSP Pkg games
	{ 0 }
};

SprxPatch dex_vsh_patches[] =
{
	//{ dex_game_update_offset, LI(R3, -1), &condition_disable_gameupdate }, [DISABLED by DEFAULT since 4.46]
	{ dex_ps2tonet_patch, ORI(R3, R3, 0x8204), &condition_ps2softemu },
	{ dex_ps2tonet_size_patch, LI(R5, 0x40), &condition_ps2softemu },
	{ 0 }
};
/*
SprxPatch basic_plugins_patches[] =
{
示例#5
0
uint8_t condition_psp_prometheus = 0;
uint8_t condition_pemucorelib = 1;
uint64_t vsh_check;
//uint8_t condition_game_ext_psx=0;
int bc_to_net_status=0;

//uint8_t block_peek = 0;

// Plugins
sys_prx_id_t vsh_plugins[MAX_VSH_PLUGINS];
static int loading_vsh_plugin;

SprxPatch cex_vsh_patches[] =
{
	// { cex_game_update_offset, LI(R3, -1), &condition_disable_gameupdate }, [DISABLED by DEFAULT since 4.46]
	{ cex_ps2tonet_patch, ORI(R3, R3, 0x8204), &condition_ps2softemu },
	{ cex_ps2tonet_size_patch, LI(R5, 0x40), &condition_ps2softemu },
	{ cex_ps2tonet_patch, ORI(R3, R3, 0x8202), &condition_false },
	{ cex_ps2tonet_size_patch, LI(R5, 0x4f0), &condition_false },
	{ 0 }
};

SprxPatch dex_vsh_patches[] =
{
	//{ dex_game_update_offset, LI(R3, -1), &condition_disable_gameupdate },
	{ dex_ps2tonet_patch, ORI(R3, R3, 0x8204), &condition_ps2softemu },
	{ dex_ps2tonet_size_patch, LI(R5, 0x40), &condition_ps2softemu },
	{ dex_ps2tonet_patch, ORI(R3, R3, 0x8202), &condition_false },
	{ dex_ps2tonet_size_patch, LI(R5, 0x4f0), &condition_false },
	//{ dex_enable_dlna_patch, LI(R4, 1), &condition_true },		
	//{ dex_fake_owner_popup_patch, NOP, &condition_true }, // Hard-coded in REX 4.81.2	
示例#6
0
{
	u32 word = 0;

    tap_do_instruction(EJG_DATA);
    word = tap_wr_data(DONT_CARE);
    tap_do_instruction(EJG_CONTROL);    
	tap_wr_data(PROBEN | PROBTRAP);

    return word;
}

/*----------------------------------------------------------------------------*/
void ejtag_write_general_reg(u32 reg_idx, u32 reg_val)
{
    ejtag_run_assembly(LUI(reg_idx, (reg_val >> 16) & 0xffff));
    ejtag_run_assembly(ORI(reg_idx, reg_idx, reg_val & 0xFFFF));
	
	return;
}

/*----------------------------------------------------------------------------*/
u32 ejtag_read_general_reg(u32 reg_num)
{
	u32 val = 0;
	u32 bak_reg = 0;

    if (!(reg_num >= ZERO && reg_num <= RA))
		return 0;
		
	/* choose either v0 or a0 as transit register */
	bak_reg = (reg_num != V0 ? V0 : AT);