ppc: Added optional callback for explicit data cache stores.

This commit is contained in:
Ville Linde 2012-07-25 15:32:27 +00:00
parent e1858a0a33
commit 5ea8550a8a
4 changed files with 35 additions and 0 deletions

View File

@ -155,6 +155,7 @@ struct _powerpc_config
write32_device_func dcr_write_func;
};
typedef void (*ppc_dcstore_handler)(device_t *device, UINT32 address);
/***************************************************************************
@ -168,6 +169,8 @@ void ppcdrc_add_hotspot(device_t *device, offs_t pc, UINT32 opcode, UINT32 cycle
void ppc4xx_spu_set_tx_handler(device_t *device, ppc4xx_spu_tx_handler handler);
void ppc4xx_spu_receive_byte(device_t *device, UINT8 byteval);
void ppc_set_dcstore_callback(device_t *device, ppc_dcstore_handler handler);
DECLARE_LEGACY_CPU_DEVICE(PPC403GA, ppc403ga);
DECLARE_LEGACY_CPU_DEVICE(PPC403GCX, ppc403gcx);

View File

@ -454,6 +454,19 @@ offs_t ppccom_dasm(powerpc_state *ppc, char *buffer, offs_t pc, const UINT8 *opr
}
/*-------------------------------------------------
ppccom_dcstore_callback - call the dcstore
callback if installed
-------------------------------------------------*/
void ppccom_dcstore_callback(powerpc_state *ppc)
{
if (ppc->dcstore_handler != NULL)
{
ppc->dcstore_handler(ppc->device, ppc->param0);
}
}
/***************************************************************************
TLB HANDLING
@ -1607,6 +1620,16 @@ static TIMER_CALLBACK( decrementer_int_callback )
ppc->decrementer_int_timer->adjust(ppc->device->cycles_to_attotime(cycles_until_next));
}
/*-------------------------------------------------
ppc_set_dcstore_callback - installs a callback
for detecting datacache stores with dcbst
-------------------------------------------------*/
void ppc_set_dcstore_callback(device_t *device, ppc_dcstore_handler handler)
{
powerpc_state *ppc = *(powerpc_state **)downcast<legacy_cpu_device *>(device)->token();
ppc->dcstore_handler = handler;
}
/***************************************************************************

View File

@ -568,6 +568,8 @@ struct _powerpc_state
read32_device_func dcr_read_func;
write32_device_func dcr_write_func;
ppc_dcstore_handler dcstore_handler;
};
@ -601,6 +603,8 @@ void ppccom_execute_mtdcr(powerpc_state *ppc);
void ppccom_update_fprf(powerpc_state *ppc);
void ppccom_dcstore_callback(powerpc_state *ppc);
void ppc4xx_set_info(powerpc_state *ppc, UINT32 state, cpuinfo *info);
void ppc4xx_get_info(powerpc_state *ppc, UINT32 state, cpuinfo *info);

View File

@ -3617,6 +3617,11 @@ static int generate_instruction_1f(powerpc_state *ppc, drcuml_block *block, comp
return FALSE;
case 0x036: /* DCBST */
UML_ADD(block, I0, R32Z(G_RA(op)), R32(G_RB(op))); // add i0,ra,rb
UML_MOV(block, mem(&ppc->param0), I0); // mov [param0],i0
UML_CALLC(block, (c_function)ppccom_dcstore_callback, ppc);
return TRUE;
case 0x056: /* DCBF */
case 0x0f6: /* DCBTST */
case 0x116: /* DCBT */