summaryrefslogtreecommitdiff
path: root/src/core/arm/interpreter/armsupp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/arm/interpreter/armsupp.cpp')
-rw-r--r--src/core/arm/interpreter/armsupp.cpp156
1 files changed, 77 insertions, 79 deletions
diff --git a/src/core/arm/interpreter/armsupp.cpp b/src/core/arm/interpreter/armsupp.cpp
index e531dceda..7816c4c42 100644
--- a/src/core/arm/interpreter/armsupp.cpp
+++ b/src/core/arm/interpreter/armsupp.cpp
@@ -15,11 +15,9 @@
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
17 17
18#include "armdefs.h" 18#include "core/arm/interpreter/armdefs.h"
19#include "armemu.h" 19#include "core/arm/interpreter/armemu.h"
20 20#include "core/arm/interpreter/skyeye_defs.h"
21//#include "ansidecl.h"
22#include "skyeye_defs.h"
23#include "core/hle/coprocessor.h" 21#include "core/hle/coprocessor.h"
24#include "core/arm/disassembler/arm_disasm.h" 22#include "core/arm/disassembler/arm_disasm.h"
25 23
@@ -127,8 +125,7 @@ ARMul_GetCPSR (ARMul_State * state)
127{ 125{
128 //chy 2003-08-20: below is from gdb20030716, maybe isn't suitable for system simulator 126 //chy 2003-08-20: below is from gdb20030716, maybe isn't suitable for system simulator
129 //return (CPSR | state->Cpsr); for gdb20030716 127 //return (CPSR | state->Cpsr); for gdb20030716
130 // NOTE(bunnei): Changed this from [now] commented out macro "CPSR" 128 return (CPSR); //had be tested in old skyeye with gdb5.0-5.3
131 return ((ECC | EINT | EMODE | (TFLAG << 5))); //had be tested in old skyeye with gdb5.0-5.3
132} 129}
133 130
134/* This routine sets the value of the CPSR. */ 131/* This routine sets the value of the CPSR. */
@@ -145,7 +142,7 @@ ARMul_SetCPSR (ARMul_State * state, ARMword value)
145 142
146void 143void
147ARMul_FixCPSR (ARMul_State * state, ARMword instr, ARMword rhs) 144ARMul_FixCPSR (ARMul_State * state, ARMword instr, ARMword rhs)
148{ 145{
149 state->Cpsr = ARMul_GetCPSR (state); 146 state->Cpsr = ARMul_GetCPSR (state);
150 //chy 2006-02-16 , should not consider system mode, don't conside 26bit mode 147 //chy 2006-02-16 , should not consider system mode, don't conside 26bit mode
151 if (state->Mode != USER26MODE && state->Mode != USER32MODE ) { 148 if (state->Mode != USER26MODE && state->Mode != USER32MODE ) {
@@ -500,8 +497,8 @@ ARMul_LDC (ARMul_State * state, ARMword instr, ARMword address)
500 return; 497 return;
501 } 498 }
502 499
503 if (ADDREXCEPT (address)) 500 //if (ADDREXCEPT (address))
504 INTERNALABORT (address); 501 // INTERNALABORT (address);
505 502
506 cpab = (state->LDC[CPNum]) (state, ARMul_FIRST, instr, 0); 503 cpab = (state->LDC[CPNum]) (state, ARMul_FIRST, instr, 0);
507 while (cpab == ARMul_BUSY) { 504 while (cpab == ARMul_BUSY) {
@@ -594,8 +591,8 @@ ARMul_STC (ARMul_State * state, ARMword instr, ARMword address)
594 return; 591 return;
595 } 592 }
596 593
597 if (ADDREXCEPT (address) || VECTORACCESS (address)) 594 //if (ADDREXCEPT (address) || VECTORACCESS (address))
598 INTERNALABORT (address); 595 // INTERNALABORT (address);
599 596
600 cpab = (state->STC[CPNum]) (state, ARMul_FIRST, instr, &data); 597 cpab = (state->STC[CPNum]) (state, ARMul_FIRST, instr, &data);
601 while (cpab == ARMul_BUSY) { 598 while (cpab == ARMul_BUSY) {
@@ -661,40 +658,39 @@ ARMul_STC (ARMul_State * state, ARMword instr, ARMword address)
661void 658void
662ARMul_MCR (ARMul_State * state, ARMword instr, ARMword source) 659ARMul_MCR (ARMul_State * state, ARMword instr, ARMword source)
663{ 660{
664 HLE::CallMCR(instr, source); 661 unsigned cpab;
665 //unsigned cpab; 662
666 663 //printf("SKYEYE ARMul_MCR, CPnum is %x, source %x\n",CPNum, source);
667 ////printf("SKYEYE ARMul_MCR, CPnum is %x, source %x\n",CPNum, source); 664 if (!CP_ACCESS_ALLOWED (state, CPNum)) {
668 //if (!CP_ACCESS_ALLOWED (state, CPNum)) { 665 //chy 2004-07-19 should fix in the future ????!!!!
669 // //chy 2004-07-19 should fix in the future ????!!!! 666 //printf("SKYEYE ARMul_MCR, ACCESS_not ALLOWed, UndefinedInstr CPnum is %x, source %x\n",CPNum, source);
670 // //printf("SKYEYE ARMul_MCR, ACCESS_not ALLOWed, UndefinedInstr CPnum is %x, source %x\n",CPNum, source); 667 ARMul_UndefInstr (state, instr);
671 // ARMul_UndefInstr (state, instr); 668 return;
672 // return; 669 }
673 //} 670
674 671 cpab = (state->MCR[CPNum]) (state, ARMul_FIRST, instr, source);
675 //cpab = (state->MCR[CPNum]) (state, ARMul_FIRST, instr, source); 672
676 673 while (cpab == ARMul_BUSY) {
677 //while (cpab == ARMul_BUSY) { 674 ARMul_Icycles (state, 1, 0);
678 // ARMul_Icycles (state, 1, 0); 675
679 676 if (IntPending (state)) {
680 // if (IntPending (state)) { 677 cpab = (state->MCR[CPNum]) (state, ARMul_INTERRUPT,
681 // cpab = (state->MCR[CPNum]) (state, ARMul_INTERRUPT, 678 instr, 0);
682 // instr, 0); 679 return;
683 // return; 680 }
684 // } 681 else
685 // else 682 cpab = (state->MCR[CPNum]) (state, ARMul_BUSY, instr,
686 // cpab = (state->MCR[CPNum]) (state, ARMul_BUSY, instr, 683 source);
687 // source); 684 }
688 //} 685
689 686 if (cpab == ARMul_CANT) {
690 //if (cpab == ARMul_CANT) { 687 printf ("SKYEYE ARMul_MCR, CANT, UndefinedInstr %x CPnum is %x, source %x\n", instr, CPNum, source);
691 // printf ("SKYEYE ARMul_MCR, CANT, UndefinedInstr %x CPnum is %x, source %x\n", instr, CPNum, source); 688 ARMul_Abort (state, ARMul_UndefinedInstrV);
692 // ARMul_Abort (state, ARMul_UndefinedInstrV); 689 }
693 //} 690 else {
694 //else { 691 BUSUSEDINCPCN;
695 // BUSUSEDINCPCN; 692 ARMul_Ccycles (state, 1, 0);
696 // ARMul_Ccycles (state, 1, 0); 693 }
697 //}
698} 694}
699 695
700/* This function does the Busy-Waiting for an MCRR instruction. */ 696/* This function does the Busy-Waiting for an MCRR instruction. */
@@ -742,37 +738,41 @@ ARMul_MRC (ARMul_State * state, ARMword instr)
742 738
743 ARMword result = HLE::CallMRC(instr); 739 ARMword result = HLE::CallMRC(instr);
744 740
745 ////printf("SKYEYE ARMul_MRC, CPnum is %x, instr %x\n",CPNum, instr); 741 if (result != -1) {
746 //if (!CP_ACCESS_ALLOWED (state, CPNum)) { 742 return result;
747 // //chy 2004-07-19 should fix in the future????!!!! 743 }
748 // //printf("SKYEYE ARMul_MRC,NOT ALLOWed UndefInstr CPnum is %x, instr %x\n",CPNum, instr); 744
749 // ARMul_UndefInstr (state, instr); 745 //printf("SKYEYE ARMul_MRC, CPnum is %x, instr %x\n",CPNum, instr);
750 // return -1; 746 if (!CP_ACCESS_ALLOWED (state, CPNum)) {
751 //} 747 //chy 2004-07-19 should fix in the future????!!!!
752 748 //printf("SKYEYE ARMul_MRC,NOT ALLOWed UndefInstr CPnum is %x, instr %x\n",CPNum, instr);
753 //cpab = (state->MRC[CPNum]) (state, ARMul_FIRST, instr, &result); 749 ARMul_UndefInstr (state, instr);
754 //while (cpab == ARMul_BUSY) { 750 return -1;
755 // ARMul_Icycles (state, 1, 0); 751 }
756 // if (IntPending (state)) { 752
757 // cpab = (state->MRC[CPNum]) (state, ARMul_INTERRUPT, 753 cpab = (state->MRC[CPNum]) (state, ARMul_FIRST, instr, &result);
758 // instr, 0); 754 while (cpab == ARMul_BUSY) {
759 // return (0); 755 ARMul_Icycles (state, 1, 0);
760 // } 756 if (IntPending (state)) {
761 // else 757 cpab = (state->MRC[CPNum]) (state, ARMul_INTERRUPT,
762 // cpab = (state->MRC[CPNum]) (state, ARMul_BUSY, instr, 758 instr, 0);
763 // &result); 759 return (0);
764 //} 760 }
765 //if (cpab == ARMul_CANT) { 761 else
766 // printf ("SKYEYE ARMul_MRC,CANT UndefInstr CPnum is %x, instr %x\n", CPNum, instr); 762 cpab = (state->MRC[CPNum]) (state, ARMul_BUSY, instr,
767 // ARMul_Abort (state, ARMul_UndefinedInstrV); 763 &result);
768 // /* Parent will destroy the flags otherwise. */ 764 }
769 // result = ECC; 765 if (cpab == ARMul_CANT) {
770 //} 766 printf ("SKYEYE ARMul_MRC,CANT UndefInstr CPnum is %x, instr %x\n", CPNum, instr);
771 //else { 767 ARMul_Abort (state, ARMul_UndefinedInstrV);
772 // BUSUSEDINCPCN; 768 /* Parent will destroy the flags otherwise. */
773 // ARMul_Ccycles (state, 1, 0); 769 result = ECC;
774 // ARMul_Icycles (state, 1, 0); 770 }
775 //} 771 else {
772 BUSUSEDINCPCN;
773 ARMul_Ccycles (state, 1, 0);
774 ARMul_Icycles (state, 1, 0);
775 }
776 776
777 return result; 777 return result;
778} 778}
@@ -907,9 +907,7 @@ ARMul_ScheduleEvent (ARMul_State * state, unsigned int delay,
907 state->Now = ARMul_Time (state); 907 state->Now = ARMul_Time (state);
908 when = (state->Now + delay) % EVENTLISTSIZE; 908 when = (state->Now + delay) % EVENTLISTSIZE;
909 event = (struct EventNode *) malloc (sizeof (struct EventNode)); 909 event = (struct EventNode *) malloc (sizeof (struct EventNode));
910
911 _dbg_assert_msg_(ARM11, event, "SKYEYE:ARMul_ScheduleEvent: malloc event error\n"); 910 _dbg_assert_msg_(ARM11, event, "SKYEYE:ARMul_ScheduleEvent: malloc event error\n");
912
913 event->func = what; 911 event->func = what;
914 event->next = *(state->EventPtr + when); 912 event->next = *(state->EventPtr + when);
915 *(state->EventPtr + when) = event; 913 *(state->EventPtr + when) = event;