-Added some SWI changes Mighty Max sent me. Relocating SWI routines should work now.

This commit is contained in:
cyberwarriorx 2006-12-23 00:52:11 +00:00
parent c5c1ac7895
commit 2f32db41cb
2 changed files with 39 additions and 4 deletions

View File

@ -7773,8 +7773,26 @@ static u32 FASTCALL OP_MRC(armcpu_t *cpu)
//--------------SWI------------------------------- //--------------SWI-------------------------------
static u32 FASTCALL OP_SWI(armcpu_t *cpu) static u32 FASTCALL OP_SWI(armcpu_t *cpu)
{ {
u32 swinum = (cpu->instruction>>16)&0x1F; if (((cpu->intVector != 0) ^ (cpu->proc_ID == ARMCPU_ARM9)))
return cpu->swi_tab[swinum](cpu) + 3; {
/* TODO (#1#): translocated SWI vectors */
/* we use an irq thats not in the irq tab, as
it was replaced duie to a changed intVector */
Status_Reg tmp = cpu->CPSR;
armcpu_switchMode(cpu, SVC); /* enter svc mode */
cpu->R[14] = cpu->R[15] - 4; /* jump to swi Vector */
cpu->SPSR = tmp; /* save old CPSR as new SPSR */
cpu->CPSR.bits.T = 0; /* handle as ARM32 code */
cpu->CPSR.bits.I = cpu->SPSR.bits.I; /* keep int disable flag */
cpu->R[15] = cpu->intVector + 0x08;
cpu->next_instruction = cpu->R[15];
return 4;
}
else
{
u32 swinum = (cpu->instruction>>16)&0x1F;
return cpu->swi_tab[swinum](cpu) + 3;
}
} }
//----------------BKPT------------------------- //----------------BKPT-------------------------

View File

@ -861,8 +861,25 @@ static u32 FASTCALL OP_B_COND(armcpu_t *cpu)
static u32 FASTCALL OP_SWI_THUMB(armcpu_t *cpu) static u32 FASTCALL OP_SWI_THUMB(armcpu_t *cpu)
{ {
u32 swinum = cpu->instruction & 0xFF; if (((cpu->intVector != 0) ^ (cpu->proc_ID == ARMCPU_ARM9)))
return cpu->swi_tab[swinum](cpu) + 3; {
/* we use an irq thats not in the irq tab, as
it was replaced duie to a changed intVector */
Status_Reg tmp = cpu->CPSR;
armcpu_switchMode(cpu, SVC); /* enter svc mode */
cpu->R[14] = cpu->R[15] - 4; /* jump to swi Vector */
cpu->SPSR = tmp; /* save old CPSR as new SPSR */
cpu->CPSR.bits.T = 0; /* handle as ARM32 code */
cpu->CPSR.bits.I = cpu->SPSR.bits.I; /* keep int disable flag */
cpu->R[15] = cpu->intVector + 0x08;
cpu->next_instruction = cpu->R[15];
return 3;
}
else
{
u32 swinum = cpu->instruction & 0xFF;
return cpu->swi_tab[swinum](cpu) + 3;
}
//return 3; //return 3;
} }