|
|
@ -15,11 +15,9 @@
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|
|
|
|
|
|
|
|
|
|
|
#include "armdefs.h"
|
|
|
|
#include "core/arm/interpreter/armdefs.h"
|
|
|
|
#include "armemu.h"
|
|
|
|
#include "core/arm/interpreter/armemu.h"
|
|
|
|
|
|
|
|
#include "core/arm/interpreter/skyeye_defs.h"
|
|
|
|
//#include "ansidecl.h"
|
|
|
|
|
|
|
|
#include "skyeye_defs.h"
|
|
|
|
|
|
|
|
#include "core/hle/coprocessor.h"
|
|
|
|
#include "core/hle/coprocessor.h"
|
|
|
|
#include "core/arm/disassembler/arm_disasm.h"
|
|
|
|
#include "core/arm/disassembler/arm_disasm.h"
|
|
|
|
|
|
|
|
|
|
|
@ -127,8 +125,7 @@ ARMul_GetCPSR (ARMul_State * state)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//chy 2003-08-20: below is from gdb20030716, maybe isn't suitable for system simulator
|
|
|
|
//chy 2003-08-20: below is from gdb20030716, maybe isn't suitable for system simulator
|
|
|
|
//return (CPSR | state->Cpsr); for gdb20030716
|
|
|
|
//return (CPSR | state->Cpsr); for gdb20030716
|
|
|
|
// NOTE(bunnei): Changed this from [now] commented out macro "CPSR"
|
|
|
|
return (CPSR); //had be tested in old skyeye with gdb5.0-5.3
|
|
|
|
return ((ECC | EINT | EMODE | (TFLAG << 5))); //had be tested in old skyeye with gdb5.0-5.3
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* This routine sets the value of the CPSR. */
|
|
|
|
/* This routine sets the value of the CPSR. */
|
|
|
@ -500,8 +497,8 @@ ARMul_LDC (ARMul_State * state, ARMword instr, ARMword address)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (ADDREXCEPT (address))
|
|
|
|
//if (ADDREXCEPT (address))
|
|
|
|
INTERNALABORT (address);
|
|
|
|
// INTERNALABORT (address);
|
|
|
|
|
|
|
|
|
|
|
|
cpab = (state->LDC[CPNum]) (state, ARMul_FIRST, instr, 0);
|
|
|
|
cpab = (state->LDC[CPNum]) (state, ARMul_FIRST, instr, 0);
|
|
|
|
while (cpab == ARMul_BUSY) {
|
|
|
|
while (cpab == ARMul_BUSY) {
|
|
|
@ -594,8 +591,8 @@ ARMul_STC (ARMul_State * state, ARMword instr, ARMword address)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (ADDREXCEPT (address) || VECTORACCESS (address))
|
|
|
|
//if (ADDREXCEPT (address) || VECTORACCESS (address))
|
|
|
|
INTERNALABORT (address);
|
|
|
|
// INTERNALABORT (address);
|
|
|
|
|
|
|
|
|
|
|
|
cpab = (state->STC[CPNum]) (state, ARMul_FIRST, instr, &data);
|
|
|
|
cpab = (state->STC[CPNum]) (state, ARMul_FIRST, instr, &data);
|
|
|
|
while (cpab == ARMul_BUSY) {
|
|
|
|
while (cpab == ARMul_BUSY) {
|
|
|
@ -661,40 +658,39 @@ ARMul_STC (ARMul_State * state, ARMword instr, ARMword address)
|
|
|
|
void
|
|
|
|
void
|
|
|
|
ARMul_MCR (ARMul_State * state, ARMword instr, ARMword source)
|
|
|
|
ARMul_MCR (ARMul_State * state, ARMword instr, ARMword source)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
HLE::CallMCR(instr, source);
|
|
|
|
unsigned cpab;
|
|
|
|
//unsigned cpab;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////printf("SKYEYE ARMul_MCR, CPnum is %x, source %x\n",CPNum, source);
|
|
|
|
//printf("SKYEYE ARMul_MCR, CPnum is %x, source %x\n",CPNum, source);
|
|
|
|
//if (!CP_ACCESS_ALLOWED (state, CPNum)) {
|
|
|
|
if (!CP_ACCESS_ALLOWED (state, CPNum)) {
|
|
|
|
// //chy 2004-07-19 should fix in the future ????!!!!
|
|
|
|
//chy 2004-07-19 should fix in the future ????!!!!
|
|
|
|
// //printf("SKYEYE ARMul_MCR, ACCESS_not ALLOWed, UndefinedInstr CPnum is %x, source %x\n",CPNum, source);
|
|
|
|
//printf("SKYEYE ARMul_MCR, ACCESS_not ALLOWed, UndefinedInstr CPnum is %x, source %x\n",CPNum, source);
|
|
|
|
// ARMul_UndefInstr (state, instr);
|
|
|
|
ARMul_UndefInstr (state, instr);
|
|
|
|
// return;
|
|
|
|
return;
|
|
|
|
//}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//cpab = (state->MCR[CPNum]) (state, ARMul_FIRST, instr, source);
|
|
|
|
cpab = (state->MCR[CPNum]) (state, ARMul_FIRST, instr, source);
|
|
|
|
|
|
|
|
|
|
|
|
//while (cpab == ARMul_BUSY) {
|
|
|
|
while (cpab == ARMul_BUSY) {
|
|
|
|
// ARMul_Icycles (state, 1, 0);
|
|
|
|
ARMul_Icycles (state, 1, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// if (IntPending (state)) {
|
|
|
|
if (IntPending (state)) {
|
|
|
|
// cpab = (state->MCR[CPNum]) (state, ARMul_INTERRUPT,
|
|
|
|
cpab = (state->MCR[CPNum]) (state, ARMul_INTERRUPT,
|
|
|
|
// instr, 0);
|
|
|
|
instr, 0);
|
|
|
|
// return;
|
|
|
|
return;
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// else
|
|
|
|
else
|
|
|
|
// cpab = (state->MCR[CPNum]) (state, ARMul_BUSY, instr,
|
|
|
|
cpab = (state->MCR[CPNum]) (state, ARMul_BUSY, instr,
|
|
|
|
// source);
|
|
|
|
source);
|
|
|
|
//}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//if (cpab == ARMul_CANT) {
|
|
|
|
if (cpab == ARMul_CANT) {
|
|
|
|
// printf ("SKYEYE ARMul_MCR, CANT, UndefinedInstr %x CPnum is %x, source %x\n", instr, CPNum, source);
|
|
|
|
printf ("SKYEYE ARMul_MCR, CANT, UndefinedInstr %x CPnum is %x, source %x\n", instr, CPNum, source);
|
|
|
|
// ARMul_Abort (state, ARMul_UndefinedInstrV);
|
|
|
|
ARMul_Abort (state, ARMul_UndefinedInstrV);
|
|
|
|
//}
|
|
|
|
}
|
|
|
|
//else {
|
|
|
|
else {
|
|
|
|
// BUSUSEDINCPCN;
|
|
|
|
BUSUSEDINCPCN;
|
|
|
|
// ARMul_Ccycles (state, 1, 0);
|
|
|
|
ARMul_Ccycles (state, 1, 0);
|
|
|
|
//}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* This function does the Busy-Waiting for an MCRR instruction. */
|
|
|
|
/* This function does the Busy-Waiting for an MCRR instruction. */
|
|
|
@ -742,37 +738,41 @@ ARMul_MRC (ARMul_State * state, ARMword instr)
|
|
|
|
|
|
|
|
|
|
|
|
ARMword result = HLE::CallMRC(instr);
|
|
|
|
ARMword result = HLE::CallMRC(instr);
|
|
|
|
|
|
|
|
|
|
|
|
////printf("SKYEYE ARMul_MRC, CPnum is %x, instr %x\n",CPNum, instr);
|
|
|
|
if (result != -1) {
|
|
|
|
//if (!CP_ACCESS_ALLOWED (state, CPNum)) {
|
|
|
|
return result;
|
|
|
|
// //chy 2004-07-19 should fix in the future????!!!!
|
|
|
|
}
|
|
|
|
// //printf("SKYEYE ARMul_MRC,NOT ALLOWed UndefInstr CPnum is %x, instr %x\n",CPNum, instr);
|
|
|
|
|
|
|
|
// ARMul_UndefInstr (state, instr);
|
|
|
|
|
|
|
|
// return -1;
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//cpab = (state->MRC[CPNum]) (state, ARMul_FIRST, instr, &result);
|
|
|
|
//printf("SKYEYE ARMul_MRC, CPnum is %x, instr %x\n",CPNum, instr);
|
|
|
|
//while (cpab == ARMul_BUSY) {
|
|
|
|
if (!CP_ACCESS_ALLOWED (state, CPNum)) {
|
|
|
|
// ARMul_Icycles (state, 1, 0);
|
|
|
|
//chy 2004-07-19 should fix in the future????!!!!
|
|
|
|
// if (IntPending (state)) {
|
|
|
|
//printf("SKYEYE ARMul_MRC,NOT ALLOWed UndefInstr CPnum is %x, instr %x\n",CPNum, instr);
|
|
|
|
// cpab = (state->MRC[CPNum]) (state, ARMul_INTERRUPT,
|
|
|
|
ARMul_UndefInstr (state, instr);
|
|
|
|
// instr, 0);
|
|
|
|
return -1;
|
|
|
|
// return (0);
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
// else
|
|
|
|
cpab = (state->MRC[CPNum]) (state, ARMul_FIRST, instr, &result);
|
|
|
|
// cpab = (state->MRC[CPNum]) (state, ARMul_BUSY, instr,
|
|
|
|
while (cpab == ARMul_BUSY) {
|
|
|
|
// &result);
|
|
|
|
ARMul_Icycles (state, 1, 0);
|
|
|
|
//}
|
|
|
|
if (IntPending (state)) {
|
|
|
|
//if (cpab == ARMul_CANT) {
|
|
|
|
cpab = (state->MRC[CPNum]) (state, ARMul_INTERRUPT,
|
|
|
|
// printf ("SKYEYE ARMul_MRC,CANT UndefInstr CPnum is %x, instr %x\n", CPNum, instr);
|
|
|
|
instr, 0);
|
|
|
|
// ARMul_Abort (state, ARMul_UndefinedInstrV);
|
|
|
|
return (0);
|
|
|
|
// /* Parent will destroy the flags otherwise. */
|
|
|
|
}
|
|
|
|
// result = ECC;
|
|
|
|
else
|
|
|
|
//}
|
|
|
|
cpab = (state->MRC[CPNum]) (state, ARMul_BUSY, instr,
|
|
|
|
//else {
|
|
|
|
&result);
|
|
|
|
// BUSUSEDINCPCN;
|
|
|
|
}
|
|
|
|
// ARMul_Ccycles (state, 1, 0);
|
|
|
|
if (cpab == ARMul_CANT) {
|
|
|
|
// ARMul_Icycles (state, 1, 0);
|
|
|
|
printf ("SKYEYE ARMul_MRC,CANT UndefInstr CPnum is %x, instr %x\n", CPNum, instr);
|
|
|
|
//}
|
|
|
|
ARMul_Abort (state, ARMul_UndefinedInstrV);
|
|
|
|
|
|
|
|
/* Parent will destroy the flags otherwise. */
|
|
|
|
|
|
|
|
result = ECC;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
BUSUSEDINCPCN;
|
|
|
|
|
|
|
|
ARMul_Ccycles (state, 1, 0);
|
|
|
|
|
|
|
|
ARMul_Icycles (state, 1, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -907,9 +907,7 @@ ARMul_ScheduleEvent (ARMul_State * state, unsigned int delay,
|
|
|
|
state->Now = ARMul_Time (state);
|
|
|
|
state->Now = ARMul_Time (state);
|
|
|
|
when = (state->Now + delay) % EVENTLISTSIZE;
|
|
|
|
when = (state->Now + delay) % EVENTLISTSIZE;
|
|
|
|
event = (struct EventNode *) malloc (sizeof (struct EventNode));
|
|
|
|
event = (struct EventNode *) malloc (sizeof (struct EventNode));
|
|
|
|
|
|
|
|
|
|
|
|
_dbg_assert_msg_(ARM11, event, "SKYEYE:ARMul_ScheduleEvent: malloc event error\n");
|
|
|
|
_dbg_assert_msg_(ARM11, event, "SKYEYE:ARMul_ScheduleEvent: malloc event error\n");
|
|
|
|
|
|
|
|
|
|
|
|
event->func = what;
|
|
|
|
event->func = what;
|
|
|
|
event->next = *(state->EventPtr + when);
|
|
|
|
event->next = *(state->EventPtr + when);
|
|
|
|
*(state->EventPtr + when) = event;
|
|
|
|
*(state->EventPtr + when) = event;
|
|
|
|