summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/arm/dyncom/arm_dyncom_interpreter.cpp407
-rw-r--r--src/core/arm/skyeye_common/vfp/vfpinstr.cpp128
2 files changed, 260 insertions, 275 deletions
diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
index b79fd1719..034f4d570 100644
--- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
+++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
@@ -13,6 +13,7 @@
13#include "core/memory.h" 13#include "core/memory.h"
14#include "core/hle/svc.h" 14#include "core/hle/svc.h"
15#include "core/arm/disassembler/arm_disasm.h" 15#include "core/arm/disassembler/arm_disasm.h"
16#include "core/arm/dyncom/arm_dyncom_dec.h"
16#include "core/arm/dyncom/arm_dyncom_interpreter.h" 17#include "core/arm/dyncom/arm_dyncom_interpreter.h"
17#include "core/arm/dyncom/arm_dyncom_thumb.h" 18#include "core/arm/dyncom/arm_dyncom_thumb.h"
18#include "core/arm/dyncom/arm_dyncom_run.h" 19#include "core/arm/dyncom/arm_dyncom_run.h"
@@ -68,6 +69,67 @@ static void remove_exclusive(ARMul_State* state, ARMword addr){
68 state->exclusive_tag = 0xFFFFFFFF; 69 state->exclusive_tag = 0xFFFFFFFF;
69} 70}
70 71
72static int CondPassed(ARMul_State* cpu, unsigned int cond) {
73 const u32 NFLAG = cpu->NFlag;
74 const u32 ZFLAG = cpu->ZFlag;
75 const u32 CFLAG = cpu->CFlag;
76 const u32 VFLAG = cpu->VFlag;
77
78 int temp = 0;
79
80 switch (cond) {
81 case 0x0:
82 temp = ZFLAG;
83 break;
84 case 0x1: // NE
85 temp = !ZFLAG;
86 break;
87 case 0x2: // CS
88 temp = CFLAG;
89 break;
90 case 0x3: // CC
91 temp = !CFLAG;
92 break;
93 case 0x4: // MI
94 temp = NFLAG;
95 break;
96 case 0x5: // PL
97 temp = !NFLAG;
98 break;
99 case 0x6: // VS
100 temp = VFLAG;
101 break;
102 case 0x7: // VC
103 temp = !VFLAG;
104 break;
105 case 0x8: // HI
106 temp = (CFLAG && !ZFLAG);
107 break;
108 case 0x9: // LS
109 temp = (!CFLAG || ZFLAG);
110 break;
111 case 0xa: // GE
112 temp = ((!NFLAG && !VFLAG) || (NFLAG && VFLAG));
113 break;
114 case 0xb: // LT
115 temp = ((NFLAG && !VFLAG) || (!NFLAG && VFLAG));
116 break;
117 case 0xc: // GT
118 temp = ((!NFLAG && !VFLAG && !ZFLAG) || (NFLAG && VFLAG && !ZFLAG));
119 break;
120 case 0xd: // LE
121 temp = ((NFLAG && !VFLAG) || (!NFLAG && VFLAG)) || ZFLAG;
122 break;
123 case 0xe: // AL
124 temp = 1;
125 break;
126 case 0xf:
127 temp = 1;
128 break;
129 }
130 return temp;
131}
132
71static unsigned int DPO(Immediate)(ARMul_State* cpu, unsigned int sht_oper) { 133static unsigned int DPO(Immediate)(ARMul_State* cpu, unsigned int sht_oper) {
72 unsigned int immed_8 = BITS(sht_oper, 0, 7); 134 unsigned int immed_8 = BITS(sht_oper, 0, 7);
73 unsigned int rotate_imm = BITS(sht_oper, 8, 11); 135 unsigned int rotate_imm = BITS(sht_oper, 8, 11);
@@ -224,14 +286,12 @@ static unsigned int DPO(RotateRightByRegister)(ARMul_State* cpu, unsigned int sh
224 286
225typedef void (*get_addr_fp_t)(ARMul_State *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int rw); 287typedef void (*get_addr_fp_t)(ARMul_State *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int rw);
226 288
227typedef struct _ldst_inst { 289struct ldst_inst {
228 unsigned int inst; 290 unsigned int inst;
229 get_addr_fp_t get_addr; 291 get_addr_fp_t get_addr;
230} ldst_inst; 292};
231#define DEBUG_MSG LOG_DEBUG(Core_ARM11, "inst is %x", inst); CITRA_IGNORE_EXIT(0) 293#define DEBUG_MSG LOG_DEBUG(Core_ARM11, "inst is %x", inst); CITRA_IGNORE_EXIT(0)
232 294
233int CondPassed(ARMul_State* cpu, unsigned int cond);
234
235#define LnSWoUB(s) glue(LnSWoUB, s) 295#define LnSWoUB(s) glue(LnSWoUB, s)
236#define MLnS(s) glue(MLnS, s) 296#define MLnS(s) glue(MLnS, s)
237#define LdnStM(s) glue(LdnStM, s) 297#define LdnStM(s) glue(LdnStM, s)
@@ -647,255 +707,248 @@ static void LnSWoUB(ScaledRegisterOffset)(ARMul_State* cpu, unsigned int inst, u
647 virt_addr = addr; 707 virt_addr = addr;
648} 708}
649 709
650typedef struct _arm_inst { 710struct arm_inst {
651 unsigned int idx; 711 unsigned int idx;
652 unsigned int cond; 712 unsigned int cond;
653 int br; 713 int br;
654 int load_r15; 714 int load_r15;
655 char component[0]; 715 char component[0];
656} arm_inst; 716};
657 717
658typedef struct generic_arm_inst { 718struct generic_arm_inst {
659 u32 Ra; 719 u32 Ra;
660 u32 Rm; 720 u32 Rm;
661 u32 Rn; 721 u32 Rn;
662 u32 Rd; 722 u32 Rd;
663 u8 op1; 723 u8 op1;
664 u8 op2; 724 u8 op2;
665} generic_arm_inst; 725};
666 726
667typedef struct _adc_inst { 727struct adc_inst {
668 unsigned int I; 728 unsigned int I;
669 unsigned int S; 729 unsigned int S;
670 unsigned int Rn; 730 unsigned int Rn;
671 unsigned int Rd; 731 unsigned int Rd;
672 unsigned int shifter_operand; 732 unsigned int shifter_operand;
673 shtop_fp_t shtop_func; 733 shtop_fp_t shtop_func;
674} adc_inst; 734};
675 735
676typedef struct _add_inst { 736struct add_inst {
677 unsigned int I; 737 unsigned int I;
678 unsigned int S; 738 unsigned int S;
679 unsigned int Rn; 739 unsigned int Rn;
680 unsigned int Rd; 740 unsigned int Rd;
681 unsigned int shifter_operand; 741 unsigned int shifter_operand;
682 shtop_fp_t shtop_func; 742 shtop_fp_t shtop_func;
683} add_inst; 743};
684 744
685typedef struct _orr_inst { 745struct orr_inst {
686 unsigned int I; 746 unsigned int I;
687 unsigned int S; 747 unsigned int S;
688 unsigned int Rn; 748 unsigned int Rn;
689 unsigned int Rd; 749 unsigned int Rd;
690 unsigned int shifter_operand; 750 unsigned int shifter_operand;
691 shtop_fp_t shtop_func; 751 shtop_fp_t shtop_func;
692} orr_inst; 752};
693 753
694typedef struct _and_inst { 754struct and_inst {
695 unsigned int I; 755 unsigned int I;
696 unsigned int S; 756 unsigned int S;
697 unsigned int Rn; 757 unsigned int Rn;
698 unsigned int Rd; 758 unsigned int Rd;
699 unsigned int shifter_operand; 759 unsigned int shifter_operand;
700 shtop_fp_t shtop_func; 760 shtop_fp_t shtop_func;
701} and_inst; 761};
702 762
703typedef struct _eor_inst { 763struct eor_inst {
704 unsigned int I; 764 unsigned int I;
705 unsigned int S; 765 unsigned int S;
706 unsigned int Rn; 766 unsigned int Rn;
707 unsigned int Rd; 767 unsigned int Rd;
708 unsigned int shifter_operand; 768 unsigned int shifter_operand;
709 shtop_fp_t shtop_func; 769 shtop_fp_t shtop_func;
710} eor_inst; 770};
711 771
712typedef struct _bbl_inst { 772struct bbl_inst {
713 unsigned int L; 773 unsigned int L;
714 int signed_immed_24; 774 int signed_immed_24;
715 unsigned int next_addr; 775 unsigned int next_addr;
716 unsigned int jmp_addr; 776 unsigned int jmp_addr;
717} bbl_inst; 777};
718 778
719typedef struct _bx_inst { 779struct bx_inst {
720 unsigned int Rm; 780 unsigned int Rm;
721} bx_inst; 781};
722 782
723typedef struct _blx_inst { 783struct blx_inst {
724 union { 784 union {
725 int32_t signed_immed_24; 785 int32_t signed_immed_24;
726 uint32_t Rm; 786 uint32_t Rm;
727 } val; 787 } val;
728 unsigned int inst; 788 unsigned int inst;
729} blx_inst; 789};
730 790
731typedef struct _clz_inst { 791struct clz_inst {
732 unsigned int Rm; 792 unsigned int Rm;
733 unsigned int Rd; 793 unsigned int Rd;
734} clz_inst; 794};
735 795
736typedef struct _cps_inst { 796struct cps_inst {
737 unsigned int imod0; 797 unsigned int imod0;
738 unsigned int imod1; 798 unsigned int imod1;
739 unsigned int mmod; 799 unsigned int mmod;
740 unsigned int A, I, F; 800 unsigned int A, I, F;
741 unsigned int mode; 801 unsigned int mode;
742} cps_inst; 802};
743 803
744typedef struct _clrex_inst { 804struct clrex_inst {
745} clrex_inst; 805};
746 806
747typedef struct _cpy_inst { 807struct cpy_inst {
748 unsigned int Rm; 808 unsigned int Rm;
749 unsigned int Rd; 809 unsigned int Rd;
750} cpy_inst; 810};
751 811
752typedef struct _bic_inst { 812struct bic_inst {
753 unsigned int I; 813 unsigned int I;
754 unsigned int S; 814 unsigned int S;
755 unsigned int Rn; 815 unsigned int Rn;
756 unsigned int Rd; 816 unsigned int Rd;
757 unsigned int shifter_operand; 817 unsigned int shifter_operand;
758 shtop_fp_t shtop_func; 818 shtop_fp_t shtop_func;
759} bic_inst; 819};
760 820
761typedef struct _sub_inst { 821struct sub_inst {
762 unsigned int I; 822 unsigned int I;
763 unsigned int S; 823 unsigned int S;
764 unsigned int Rn; 824 unsigned int Rn;
765 unsigned int Rd; 825 unsigned int Rd;
766 unsigned int shifter_operand; 826 unsigned int shifter_operand;
767 shtop_fp_t shtop_func; 827 shtop_fp_t shtop_func;
768} sub_inst; 828};
769 829
770typedef struct _tst_inst { 830struct tst_inst {
771 unsigned int I; 831 unsigned int I;
772 unsigned int S; 832 unsigned int S;
773 unsigned int Rn; 833 unsigned int Rn;
774 unsigned int Rd; 834 unsigned int Rd;
775 unsigned int shifter_operand; 835 unsigned int shifter_operand;
776 shtop_fp_t shtop_func; 836 shtop_fp_t shtop_func;
777} tst_inst; 837};
778 838
779typedef struct _cmn_inst { 839struct cmn_inst {
780 unsigned int I; 840 unsigned int I;
781 unsigned int Rn; 841 unsigned int Rn;
782 unsigned int shifter_operand; 842 unsigned int shifter_operand;
783 shtop_fp_t shtop_func; 843 shtop_fp_t shtop_func;
784} cmn_inst; 844};
785 845
786typedef struct _teq_inst { 846struct teq_inst {
787 unsigned int I; 847 unsigned int I;
788 unsigned int Rn; 848 unsigned int Rn;
789 unsigned int shifter_operand; 849 unsigned int shifter_operand;
790 shtop_fp_t shtop_func; 850 shtop_fp_t shtop_func;
791} teq_inst; 851};
792 852
793typedef struct _stm_inst { 853struct stm_inst {
794 unsigned int inst; 854 unsigned int inst;
795} stm_inst; 855};
796 856
797struct bkpt_inst { 857struct bkpt_inst {
798 u32 imm; 858 u32 imm;
799}; 859};
800 860
801struct blx1_inst { 861struct stc_inst {
802 unsigned int addr;
803}; 862};
804 863
805struct blx2_inst { 864struct ldc_inst {
806 unsigned int Rm;
807}; 865};
808 866
809typedef struct _stc_inst { 867struct swi_inst {
810} stc_inst;
811
812typedef struct _ldc_inst {
813} ldc_inst;
814
815typedef struct _swi_inst {
816 unsigned int num; 868 unsigned int num;
817} swi_inst; 869};
818 870
819typedef struct _cmp_inst { 871struct cmp_inst {
820 unsigned int I; 872 unsigned int I;
821 unsigned int Rn; 873 unsigned int Rn;
822 unsigned int shifter_operand; 874 unsigned int shifter_operand;
823 shtop_fp_t shtop_func; 875 shtop_fp_t shtop_func;
824} cmp_inst; 876};
825 877
826typedef struct _mov_inst { 878struct mov_inst {
827 unsigned int I; 879 unsigned int I;
828 unsigned int S; 880 unsigned int S;
829 unsigned int Rd; 881 unsigned int Rd;
830 unsigned int shifter_operand; 882 unsigned int shifter_operand;
831 shtop_fp_t shtop_func; 883 shtop_fp_t shtop_func;
832} mov_inst; 884};
833 885
834typedef struct _mvn_inst { 886struct mvn_inst {
835 unsigned int I; 887 unsigned int I;
836 unsigned int S; 888 unsigned int S;
837 unsigned int Rd; 889 unsigned int Rd;
838 unsigned int shifter_operand; 890 unsigned int shifter_operand;
839 shtop_fp_t shtop_func; 891 shtop_fp_t shtop_func;
840} mvn_inst; 892};
841 893
842typedef struct _rev_inst { 894struct rev_inst {
843 unsigned int Rd; 895 unsigned int Rd;
844 unsigned int Rm; 896 unsigned int Rm;
845 unsigned int op1; 897 unsigned int op1;
846 unsigned int op2; 898 unsigned int op2;
847} rev_inst; 899};
848 900
849typedef struct _rsb_inst { 901struct rsb_inst {
850 unsigned int I; 902 unsigned int I;
851 unsigned int S; 903 unsigned int S;
852 unsigned int Rn; 904 unsigned int Rn;
853 unsigned int Rd; 905 unsigned int Rd;
854 unsigned int shifter_operand; 906 unsigned int shifter_operand;
855 shtop_fp_t shtop_func; 907 shtop_fp_t shtop_func;
856} rsb_inst; 908};
857 909
858typedef struct _rsc_inst { 910struct rsc_inst {
859 unsigned int I; 911 unsigned int I;
860 unsigned int S; 912 unsigned int S;
861 unsigned int Rn; 913 unsigned int Rn;
862 unsigned int Rd; 914 unsigned int Rd;
863 unsigned int shifter_operand; 915 unsigned int shifter_operand;
864 shtop_fp_t shtop_func; 916 shtop_fp_t shtop_func;
865} rsc_inst; 917};
866 918
867typedef struct _sbc_inst { 919struct sbc_inst {
868 unsigned int I; 920 unsigned int I;
869 unsigned int S; 921 unsigned int S;
870 unsigned int Rn; 922 unsigned int Rn;
871 unsigned int Rd; 923 unsigned int Rd;
872 unsigned int shifter_operand; 924 unsigned int shifter_operand;
873 shtop_fp_t shtop_func; 925 shtop_fp_t shtop_func;
874} sbc_inst; 926};
875 927
876typedef struct _mul_inst { 928struct mul_inst {
877 unsigned int S; 929 unsigned int S;
878 unsigned int Rd; 930 unsigned int Rd;
879 unsigned int Rs; 931 unsigned int Rs;
880 unsigned int Rm; 932 unsigned int Rm;
881} mul_inst; 933};
882 934
883typedef struct _smul_inst { 935struct smul_inst {
884 unsigned int Rd; 936 unsigned int Rd;
885 unsigned int Rs; 937 unsigned int Rs;
886 unsigned int Rm; 938 unsigned int Rm;
887 unsigned int x; 939 unsigned int x;
888 unsigned int y; 940 unsigned int y;
889} smul_inst; 941};
890 942
891typedef struct _umull_inst { 943struct umull_inst {
892 unsigned int S; 944 unsigned int S;
893 unsigned int RdHi; 945 unsigned int RdHi;
894 unsigned int RdLo; 946 unsigned int RdLo;
895 unsigned int Rs; 947 unsigned int Rs;
896 unsigned int Rm; 948 unsigned int Rm;
897} umull_inst; 949};
898typedef struct _smlad_inst { 950
951struct smlad_inst {
899 unsigned int m; 952 unsigned int m;
900 unsigned int Rm; 953 unsigned int Rm;
901 unsigned int Rd; 954 unsigned int Rd;
@@ -903,58 +956,58 @@ typedef struct _smlad_inst {
903 unsigned int Rn; 956 unsigned int Rn;
904 unsigned int op1; 957 unsigned int op1;
905 unsigned int op2; 958 unsigned int op2;
906} smlad_inst; 959};
907 960
908typedef struct _smla_inst { 961struct smla_inst {
909 unsigned int x; 962 unsigned int x;
910 unsigned int y; 963 unsigned int y;
911 unsigned int Rm; 964 unsigned int Rm;
912 unsigned int Rd; 965 unsigned int Rd;
913 unsigned int Rs; 966 unsigned int Rs;
914 unsigned int Rn; 967 unsigned int Rn;
915} smla_inst; 968};
916 969
917typedef struct smlalxy_inst { 970struct smlalxy_inst {
918 unsigned int x; 971 unsigned int x;
919 unsigned int y; 972 unsigned int y;
920 unsigned int RdLo; 973 unsigned int RdLo;
921 unsigned int RdHi; 974 unsigned int RdHi;
922 unsigned int Rm; 975 unsigned int Rm;
923 unsigned int Rn; 976 unsigned int Rn;
924} smlalxy_inst; 977};
925 978
926typedef struct ssat_inst { 979struct ssat_inst {
927 unsigned int Rn; 980 unsigned int Rn;
928 unsigned int Rd; 981 unsigned int Rd;
929 unsigned int imm5; 982 unsigned int imm5;
930 unsigned int sat_imm; 983 unsigned int sat_imm;
931 unsigned int shift_type; 984 unsigned int shift_type;
932} ssat_inst; 985};
933 986
934typedef struct umaal_inst { 987struct umaal_inst {
935 unsigned int Rn; 988 unsigned int Rn;
936 unsigned int Rm; 989 unsigned int Rm;
937 unsigned int RdHi; 990 unsigned int RdHi;
938 unsigned int RdLo; 991 unsigned int RdLo;
939} umaal_inst; 992};
940 993
941typedef struct _umlal_inst { 994struct umlal_inst {
942 unsigned int S; 995 unsigned int S;
943 unsigned int Rm; 996 unsigned int Rm;
944 unsigned int Rs; 997 unsigned int Rs;
945 unsigned int RdHi; 998 unsigned int RdHi;
946 unsigned int RdLo; 999 unsigned int RdLo;
947} umlal_inst; 1000};
948 1001
949typedef struct _smlal_inst { 1002struct smlal_inst {
950 unsigned int S; 1003 unsigned int S;
951 unsigned int Rm; 1004 unsigned int Rm;
952 unsigned int Rs; 1005 unsigned int Rs;
953 unsigned int RdHi; 1006 unsigned int RdHi;
954 unsigned int RdLo; 1007 unsigned int RdLo;
955} smlal_inst; 1008};
956 1009
957typedef struct smlald_inst { 1010struct smlald_inst {
958 unsigned int RdLo; 1011 unsigned int RdLo;
959 unsigned int RdHi; 1012 unsigned int RdHi;
960 unsigned int Rm; 1013 unsigned int Rm;
@@ -962,17 +1015,17 @@ typedef struct smlald_inst {
962 unsigned int swap; 1015 unsigned int swap;
963 unsigned int op1; 1016 unsigned int op1;
964 unsigned int op2; 1017 unsigned int op2;
965} smlald_inst; 1018};
966 1019
967typedef struct _mla_inst { 1020struct mla_inst {
968 unsigned int S; 1021 unsigned int S;
969 unsigned int Rn; 1022 unsigned int Rn;
970 unsigned int Rd; 1023 unsigned int Rd;
971 unsigned int Rs; 1024 unsigned int Rs;
972 unsigned int Rm; 1025 unsigned int Rm;
973} mla_inst; 1026};
974 1027
975typedef struct _mrc_inst { 1028struct mrc_inst {
976 unsigned int opcode_1; 1029 unsigned int opcode_1;
977 unsigned int opcode_2; 1030 unsigned int opcode_2;
978 unsigned int cp_num; 1031 unsigned int cp_num;
@@ -980,9 +1033,9 @@ typedef struct _mrc_inst {
980 unsigned int crm; 1033 unsigned int crm;
981 unsigned int Rd; 1034 unsigned int Rd;
982 unsigned int inst; 1035 unsigned int inst;
983} mrc_inst; 1036};
984 1037
985typedef struct _mcr_inst { 1038struct mcr_inst {
986 unsigned int opcode_1; 1039 unsigned int opcode_1;
987 unsigned int opcode_2; 1040 unsigned int opcode_2;
988 unsigned int cp_num; 1041 unsigned int cp_num;
@@ -990,77 +1043,77 @@ typedef struct _mcr_inst {
990 unsigned int crm; 1043 unsigned int crm;
991 unsigned int Rd; 1044 unsigned int Rd;
992 unsigned int inst; 1045 unsigned int inst;
993} mcr_inst; 1046};
994 1047
995typedef struct mcrr_inst { 1048struct mcrr_inst {
996 unsigned int opcode_1; 1049 unsigned int opcode_1;
997 unsigned int cp_num; 1050 unsigned int cp_num;
998 unsigned int crm; 1051 unsigned int crm;
999 unsigned int rt; 1052 unsigned int rt;
1000 unsigned int rt2; 1053 unsigned int rt2;
1001} mcrr_inst; 1054};
1002 1055
1003typedef struct _mrs_inst { 1056struct mrs_inst {
1004 unsigned int R; 1057 unsigned int R;
1005 unsigned int Rd; 1058 unsigned int Rd;
1006} mrs_inst; 1059};
1007 1060
1008typedef struct _msr_inst { 1061struct msr_inst {
1009 unsigned int field_mask; 1062 unsigned int field_mask;
1010 unsigned int R; 1063 unsigned int R;
1011 unsigned int inst; 1064 unsigned int inst;
1012} msr_inst; 1065};
1013 1066
1014typedef struct _pld_inst { 1067struct pld_inst {
1015} pld_inst; 1068};
1016 1069
1017typedef struct _sxtb_inst { 1070struct sxtb_inst {
1018 unsigned int Rd; 1071 unsigned int Rd;
1019 unsigned int Rm; 1072 unsigned int Rm;
1020 unsigned int rotate; 1073 unsigned int rotate;
1021} sxtb_inst; 1074};
1022 1075
1023typedef struct _sxtab_inst { 1076struct sxtab_inst {
1024 unsigned int Rd; 1077 unsigned int Rd;
1025 unsigned int Rn; 1078 unsigned int Rn;
1026 unsigned int Rm; 1079 unsigned int Rm;
1027 unsigned rotate; 1080 unsigned rotate;
1028} sxtab_inst; 1081};
1029 1082
1030typedef struct _sxtah_inst { 1083struct sxtah_inst {
1031 unsigned int Rd; 1084 unsigned int Rd;
1032 unsigned int Rn; 1085 unsigned int Rn;
1033 unsigned int Rm; 1086 unsigned int Rm;
1034 unsigned int rotate; 1087 unsigned int rotate;
1035} sxtah_inst; 1088};
1036 1089
1037typedef struct _sxth_inst { 1090struct sxth_inst {
1038 unsigned int Rd; 1091 unsigned int Rd;
1039 unsigned int Rm; 1092 unsigned int Rm;
1040 unsigned int rotate; 1093 unsigned int rotate;
1041} sxth_inst; 1094};
1042 1095
1043typedef struct _uxtab_inst { 1096struct uxtab_inst {
1044 unsigned int Rn; 1097 unsigned int Rn;
1045 unsigned int Rd; 1098 unsigned int Rd;
1046 unsigned int rotate; 1099 unsigned int rotate;
1047 unsigned int Rm; 1100 unsigned int Rm;
1048} uxtab_inst; 1101};
1049 1102
1050typedef struct _uxtah_inst { 1103struct uxtah_inst {
1051 unsigned int Rn; 1104 unsigned int Rn;
1052 unsigned int Rd; 1105 unsigned int Rd;
1053 unsigned int rotate; 1106 unsigned int rotate;
1054 unsigned int Rm; 1107 unsigned int Rm;
1055} uxtah_inst; 1108};
1056 1109
1057typedef struct _uxth_inst { 1110struct uxth_inst {
1058 unsigned int Rd; 1111 unsigned int Rd;
1059 unsigned int Rm; 1112 unsigned int Rm;
1060 unsigned int rotate; 1113 unsigned int rotate;
1061} uxth_inst; 1114};
1062 1115
1063typedef struct _cdp_inst { 1116struct cdp_inst {
1064 unsigned int opcode_1; 1117 unsigned int opcode_1;
1065 unsigned int CRn; 1118 unsigned int CRn;
1066 unsigned int CRd; 1119 unsigned int CRd;
@@ -1068,56 +1121,56 @@ typedef struct _cdp_inst {
1068 unsigned int opcode_2; 1121 unsigned int opcode_2;
1069 unsigned int CRm; 1122 unsigned int CRm;
1070 unsigned int inst; 1123 unsigned int inst;
1071}cdp_inst; 1124};
1072 1125
1073typedef struct _uxtb_inst { 1126struct uxtb_inst {
1074 unsigned int Rd; 1127 unsigned int Rd;
1075 unsigned int Rm; 1128 unsigned int Rm;
1076 unsigned int rotate; 1129 unsigned int rotate;
1077} uxtb_inst; 1130};
1078 1131
1079typedef struct _swp_inst { 1132struct swp_inst {
1080 unsigned int Rn; 1133 unsigned int Rn;
1081 unsigned int Rd; 1134 unsigned int Rd;
1082 unsigned int Rm; 1135 unsigned int Rm;
1083} swp_inst; 1136};
1084 1137
1085typedef struct setend_inst { 1138struct setend_inst {
1086 unsigned int set_bigend; 1139 unsigned int set_bigend;
1087} setend_inst; 1140};
1088 1141
1089typedef struct _b_2_thumb { 1142struct b_2_thumb {
1090 unsigned int imm; 1143 unsigned int imm;
1091}b_2_thumb; 1144};
1092typedef struct _b_cond_thumb { 1145struct b_cond_thumb {
1093 unsigned int imm; 1146 unsigned int imm;
1094 unsigned int cond; 1147 unsigned int cond;
1095}b_cond_thumb; 1148};
1096 1149
1097typedef struct _bl_1_thumb { 1150struct bl_1_thumb {
1098 unsigned int imm; 1151 unsigned int imm;
1099}bl_1_thumb; 1152};
1100typedef struct _bl_2_thumb { 1153struct bl_2_thumb {
1101 unsigned int imm; 1154 unsigned int imm;
1102}bl_2_thumb; 1155};
1103typedef struct _blx_1_thumb { 1156struct blx_1_thumb {
1104 unsigned int imm; 1157 unsigned int imm;
1105 unsigned int instr; 1158 unsigned int instr;
1106}blx_1_thumb; 1159};
1107 1160
1108typedef struct _pkh_inst { 1161struct pkh_inst {
1109 unsigned int Rm; 1162 unsigned int Rm;
1110 unsigned int Rn; 1163 unsigned int Rn;
1111 unsigned int Rd; 1164 unsigned int Rd;
1112 unsigned char imm; 1165 unsigned char imm;
1113} pkh_inst; 1166};
1114 1167
1115typedef arm_inst * ARM_INST_PTR; 1168typedef arm_inst * ARM_INST_PTR;
1116 1169
1117#define CACHE_BUFFER_SIZE (64 * 1024 * 2000) 1170#define CACHE_BUFFER_SIZE (64 * 1024 * 2000)
1118char inst_buf[CACHE_BUFFER_SIZE]; 1171static char inst_buf[CACHE_BUFFER_SIZE];
1119int top = 0; 1172static int top = 0;
1120inline void *AllocBuffer(unsigned int size) { 1173static inline void *AllocBuffer(unsigned int size) {
1121 int start = top; 1174 int start = top;
1122 top += size; 1175 top += size;
1123 if (top > CACHE_BUFFER_SIZE) { 1176 if (top > CACHE_BUFFER_SIZE) {
@@ -1127,74 +1180,6 @@ inline void *AllocBuffer(unsigned int size) {
1127 return (void *)&inst_buf[start]; 1180 return (void *)&inst_buf[start];
1128} 1181}
1129 1182
1130int CondPassed(ARMul_State* cpu, unsigned int cond) {
1131 #define NFLAG cpu->NFlag
1132 #define ZFLAG cpu->ZFlag
1133 #define CFLAG cpu->CFlag
1134 #define VFLAG cpu->VFlag
1135
1136 int temp = 0;
1137
1138 switch (cond) {
1139 case 0x0:
1140 temp = ZFLAG;
1141 break;
1142 case 0x1: // NE
1143 temp = !ZFLAG;
1144 break;
1145 case 0x6: // VS
1146 temp = VFLAG;
1147 break;
1148 case 0x7: // VC
1149 temp = !VFLAG;
1150 break;
1151 case 0x4: // MI
1152 temp = NFLAG;
1153 break;
1154 case 0x5: // PL
1155 temp = !NFLAG;
1156 break;
1157 case 0x2: // CS
1158 temp = CFLAG;
1159 break;
1160 case 0x3: // CC
1161 temp = !CFLAG;
1162 break;
1163 case 0x8: // HI
1164 temp = (CFLAG && !ZFLAG);
1165 break;
1166 case 0x9: // LS
1167 temp = (!CFLAG || ZFLAG);
1168 break;
1169 case 0xa: // GE
1170 temp = ((!NFLAG && !VFLAG) || (NFLAG && VFLAG));
1171 break;
1172 case 0xb: // LT
1173 temp = ((NFLAG && !VFLAG) || (!NFLAG && VFLAG));
1174 break;
1175 case 0xc: // GT
1176 temp = ((!NFLAG && !VFLAG && !ZFLAG) || (NFLAG && VFLAG && !ZFLAG));
1177 break;
1178 case 0xd: // LE
1179 temp = ((NFLAG && !VFLAG) || (!NFLAG && VFLAG)) || ZFLAG;
1180 break;
1181 case 0xe: // AL
1182 temp = 1;
1183 break;
1184 case 0xf:
1185 temp = 1;
1186 break;
1187 }
1188 return temp;
1189}
1190
1191enum DECODE_STATUS {
1192 DECODE_SUCCESS,
1193 DECODE_FAILURE
1194};
1195
1196int decode_arm_instr(uint32_t instr, int32_t *idx);
1197
1198static shtop_fp_t get_shtop(unsigned int inst) { 1183static shtop_fp_t get_shtop(unsigned int inst) {
1199 if (BIT(inst, 25)) { 1184 if (BIT(inst, 25)) {
1200 return DPO(Immediate); 1185 return DPO(Immediate);
diff --git a/src/core/arm/skyeye_common/vfp/vfpinstr.cpp b/src/core/arm/skyeye_common/vfp/vfpinstr.cpp
index 72afe2164..a04bf915c 100644
--- a/src/core/arm/skyeye_common/vfp/vfpinstr.cpp
+++ b/src/core/arm/skyeye_common/vfp/vfpinstr.cpp
@@ -13,10 +13,10 @@
13/* VMLA */ 13/* VMLA */
14/* cond 1110 0D00 Vn-- Vd-- 101X N0M0 Vm-- */ 14/* cond 1110 0D00 Vn-- Vd-- 101X N0M0 Vm-- */
15#ifdef VFP_INTERPRETER_STRUCT 15#ifdef VFP_INTERPRETER_STRUCT
16typedef struct _vmla_inst { 16struct vmla_inst {
17 unsigned int instr; 17 unsigned int instr;
18 unsigned int dp_operation; 18 unsigned int dp_operation;
19} vmla_inst; 19};
20#endif 20#endif
21#ifdef VFP_INTERPRETER_TRANS 21#ifdef VFP_INTERPRETER_TRANS
22static ARM_INST_PTR INTERPRETER_TRANSLATE(vmla)(unsigned int inst, int index) 22static ARM_INST_PTR INTERPRETER_TRANSLATE(vmla)(unsigned int inst, int index)
@@ -63,10 +63,10 @@ VMLA_INST:
63/* VNMLS */ 63/* VNMLS */
64/* cond 1110 0D00 Vn-- Vd-- 101X N1M0 Vm-- */ 64/* cond 1110 0D00 Vn-- Vd-- 101X N1M0 Vm-- */
65#ifdef VFP_INTERPRETER_STRUCT 65#ifdef VFP_INTERPRETER_STRUCT
66typedef struct _vmls_inst { 66struct vmls_inst {
67 unsigned int instr; 67 unsigned int instr;
68 unsigned int dp_operation; 68 unsigned int dp_operation;
69} vmls_inst; 69};
70#endif 70#endif
71#ifdef VFP_INTERPRETER_TRANS 71#ifdef VFP_INTERPRETER_TRANS
72static ARM_INST_PTR INTERPRETER_TRANSLATE(vmls)(unsigned int inst, int index) 72static ARM_INST_PTR INTERPRETER_TRANSLATE(vmls)(unsigned int inst, int index)
@@ -113,10 +113,10 @@ VMLS_INST:
113/* VNMLA */ 113/* VNMLA */
114/* cond 1110 0D01 Vn-- Vd-- 101X N1M0 Vm-- */ 114/* cond 1110 0D01 Vn-- Vd-- 101X N1M0 Vm-- */
115#ifdef VFP_INTERPRETER_STRUCT 115#ifdef VFP_INTERPRETER_STRUCT
116typedef struct _vnmla_inst { 116struct vnmla_inst {
117 unsigned int instr; 117 unsigned int instr;
118 unsigned int dp_operation; 118 unsigned int dp_operation;
119} vnmla_inst; 119};
120#endif 120#endif
121#ifdef VFP_INTERPRETER_TRANS 121#ifdef VFP_INTERPRETER_TRANS
122static ARM_INST_PTR INTERPRETER_TRANSLATE(vnmla)(unsigned int inst, int index) 122static ARM_INST_PTR INTERPRETER_TRANSLATE(vnmla)(unsigned int inst, int index)
@@ -164,10 +164,10 @@ VNMLA_INST:
164/* cond 1110 0D01 Vn-- Vd-- 101X N0M0 Vm-- */ 164/* cond 1110 0D01 Vn-- Vd-- 101X N0M0 Vm-- */
165 165
166#ifdef VFP_INTERPRETER_STRUCT 166#ifdef VFP_INTERPRETER_STRUCT
167typedef struct _vnmls_inst { 167struct vnmls_inst {
168 unsigned int instr; 168 unsigned int instr;
169 unsigned int dp_operation; 169 unsigned int dp_operation;
170} vnmls_inst; 170};
171#endif 171#endif
172#ifdef VFP_INTERPRETER_TRANS 172#ifdef VFP_INTERPRETER_TRANS
173static ARM_INST_PTR INTERPRETER_TRANSLATE(vnmls)(unsigned int inst, int index) 173static ARM_INST_PTR INTERPRETER_TRANSLATE(vnmls)(unsigned int inst, int index)
@@ -214,10 +214,10 @@ VNMLS_INST:
214/* VNMUL */ 214/* VNMUL */
215/* cond 1110 0D10 Vn-- Vd-- 101X N0M0 Vm-- */ 215/* cond 1110 0D10 Vn-- Vd-- 101X N0M0 Vm-- */
216#ifdef VFP_INTERPRETER_STRUCT 216#ifdef VFP_INTERPRETER_STRUCT
217typedef struct _vnmul_inst { 217struct vnmul_inst {
218 unsigned int instr; 218 unsigned int instr;
219 unsigned int dp_operation; 219 unsigned int dp_operation;
220} vnmul_inst; 220};
221#endif 221#endif
222#ifdef VFP_INTERPRETER_TRANS 222#ifdef VFP_INTERPRETER_TRANS
223static ARM_INST_PTR INTERPRETER_TRANSLATE(vnmul)(unsigned int inst, int index) 223static ARM_INST_PTR INTERPRETER_TRANSLATE(vnmul)(unsigned int inst, int index)
@@ -264,10 +264,10 @@ VNMUL_INST:
264/* VMUL */ 264/* VMUL */
265/* cond 1110 0D10 Vn-- Vd-- 101X N0M0 Vm-- */ 265/* cond 1110 0D10 Vn-- Vd-- 101X N0M0 Vm-- */
266#ifdef VFP_INTERPRETER_STRUCT 266#ifdef VFP_INTERPRETER_STRUCT
267typedef struct _vmul_inst { 267struct vmul_inst {
268 unsigned int instr; 268 unsigned int instr;
269 unsigned int dp_operation; 269 unsigned int dp_operation;
270} vmul_inst; 270};
271#endif 271#endif
272#ifdef VFP_INTERPRETER_TRANS 272#ifdef VFP_INTERPRETER_TRANS
273static ARM_INST_PTR INTERPRETER_TRANSLATE(vmul)(unsigned int inst, int index) 273static ARM_INST_PTR INTERPRETER_TRANSLATE(vmul)(unsigned int inst, int index)
@@ -314,10 +314,10 @@ VMUL_INST:
314/* VADD */ 314/* VADD */
315/* cond 1110 0D11 Vn-- Vd-- 101X N0M0 Vm-- */ 315/* cond 1110 0D11 Vn-- Vd-- 101X N0M0 Vm-- */
316#ifdef VFP_INTERPRETER_STRUCT 316#ifdef VFP_INTERPRETER_STRUCT
317typedef struct _vadd_inst { 317struct vadd_inst {
318 unsigned int instr; 318 unsigned int instr;
319 unsigned int dp_operation; 319 unsigned int dp_operation;
320} vadd_inst; 320};
321#endif 321#endif
322#ifdef VFP_INTERPRETER_TRANS 322#ifdef VFP_INTERPRETER_TRANS
323static ARM_INST_PTR INTERPRETER_TRANSLATE(vadd)(unsigned int inst, int index) 323static ARM_INST_PTR INTERPRETER_TRANSLATE(vadd)(unsigned int inst, int index)
@@ -364,10 +364,10 @@ VADD_INST:
364/* VSUB */ 364/* VSUB */
365/* cond 1110 0D11 Vn-- Vd-- 101X N1M0 Vm-- */ 365/* cond 1110 0D11 Vn-- Vd-- 101X N1M0 Vm-- */
366#ifdef VFP_INTERPRETER_STRUCT 366#ifdef VFP_INTERPRETER_STRUCT
367typedef struct _vsub_inst { 367struct vsub_inst {
368 unsigned int instr; 368 unsigned int instr;
369 unsigned int dp_operation; 369 unsigned int dp_operation;
370} vsub_inst; 370};
371#endif 371#endif
372#ifdef VFP_INTERPRETER_TRANS 372#ifdef VFP_INTERPRETER_TRANS
373static ARM_INST_PTR INTERPRETER_TRANSLATE(vsub)(unsigned int inst, int index) 373static ARM_INST_PTR INTERPRETER_TRANSLATE(vsub)(unsigned int inst, int index)
@@ -414,10 +414,10 @@ VSUB_INST:
414/* VDIV */ 414/* VDIV */
415/* cond 1110 1D00 Vn-- Vd-- 101X N0M0 Vm-- */ 415/* cond 1110 1D00 Vn-- Vd-- 101X N0M0 Vm-- */
416#ifdef VFP_INTERPRETER_STRUCT 416#ifdef VFP_INTERPRETER_STRUCT
417typedef struct _vdiv_inst { 417struct vdiv_inst {
418 unsigned int instr; 418 unsigned int instr;
419 unsigned int dp_operation; 419 unsigned int dp_operation;
420} vdiv_inst; 420};
421#endif 421#endif
422#ifdef VFP_INTERPRETER_TRANS 422#ifdef VFP_INTERPRETER_TRANS
423static ARM_INST_PTR INTERPRETER_TRANSLATE(vdiv)(unsigned int inst, int index) 423static ARM_INST_PTR INTERPRETER_TRANSLATE(vdiv)(unsigned int inst, int index)
@@ -465,11 +465,11 @@ VDIV_INST:
465/* cond 1110 1D11 im4H Vd-- 101X 0000 im4L */ 465/* cond 1110 1D11 im4H Vd-- 101X 0000 im4L */
466/* cond 1110 opc1 CRn- CRd- copr op20 CRm- CDP */ 466/* cond 1110 opc1 CRn- CRd- copr op20 CRm- CDP */
467#ifdef VFP_INTERPRETER_STRUCT 467#ifdef VFP_INTERPRETER_STRUCT
468typedef struct _vmovi_inst { 468struct vmovi_inst {
469 unsigned int single; 469 unsigned int single;
470 unsigned int d; 470 unsigned int d;
471 unsigned int imm; 471 unsigned int imm;
472} vmovi_inst; 472};
473#endif 473#endif
474#ifdef VFP_INTERPRETER_TRANS 474#ifdef VFP_INTERPRETER_TRANS
475static ARM_INST_PTR INTERPRETER_TRANSLATE(vmovi)(unsigned int inst, int index) 475static ARM_INST_PTR INTERPRETER_TRANSLATE(vmovi)(unsigned int inst, int index)
@@ -514,11 +514,11 @@ VMOVI_INST:
514/* cond 1110 1D11 0000 Vd-- 101X 01M0 Vm-- */ 514/* cond 1110 1D11 0000 Vd-- 101X 01M0 Vm-- */
515/* cond 1110 opc1 CRn- CRd- copr op20 CRm- CDP */ 515/* cond 1110 opc1 CRn- CRd- copr op20 CRm- CDP */
516#ifdef VFP_INTERPRETER_STRUCT 516#ifdef VFP_INTERPRETER_STRUCT
517typedef struct _vmovr_inst { 517struct vmovr_inst {
518 unsigned int single; 518 unsigned int single;
519 unsigned int d; 519 unsigned int d;
520 unsigned int m; 520 unsigned int m;
521} vmovr_inst; 521};
522#endif 522#endif
523#ifdef VFP_INTERPRETER_TRANS 523#ifdef VFP_INTERPRETER_TRANS
524static ARM_INST_PTR INTERPRETER_TRANSLATE(vmovr)(unsigned int inst, int index) 524static ARM_INST_PTR INTERPRETER_TRANSLATE(vmovr)(unsigned int inst, int index)
@@ -609,10 +609,10 @@ VABS_INST:
609/* cond 1110 1D11 0001 Vd-- 101X 11M0 Vm-- */ 609/* cond 1110 1D11 0001 Vd-- 101X 11M0 Vm-- */
610 610
611#ifdef VFP_INTERPRETER_STRUCT 611#ifdef VFP_INTERPRETER_STRUCT
612typedef struct _vneg_inst { 612struct vneg_inst {
613 unsigned int instr; 613 unsigned int instr;
614 unsigned int dp_operation; 614 unsigned int dp_operation;
615} vneg_inst; 615};
616#endif 616#endif
617#ifdef VFP_INTERPRETER_TRANS 617#ifdef VFP_INTERPRETER_TRANS
618static ARM_INST_PTR INTERPRETER_TRANSLATE(vneg)(unsigned int inst, int index) 618static ARM_INST_PTR INTERPRETER_TRANSLATE(vneg)(unsigned int inst, int index)
@@ -659,10 +659,10 @@ VNEG_INST:
659/* VSQRT */ 659/* VSQRT */
660/* cond 1110 1D11 0001 Vd-- 101X 11M0 Vm-- */ 660/* cond 1110 1D11 0001 Vd-- 101X 11M0 Vm-- */
661#ifdef VFP_INTERPRETER_STRUCT 661#ifdef VFP_INTERPRETER_STRUCT
662typedef struct _vsqrt_inst { 662struct vsqrt_inst {
663 unsigned int instr; 663 unsigned int instr;
664 unsigned int dp_operation; 664 unsigned int dp_operation;
665} vsqrt_inst; 665};
666#endif 666#endif
667#ifdef VFP_INTERPRETER_TRANS 667#ifdef VFP_INTERPRETER_TRANS
668static ARM_INST_PTR INTERPRETER_TRANSLATE(vsqrt)(unsigned int inst, int index) 668static ARM_INST_PTR INTERPRETER_TRANSLATE(vsqrt)(unsigned int inst, int index)
@@ -709,10 +709,10 @@ VSQRT_INST:
709/* VCMP VCMPE */ 709/* VCMP VCMPE */
710/* cond 1110 1D11 0100 Vd-- 101X E1M0 Vm-- Encoding 1 */ 710/* cond 1110 1D11 0100 Vd-- 101X E1M0 Vm-- Encoding 1 */
711#ifdef VFP_INTERPRETER_STRUCT 711#ifdef VFP_INTERPRETER_STRUCT
712typedef struct _vcmp_inst { 712struct vcmp_inst {
713 unsigned int instr; 713 unsigned int instr;
714 unsigned int dp_operation; 714 unsigned int dp_operation;
715} vcmp_inst; 715};
716#endif 716#endif
717#ifdef VFP_INTERPRETER_TRANS 717#ifdef VFP_INTERPRETER_TRANS
718static ARM_INST_PTR INTERPRETER_TRANSLATE(vcmp)(unsigned int inst, int index) 718static ARM_INST_PTR INTERPRETER_TRANSLATE(vcmp)(unsigned int inst, int index)
@@ -759,10 +759,10 @@ VCMP_INST:
759/* VCMP VCMPE */ 759/* VCMP VCMPE */
760/* cond 1110 1D11 0100 Vd-- 101X E1M0 Vm-- Encoding 2 */ 760/* cond 1110 1D11 0100 Vd-- 101X E1M0 Vm-- Encoding 2 */
761#ifdef VFP_INTERPRETER_STRUCT 761#ifdef VFP_INTERPRETER_STRUCT
762typedef struct _vcmp2_inst { 762struct vcmp2_inst {
763 unsigned int instr; 763 unsigned int instr;
764 unsigned int dp_operation; 764 unsigned int dp_operation;
765} vcmp2_inst; 765};
766#endif 766#endif
767#ifdef VFP_INTERPRETER_TRANS 767#ifdef VFP_INTERPRETER_TRANS
768static ARM_INST_PTR INTERPRETER_TRANSLATE(vcmp2)(unsigned int inst, int index) 768static ARM_INST_PTR INTERPRETER_TRANSLATE(vcmp2)(unsigned int inst, int index)
@@ -809,10 +809,10 @@ VCMP2_INST:
809/* VCVTBDS between double and single */ 809/* VCVTBDS between double and single */
810/* cond 1110 1D11 0111 Vd-- 101X 11M0 Vm-- */ 810/* cond 1110 1D11 0111 Vd-- 101X 11M0 Vm-- */
811#ifdef VFP_INTERPRETER_STRUCT 811#ifdef VFP_INTERPRETER_STRUCT
812typedef struct _vcvtbds_inst { 812struct vcvtbds_inst {
813 unsigned int instr; 813 unsigned int instr;
814 unsigned int dp_operation; 814 unsigned int dp_operation;
815} vcvtbds_inst; 815};
816#endif 816#endif
817#ifdef VFP_INTERPRETER_TRANS 817#ifdef VFP_INTERPRETER_TRANS
818static ARM_INST_PTR INTERPRETER_TRANSLATE(vcvtbds)(unsigned int inst, int index) 818static ARM_INST_PTR INTERPRETER_TRANSLATE(vcvtbds)(unsigned int inst, int index)
@@ -859,10 +859,10 @@ VCVTBDS_INST:
859/* VCVTBFF between floating point and fixed point */ 859/* VCVTBFF between floating point and fixed point */
860/* cond 1110 1D11 1op2 Vd-- 101X X1M0 Vm-- */ 860/* cond 1110 1D11 1op2 Vd-- 101X X1M0 Vm-- */
861#ifdef VFP_INTERPRETER_STRUCT 861#ifdef VFP_INTERPRETER_STRUCT
862typedef struct _vcvtbff_inst { 862struct vcvtbff_inst {
863 unsigned int instr; 863 unsigned int instr;
864 unsigned int dp_operation; 864 unsigned int dp_operation;
865} vcvtbff_inst; 865};
866#endif 866#endif
867#ifdef VFP_INTERPRETER_TRANS 867#ifdef VFP_INTERPRETER_TRANS
868static ARM_INST_PTR INTERPRETER_TRANSLATE(vcvtbff)(unsigned int inst, int index) 868static ARM_INST_PTR INTERPRETER_TRANSLATE(vcvtbff)(unsigned int inst, int index)
@@ -911,10 +911,10 @@ VCVTBFF_INST:
911/* VCVTBFI between floating point and integer */ 911/* VCVTBFI between floating point and integer */
912/* cond 1110 1D11 1op2 Vd-- 101X X1M0 Vm-- */ 912/* cond 1110 1D11 1op2 Vd-- 101X X1M0 Vm-- */
913#ifdef VFP_INTERPRETER_STRUCT 913#ifdef VFP_INTERPRETER_STRUCT
914typedef struct _vcvtbfi_inst { 914struct vcvtbfi_inst {
915 unsigned int instr; 915 unsigned int instr;
916 unsigned int dp_operation; 916 unsigned int dp_operation;
917} vcvtbfi_inst; 917};
918#endif 918#endif
919#ifdef VFP_INTERPRETER_TRANS 919#ifdef VFP_INTERPRETER_TRANS
920static ARM_INST_PTR INTERPRETER_TRANSLATE(vcvtbfi)(unsigned int inst, int index) 920static ARM_INST_PTR INTERPRETER_TRANSLATE(vcvtbfi)(unsigned int inst, int index)
@@ -967,11 +967,11 @@ VCVTBFI_INST:
967/* cond 1110 000o Vn-- Rt-- 1010 N001 0000 */ 967/* cond 1110 000o Vn-- Rt-- 1010 N001 0000 */
968/* cond 1110 op11 CRn- Rt-- copr op21 CRm- MRC */ 968/* cond 1110 op11 CRn- Rt-- copr op21 CRm- MRC */
969#ifdef VFP_INTERPRETER_STRUCT 969#ifdef VFP_INTERPRETER_STRUCT
970typedef struct _vmovbrs_inst { 970struct vmovbrs_inst {
971 unsigned int to_arm; 971 unsigned int to_arm;
972 unsigned int t; 972 unsigned int t;
973 unsigned int n; 973 unsigned int n;
974} vmovbrs_inst; 974};
975#endif 975#endif
976#ifdef VFP_INTERPRETER_TRANS 976#ifdef VFP_INTERPRETER_TRANS
977static ARM_INST_PTR INTERPRETER_TRANSLATE(vmovbrs)(unsigned int inst, int index) 977static ARM_INST_PTR INTERPRETER_TRANSLATE(vmovbrs)(unsigned int inst, int index)
@@ -1013,10 +1013,10 @@ VMOVBRS_INST:
1013/* cond 1110 1110 reg- Rt-- 1010 0001 0000 */ 1013/* cond 1110 1110 reg- Rt-- 1010 0001 0000 */
1014/* cond 1110 op10 CRn- Rt-- copr op21 CRm- MCR */ 1014/* cond 1110 op10 CRn- Rt-- copr op21 CRm- MCR */
1015#ifdef VFP_INTERPRETER_STRUCT 1015#ifdef VFP_INTERPRETER_STRUCT
1016typedef struct _vmsr_inst { 1016struct vmsr_inst {
1017 unsigned int reg; 1017 unsigned int reg;
1018 unsigned int Rd; 1018 unsigned int Rd;
1019} vmsr_inst; 1019};
1020#endif 1020#endif
1021#ifdef VFP_INTERPRETER_TRANS 1021#ifdef VFP_INTERPRETER_TRANS
1022static ARM_INST_PTR INTERPRETER_TRANSLATE(vmsr)(unsigned int inst, int index) 1022static ARM_INST_PTR INTERPRETER_TRANSLATE(vmsr)(unsigned int inst, int index)
@@ -1040,7 +1040,7 @@ VMSR_INST:
1040{ 1040{
1041 if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { 1041 if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
1042 /* FIXME: special case for access to FPSID and FPEXC, VFP must be disabled , 1042 /* FIXME: special case for access to FPSID and FPEXC, VFP must be disabled ,
1043 and in privilegied mode */ 1043 and in privileged mode */
1044 /* Exceptions must be checked, according to v7 ref manual */ 1044 /* Exceptions must be checked, according to v7 ref manual */
1045 CHECK_VFP_ENABLED; 1045 CHECK_VFP_ENABLED;
1046 1046
@@ -1060,12 +1060,12 @@ VMSR_INST:
1060/* cond 1110 0XX0 Vd-- Rt-- 1011 DXX1 0000 */ 1060/* cond 1110 0XX0 Vd-- Rt-- 1011 DXX1 0000 */
1061/* cond 1110 op10 CRn- Rt-- copr op21 CRm- MCR */ 1061/* cond 1110 op10 CRn- Rt-- copr op21 CRm- MCR */
1062#ifdef VFP_INTERPRETER_STRUCT 1062#ifdef VFP_INTERPRETER_STRUCT
1063typedef struct _vmovbrc_inst { 1063struct vmovbrc_inst {
1064 unsigned int esize; 1064 unsigned int esize;
1065 unsigned int index; 1065 unsigned int index;
1066 unsigned int d; 1066 unsigned int d;
1067 unsigned int t; 1067 unsigned int t;
1068} vmovbrc_inst; 1068};
1069#endif 1069#endif
1070#ifdef VFP_INTERPRETER_TRANS 1070#ifdef VFP_INTERPRETER_TRANS
1071static ARM_INST_PTR INTERPRETER_TRANSLATE(vmovbrc)(unsigned int inst, int index) 1071static ARM_INST_PTR INTERPRETER_TRANSLATE(vmovbrc)(unsigned int inst, int index)
@@ -1109,10 +1109,10 @@ VMOVBRC_INST:
1109/* cond 1110 1111 CRn- Rt-- 1010 0001 0000 */ 1109/* cond 1110 1111 CRn- Rt-- 1010 0001 0000 */
1110/* cond 1110 op11 CRn- Rt-- copr op21 CRm- MRC */ 1110/* cond 1110 op11 CRn- Rt-- copr op21 CRm- MRC */
1111#ifdef VFP_INTERPRETER_STRUCT 1111#ifdef VFP_INTERPRETER_STRUCT
1112typedef struct _vmrs_inst { 1112struct vmrs_inst {
1113 unsigned int reg; 1113 unsigned int reg;
1114 unsigned int Rt; 1114 unsigned int Rt;
1115} vmrs_inst; 1115};
1116#endif 1116#endif
1117#ifdef VFP_INTERPRETER_TRANS 1117#ifdef VFP_INTERPRETER_TRANS
1118static ARM_INST_PTR INTERPRETER_TRANSLATE(vmrs)(unsigned int inst, int index) 1118static ARM_INST_PTR INTERPRETER_TRANSLATE(vmrs)(unsigned int inst, int index)
@@ -1136,7 +1136,7 @@ VMRS_INST:
1136{ 1136{
1137 if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { 1137 if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
1138 /* FIXME: special case for access to FPSID and FPEXC, VFP must be disabled, 1138 /* FIXME: special case for access to FPSID and FPEXC, VFP must be disabled,
1139 and in privilegied mode */ 1139 and in privileged mode */
1140 /* Exceptions must be checked, according to v7 ref manual */ 1140 /* Exceptions must be checked, according to v7 ref manual */
1141 CHECK_VFP_ENABLED; 1141 CHECK_VFP_ENABLED;
1142 1142
@@ -1191,12 +1191,12 @@ VMRS_INST:
1191/* cond 1110 XXX1 Vd-- Rt-- 1011 NXX1 0000 */ 1191/* cond 1110 XXX1 Vd-- Rt-- 1011 NXX1 0000 */
1192/* cond 1110 op11 CRn- Rt-- copr op21 CRm- MCR */ 1192/* cond 1110 op11 CRn- Rt-- copr op21 CRm- MCR */
1193#ifdef VFP_INTERPRETER_STRUCT 1193#ifdef VFP_INTERPRETER_STRUCT
1194typedef struct _vmovbcr_inst { 1194struct vmovbcr_inst {
1195 unsigned int esize; 1195 unsigned int esize;
1196 unsigned int index; 1196 unsigned int index;
1197 unsigned int d; 1197 unsigned int d;
1198 unsigned int t; 1198 unsigned int t;
1199} vmovbcr_inst; 1199};
1200#endif 1200#endif
1201#ifdef VFP_INTERPRETER_TRANS 1201#ifdef VFP_INTERPRETER_TRANS
1202static ARM_INST_PTR INTERPRETER_TRANSLATE(vmovbcr)(unsigned int inst, int index) 1202static ARM_INST_PTR INTERPRETER_TRANSLATE(vmovbcr)(unsigned int inst, int index)
@@ -1245,12 +1245,12 @@ VMOVBCR_INST:
1245/* cond 1100 010X Rt2- Rt-- 1010 00X1 Vm-- */ 1245/* cond 1100 010X Rt2- Rt-- 1010 00X1 Vm-- */
1246/* cond 1100 0101 Rt2- Rt-- copr opc1 CRm- MRRC */ 1246/* cond 1100 0101 Rt2- Rt-- copr opc1 CRm- MRRC */
1247#ifdef VFP_INTERPRETER_STRUCT 1247#ifdef VFP_INTERPRETER_STRUCT
1248typedef struct _vmovbrrss_inst { 1248struct vmovbrrss_inst {
1249 unsigned int to_arm; 1249 unsigned int to_arm;
1250 unsigned int t; 1250 unsigned int t;
1251 unsigned int t2; 1251 unsigned int t2;
1252 unsigned int m; 1252 unsigned int m;
1253} vmovbrrss_inst; 1253};
1254#endif 1254#endif
1255#ifdef VFP_INTERPRETER_TRANS 1255#ifdef VFP_INTERPRETER_TRANS
1256static ARM_INST_PTR INTERPRETER_TRANSLATE(vmovbrrss)(unsigned int inst, int index) 1256static ARM_INST_PTR INTERPRETER_TRANSLATE(vmovbrrss)(unsigned int inst, int index)
@@ -1294,12 +1294,12 @@ VMOVBRRSS_INST:
1294/* cond 1100 010X Rt2- Rt-- 1011 00X1 Vm-- */ 1294/* cond 1100 010X Rt2- Rt-- 1011 00X1 Vm-- */
1295/* cond 1100 0101 Rt2- Rt-- copr opc1 CRm- MRRC */ 1295/* cond 1100 0101 Rt2- Rt-- copr opc1 CRm- MRRC */
1296#ifdef VFP_INTERPRETER_STRUCT 1296#ifdef VFP_INTERPRETER_STRUCT
1297typedef struct _vmovbrrd_inst { 1297struct vmovbrrd_inst {
1298 unsigned int to_arm; 1298 unsigned int to_arm;
1299 unsigned int t; 1299 unsigned int t;
1300 unsigned int t2; 1300 unsigned int t2;
1301 unsigned int m; 1301 unsigned int m;
1302} vmovbrrd_inst; 1302};
1303#endif 1303#endif
1304#ifdef VFP_INTERPRETER_TRANS 1304#ifdef VFP_INTERPRETER_TRANS
1305static ARM_INST_PTR INTERPRETER_TRANSLATE(vmovbrrd)(unsigned int inst, int index) 1305static ARM_INST_PTR INTERPRETER_TRANSLATE(vmovbrrd)(unsigned int inst, int index)
@@ -1347,13 +1347,13 @@ VMOVBRRD_INST:
1347/* VSTR */ 1347/* VSTR */
1348/* cond 1101 UD00 Rn-- Vd-- 101X imm8 imm8 */ 1348/* cond 1101 UD00 Rn-- Vd-- 101X imm8 imm8 */
1349#ifdef VFP_INTERPRETER_STRUCT 1349#ifdef VFP_INTERPRETER_STRUCT
1350typedef struct _vstr_inst { 1350struct vstr_inst {
1351 unsigned int single; 1351 unsigned int single;
1352 unsigned int n; 1352 unsigned int n;
1353 unsigned int d; 1353 unsigned int d;
1354 unsigned int imm32; 1354 unsigned int imm32;
1355 unsigned int add; 1355 unsigned int add;
1356} vstr_inst; 1356};
1357#endif 1357#endif
1358#ifdef VFP_INTERPRETER_TRANS 1358#ifdef VFP_INTERPRETER_TRANS
1359static ARM_INST_PTR INTERPRETER_TRANSLATE(vstr)(unsigned int inst, int index) 1359static ARM_INST_PTR INTERPRETER_TRANSLATE(vstr)(unsigned int inst, int index)
@@ -1415,12 +1415,12 @@ VSTR_INST:
1415/* VPUSH */ 1415/* VPUSH */
1416/* cond 1101 0D10 1101 Vd-- 101X imm8 imm8 */ 1416/* cond 1101 0D10 1101 Vd-- 101X imm8 imm8 */
1417#ifdef VFP_INTERPRETER_STRUCT 1417#ifdef VFP_INTERPRETER_STRUCT
1418typedef struct _vpush_inst { 1418struct vpush_inst {
1419 unsigned int single; 1419 unsigned int single;
1420 unsigned int d; 1420 unsigned int d;
1421 unsigned int imm32; 1421 unsigned int imm32;
1422 unsigned int regs; 1422 unsigned int regs;
1423} vpush_inst; 1423};
1424#endif 1424#endif
1425#ifdef VFP_INTERPRETER_TRANS 1425#ifdef VFP_INTERPRETER_TRANS
1426static ARM_INST_PTR INTERPRETER_TRANSLATE(vpush)(unsigned int inst, int index) 1426static ARM_INST_PTR INTERPRETER_TRANSLATE(vpush)(unsigned int inst, int index)
@@ -1488,7 +1488,7 @@ VPUSH_INST:
1488/* VSTM */ 1488/* VSTM */
1489/* cond 110P UDW0 Rn-- Vd-- 101X imm8 imm8 */ 1489/* cond 110P UDW0 Rn-- Vd-- 101X imm8 imm8 */
1490#ifdef VFP_INTERPRETER_STRUCT 1490#ifdef VFP_INTERPRETER_STRUCT
1491typedef struct _vstm_inst { 1491struct vstm_inst {
1492 unsigned int single; 1492 unsigned int single;
1493 unsigned int add; 1493 unsigned int add;
1494 unsigned int wback; 1494 unsigned int wback;
@@ -1496,7 +1496,7 @@ typedef struct _vstm_inst {
1496 unsigned int n; 1496 unsigned int n;
1497 unsigned int imm32; 1497 unsigned int imm32;
1498 unsigned int regs; 1498 unsigned int regs;
1499} vstm_inst; 1499};
1500#endif 1500#endif
1501#ifdef VFP_INTERPRETER_TRANS 1501#ifdef VFP_INTERPRETER_TRANS
1502static ARM_INST_PTR INTERPRETER_TRANSLATE(vstm)(unsigned int inst, int index) 1502static ARM_INST_PTR INTERPRETER_TRANSLATE(vstm)(unsigned int inst, int index)
@@ -1570,12 +1570,12 @@ VSTM_INST: /* encoding 1 */
1570/* VPOP */ 1570/* VPOP */
1571/* cond 1100 1D11 1101 Vd-- 101X imm8 imm8 */ 1571/* cond 1100 1D11 1101 Vd-- 101X imm8 imm8 */
1572#ifdef VFP_INTERPRETER_STRUCT 1572#ifdef VFP_INTERPRETER_STRUCT
1573typedef struct _vpop_inst { 1573struct vpop_inst {
1574 unsigned int single; 1574 unsigned int single;
1575 unsigned int d; 1575 unsigned int d;
1576 unsigned int imm32; 1576 unsigned int imm32;
1577 unsigned int regs; 1577 unsigned int regs;
1578} vpop_inst; 1578};
1579#endif 1579#endif
1580#ifdef VFP_INTERPRETER_TRANS 1580#ifdef VFP_INTERPRETER_TRANS
1581static ARM_INST_PTR INTERPRETER_TRANSLATE(vpop)(unsigned int inst, int index) 1581static ARM_INST_PTR INTERPRETER_TRANSLATE(vpop)(unsigned int inst, int index)
@@ -1643,13 +1643,13 @@ VPOP_INST:
1643/* VLDR */ 1643/* VLDR */
1644/* cond 1101 UD01 Rn-- Vd-- 101X imm8 imm8 */ 1644/* cond 1101 UD01 Rn-- Vd-- 101X imm8 imm8 */
1645#ifdef VFP_INTERPRETER_STRUCT 1645#ifdef VFP_INTERPRETER_STRUCT
1646typedef struct _vldr_inst { 1646struct vldr_inst {
1647 unsigned int single; 1647 unsigned int single;
1648 unsigned int n; 1648 unsigned int n;
1649 unsigned int d; 1649 unsigned int d;
1650 unsigned int imm32; 1650 unsigned int imm32;
1651 unsigned int add; 1651 unsigned int add;
1652} vldr_inst; 1652};
1653#endif 1653#endif
1654#ifdef VFP_INTERPRETER_TRANS 1654#ifdef VFP_INTERPRETER_TRANS
1655static ARM_INST_PTR INTERPRETER_TRANSLATE(vldr)(unsigned int inst, int index) 1655static ARM_INST_PTR INTERPRETER_TRANSLATE(vldr)(unsigned int inst, int index)
@@ -1711,7 +1711,7 @@ VLDR_INST:
1711/* VLDM */ 1711/* VLDM */
1712/* cond 110P UDW1 Rn-- Vd-- 101X imm8 imm8 */ 1712/* cond 110P UDW1 Rn-- Vd-- 101X imm8 imm8 */
1713#ifdef VFP_INTERPRETER_STRUCT 1713#ifdef VFP_INTERPRETER_STRUCT
1714typedef struct _vldm_inst { 1714struct vldm_inst {
1715 unsigned int single; 1715 unsigned int single;
1716 unsigned int add; 1716 unsigned int add;
1717 unsigned int wback; 1717 unsigned int wback;
@@ -1719,7 +1719,7 @@ typedef struct _vldm_inst {
1719 unsigned int n; 1719 unsigned int n;
1720 unsigned int imm32; 1720 unsigned int imm32;
1721 unsigned int regs; 1721 unsigned int regs;
1722} vldm_inst; 1722};
1723#endif 1723#endif
1724#ifdef VFP_INTERPRETER_TRANS 1724#ifdef VFP_INTERPRETER_TRANS
1725static ARM_INST_PTR INTERPRETER_TRANSLATE(vldm)(unsigned int inst, int index) 1725static ARM_INST_PTR INTERPRETER_TRANSLATE(vldm)(unsigned int inst, int index)