- Timestamp:
- Feb 21, 2022 12:02:48 PM (3 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllAImplC.cpp
r93864 r93866 37 37 # define IEM_WITHOUT_ASSEMBLY 38 38 # endif 39 #endif 40 /* IEM_WITH_ASSEMBLY trumps IEM_WITHOUT_ASSEMBLY for tstIEMAImplAsm purposes. */ 41 #ifdef IEM_WITH_ASSEMBLY 42 # undef IEM_WITHOUT_ASSEMBLY 39 43 #endif 40 44 … … 912 916 IEM_DECL_IMPL_DEF(void, iemAImpl_bt_u64,(uint64_t *puDst, uint64_t uSrc, uint32_t *pfEFlags)) 913 917 { 914 /* Note! "undefined" flags: OF, SF, ZF, AF, PF. We set them as after an915 logical operation (AND/OR/whatever). */918 /* Note! "undefined" flags: OF, SF, ZF, AF, PF. However, it seems they're 919 not modified by either AMD (3990x) or Intel (i9-9980HK). */ 916 920 Assert(uSrc < 64); 917 921 uint64_t uDst = *puDst; 918 922 if (uDst & RT_BIT_64(uSrc)) 919 IEM_EFL_UPDATE_STATUS_BITS_FOR_LOGIC(pfEFlags, uDst, 64, X86_EFL_CF);923 *pfEFlags |= X86_EFL_CF; 920 924 else 921 IEM_EFL_UPDATE_STATUS_BITS_FOR_LOGIC(pfEFlags, uDst, 64, 0);925 *pfEFlags &= ~X86_EFL_CF; 922 926 } 923 927 … … 926 930 IEM_DECL_IMPL_DEF(void, iemAImpl_bt_u32,(uint32_t *puDst, uint32_t uSrc, uint32_t *pfEFlags)) 927 931 { 928 /* Note! "undefined" flags: OF, SF, ZF, AF, PF. We set them as after an929 logical operation (AND/OR/whatever). */932 /* Note! "undefined" flags: OF, SF, ZF, AF, PF. However, it seems they're 933 not modified by either AMD (3990x) or Intel (i9-9980HK). */ 930 934 Assert(uSrc < 32); 931 935 uint32_t uDst = *puDst; 932 936 if (uDst & RT_BIT_32(uSrc)) 933 IEM_EFL_UPDATE_STATUS_BITS_FOR_LOGIC(pfEFlags, uDst, 32, X86_EFL_CF);937 *pfEFlags |= X86_EFL_CF; 934 938 else 935 IEM_EFL_UPDATE_STATUS_BITS_FOR_LOGIC(pfEFlags, uDst, 32, 0);939 *pfEFlags &= ~X86_EFL_CF; 936 940 } 937 941 938 942 IEM_DECL_IMPL_DEF(void, iemAImpl_bt_u16,(uint16_t *puDst, uint16_t uSrc, uint32_t *pfEFlags)) 939 943 { 940 /* Note! "undefined" flags: OF, SF, ZF, AF, PF. We set them as after an941 logical operation (AND/OR/whatever). */944 /* Note! "undefined" flags: OF, SF, ZF, AF, PF. However, it seems they're 945 not modified by either AMD (3990x) or Intel (i9-9980HK). */ 942 946 Assert(uSrc < 16); 943 947 uint16_t uDst = *puDst; 944 948 if (uDst & RT_BIT_32(uSrc)) 945 IEM_EFL_UPDATE_STATUS_BITS_FOR_LOGIC(pfEFlags, uDst, 16, X86_EFL_CF);949 *pfEFlags |= X86_EFL_CF; 946 950 else 947 IEM_EFL_UPDATE_STATUS_BITS_FOR_LOGIC(pfEFlags, uDst, 16, 0);951 *pfEFlags &= ~X86_EFL_CF; 948 952 } 949 953 … … 955 959 956 960 IEM_DECL_IMPL_DEF(void, iemAImpl_btc_u64,(uint64_t *puDst, uint64_t uSrc, uint32_t *pfEFlags)) 961 { 962 /* Note! "undefined" flags: OF, SF, ZF, AF, PF. However, it seems they're 963 not modified by either AMD (3990x) or Intel (i9-9980HK). */ 964 Assert(uSrc < 64); 965 uint64_t fMask = RT_BIT_64(uSrc); 966 uint64_t uDst = *puDst; 967 if (uDst & fMask) 968 { 969 uDst &= ~fMask; 970 *puDst = uDst; 971 *pfEFlags |= X86_EFL_CF; 972 } 973 else 974 { 975 uDst |= fMask; 976 *puDst = uDst; 977 *pfEFlags &= ~X86_EFL_CF; 978 } 979 } 980 981 # if !defined(RT_ARCH_X86) || defined(IEM_WITHOUT_ASSEMBLY) 982 983 IEM_DECL_IMPL_DEF(void, iemAImpl_btc_u32,(uint32_t *puDst, uint32_t uSrc, uint32_t *pfEFlags)) 984 { 985 /* Note! "undefined" flags: OF, SF, ZF, AF, PF. However, it seems they're 986 not modified by either AMD (3990x) or Intel (i9-9980HK). */ 987 Assert(uSrc < 32); 988 uint32_t fMask = RT_BIT_32(uSrc); 989 uint32_t uDst = *puDst; 990 if (uDst & fMask) 991 { 992 uDst &= ~fMask; 993 *puDst = uDst; 994 *pfEFlags |= X86_EFL_CF; 995 } 996 else 997 { 998 uDst |= fMask; 999 *puDst = uDst; 1000 *pfEFlags &= ~X86_EFL_CF; 1001 } 1002 } 1003 1004 1005 IEM_DECL_IMPL_DEF(void, iemAImpl_btc_u16,(uint16_t *puDst, uint16_t uSrc, uint32_t *pfEFlags)) 1006 { 1007 /* Note! "undefined" flags: OF, SF, ZF, AF, PF. However, it seems they're 1008 not modified by either AMD (3990x) or Intel (i9-9980HK). */ 1009 Assert(uSrc < 16); 1010 uint16_t fMask = RT_BIT_32(uSrc); 1011 uint16_t uDst = *puDst; 1012 if (uDst & fMask) 1013 { 1014 uDst &= ~fMask; 1015 *puDst = uDst; 1016 *pfEFlags |= X86_EFL_CF; 1017 } 1018 else 1019 { 1020 uDst |= fMask; 1021 *puDst = uDst; 1022 *pfEFlags &= ~X86_EFL_CF; 1023 } 1024 } 1025 1026 # endif /* !defined(RT_ARCH_X86) || defined(IEM_WITHOUT_ASSEMBLY) */ 1027 1028 /* 1029 * BTR 1030 */ 1031 1032 IEM_DECL_IMPL_DEF(void, iemAImpl_btr_u64,(uint64_t *puDst, uint64_t uSrc, uint32_t *pfEFlags)) 957 1033 { 958 1034 /* Note! "undefined" flags: OF, SF, ZF, AF, PF. We set them as after an … … 965 1041 uDst &= ~fMask; 966 1042 *puDst = uDst; 967 IEM_EFL_UPDATE_STATUS_BITS_FOR_LOGIC(pfEFlags, uDst, 64, X86_EFL_CF);1043 *pfEFlags |= X86_EFL_CF; 968 1044 } 969 1045 else 970 { 971 uDst |= fMask; 972 *puDst = uDst; 973 IEM_EFL_UPDATE_STATUS_BITS_FOR_LOGIC(pfEFlags, uDst, 64, 0); 974 } 975 } 976 977 # if !defined(RT_ARCH_X86) || defined(IEM_WITHOUT_ASSEMBLY) 978 979 IEM_DECL_IMPL_DEF(void, iemAImpl_btc_u32,(uint32_t *puDst, uint32_t uSrc, uint32_t *pfEFlags)) 1046 *pfEFlags &= ~X86_EFL_CF; 1047 } 1048 1049 # if !defined(RT_ARCH_X86) || defined(IEM_WITHOUT_ASSEMBLY) 1050 1051 IEM_DECL_IMPL_DEF(void, iemAImpl_btr_u32,(uint32_t *puDst, uint32_t uSrc, uint32_t *pfEFlags)) 980 1052 { 981 1053 /* Note! "undefined" flags: OF, SF, ZF, AF, PF. We set them as after an … … 988 1060 uDst &= ~fMask; 989 1061 *puDst = uDst; 990 IEM_EFL_UPDATE_STATUS_BITS_FOR_LOGIC(pfEFlags, uDst, 32, X86_EFL_CF);1062 *pfEFlags |= X86_EFL_CF; 991 1063 } 992 1064 else 993 { 994 uDst |= fMask; 995 *puDst = uDst; 996 IEM_EFL_UPDATE_STATUS_BITS_FOR_LOGIC(pfEFlags, uDst, 32, 0); 997 } 998 } 999 1000 1001 IEM_DECL_IMPL_DEF(void, iemAImpl_btc_u16,(uint16_t *puDst, uint16_t uSrc, uint32_t *pfEFlags)) 1065 *pfEFlags &= ~X86_EFL_CF; 1066 } 1067 1068 1069 IEM_DECL_IMPL_DEF(void, iemAImpl_btr_u16,(uint16_t *puDst, uint16_t uSrc, uint32_t *pfEFlags)) 1002 1070 { 1003 1071 /* Note! "undefined" flags: OF, SF, ZF, AF, PF. We set them as after an … … 1010 1078 uDst &= ~fMask; 1011 1079 *puDst = uDst; 1012 IEM_EFL_UPDATE_STATUS_BITS_FOR_LOGIC(pfEFlags, uDst, 16, X86_EFL_CF);1080 *pfEFlags |= X86_EFL_CF; 1013 1081 } 1014 1082 else 1015 { 1016 uDst |= fMask; 1017 *puDst = uDst; 1018 IEM_EFL_UPDATE_STATUS_BITS_FOR_LOGIC(pfEFlags, uDst, 16, 0); 1019 } 1083 *pfEFlags &= ~X86_EFL_CF; 1020 1084 } 1021 1085 … … 1023 1087 1024 1088 /* 1025 * BT R1026 */ 1027 1028 IEM_DECL_IMPL_DEF(void, iemAImpl_bt r_u64,(uint64_t *puDst, uint64_t uSrc, uint32_t *pfEFlags))1089 * BTS 1090 */ 1091 1092 IEM_DECL_IMPL_DEF(void, iemAImpl_bts_u64,(uint64_t *puDst, uint64_t uSrc, uint32_t *pfEFlags)) 1029 1093 { 1030 1094 /* Note! "undefined" flags: OF, SF, ZF, AF, PF. We set them as after an … … 1034 1098 uint64_t uDst = *puDst; 1035 1099 if (uDst & fMask) 1036 { 1037 uDst &= ~fMask; 1100 *pfEFlags |= X86_EFL_CF; 1101 else 1102 { 1103 uDst |= fMask; 1038 1104 *puDst = uDst; 1039 IEM_EFL_UPDATE_STATUS_BITS_FOR_LOGIC(pfEFlags, uDst, 64, X86_EFL_CF); 1040 } 1041 else 1042 IEM_EFL_UPDATE_STATUS_BITS_FOR_LOGIC(pfEFlags, uDst, 64, 0); 1043 } 1044 1045 # if !defined(RT_ARCH_X86) || defined(IEM_WITHOUT_ASSEMBLY) 1046 1047 IEM_DECL_IMPL_DEF(void, iemAImpl_btr_u32,(uint32_t *puDst, uint32_t uSrc, uint32_t *pfEFlags)) 1105 *pfEFlags &= ~X86_EFL_CF; 1106 } 1107 } 1108 1109 # if !defined(RT_ARCH_X86) || defined(IEM_WITHOUT_ASSEMBLY) 1110 1111 IEM_DECL_IMPL_DEF(void, iemAImpl_bts_u32,(uint32_t *puDst, uint32_t uSrc, uint32_t *pfEFlags)) 1048 1112 { 1049 1113 /* Note! "undefined" flags: OF, SF, ZF, AF, PF. We set them as after an … … 1053 1117 uint32_t uDst = *puDst; 1054 1118 if (uDst & fMask) 1055 { 1056 uDst &= ~fMask; 1057 *puDst = uDst; 1058 IEM_EFL_UPDATE_STATUS_BITS_FOR_LOGIC(pfEFlags, uDst, 32, X86_EFL_CF); 1059 } 1060 else 1061 IEM_EFL_UPDATE_STATUS_BITS_FOR_LOGIC(pfEFlags, uDst, 32, 0); 1062 } 1063 1064 1065 IEM_DECL_IMPL_DEF(void, iemAImpl_btr_u16,(uint16_t *puDst, uint16_t uSrc, uint32_t *pfEFlags)) 1066 { 1067 /* Note! "undefined" flags: OF, SF, ZF, AF, PF. We set them as after an 1068 logical operation (AND/OR/whatever). */ 1069 Assert(uSrc < 16); 1070 uint16_t fMask = RT_BIT_32(uSrc); 1071 uint16_t uDst = *puDst; 1072 if (uDst & fMask) 1073 { 1074 uDst &= ~fMask; 1075 *puDst = uDst; 1076 IEM_EFL_UPDATE_STATUS_BITS_FOR_LOGIC(pfEFlags, uDst, 16, X86_EFL_CF); 1077 } 1078 else 1079 IEM_EFL_UPDATE_STATUS_BITS_FOR_LOGIC(pfEFlags, uDst, 16, 0); 1080 } 1081 1082 # endif /* !defined(RT_ARCH_X86) || defined(IEM_WITHOUT_ASSEMBLY) */ 1083 1084 /* 1085 * BTS 1086 */ 1087 1088 IEM_DECL_IMPL_DEF(void, iemAImpl_bts_u64,(uint64_t *puDst, uint64_t uSrc, uint32_t *pfEFlags)) 1089 { 1090 /* Note! "undefined" flags: OF, SF, ZF, AF, PF. We set them as after an 1091 logical operation (AND/OR/whatever). */ 1092 Assert(uSrc < 64); 1093 uint64_t fMask = RT_BIT_64(uSrc); 1094 uint64_t uDst = *puDst; 1095 if (uDst & fMask) 1096 IEM_EFL_UPDATE_STATUS_BITS_FOR_LOGIC(pfEFlags, uDst, 64, X86_EFL_CF); 1119 *pfEFlags |= X86_EFL_CF; 1097 1120 else 1098 1121 { 1099 1122 uDst |= fMask; 1100 1123 *puDst = uDst; 1101 IEM_EFL_UPDATE_STATUS_BITS_FOR_LOGIC(pfEFlags, uDst, 64, 0); 1102 } 1103 } 1104 1105 # if !defined(RT_ARCH_X86) || defined(IEM_WITHOUT_ASSEMBLY) 1106 1107 IEM_DECL_IMPL_DEF(void, iemAImpl_bts_u32,(uint32_t *puDst, uint32_t uSrc, uint32_t *pfEFlags)) 1108 { 1109 /* Note! "undefined" flags: OF, SF, ZF, AF, PF. We set them as after an 1110 logical operation (AND/OR/whatever). */ 1111 Assert(uSrc < 32); 1112 uint32_t fMask = RT_BIT_32(uSrc); 1113 uint32_t uDst = *puDst; 1114 if (uDst & fMask) 1115 IEM_EFL_UPDATE_STATUS_BITS_FOR_LOGIC(pfEFlags, uDst, 32, X86_EFL_CF); 1116 else 1117 { 1118 uDst |= fMask; 1119 *puDst = uDst; 1120 IEM_EFL_UPDATE_STATUS_BITS_FOR_LOGIC(pfEFlags, uDst, 32, 0); 1124 *pfEFlags &= ~X86_EFL_CF; 1121 1125 } 1122 1126 } … … 1131 1135 uint32_t uDst = *puDst; 1132 1136 if (uDst & fMask) 1133 IEM_EFL_UPDATE_STATUS_BITS_FOR_LOGIC(pfEFlags, uDst, 32, X86_EFL_CF);1137 *pfEFlags |= X86_EFL_CF; 1134 1138 else 1135 1139 { 1136 1140 uDst |= fMask; 1137 1141 *puDst = uDst; 1138 IEM_EFL_UPDATE_STATUS_BITS_FOR_LOGIC(pfEFlags, uDst, 32, 0);1142 *pfEFlags &= ~X86_EFL_CF; 1139 1143 } 1140 1144 } … … 1164 1168 { 1165 1169 /* Note! "undefined" flags: OF, SF, AF, PF, CF. */ 1166 /* * @todo check what real CPUs do. */1170 /* Intel & AMD differs here. This is is the AMD behaviour. */ 1167 1171 unsigned iBit = ASMBitFirstSetU64(uSrc); 1168 1172 if (iBit) … … 1180 1184 { 1181 1185 /* Note! "undefined" flags: OF, SF, AF, PF, CF. */ 1182 /* * @todo check what real CPUs do. */1186 /* Intel & AMD differs here. This is is the AMD behaviour. */ 1183 1187 unsigned iBit = ASMBitFirstSetU32(uSrc); 1184 1188 if (iBit) … … 1195 1199 { 1196 1200 /* Note! "undefined" flags: OF, SF, AF, PF, CF. */ 1197 /* * @todo check what real CPUs do. */1201 /* Intel & AMD differs here. This is is the AMD behaviour. */ 1198 1202 unsigned iBit = ASMBitFirstSetU16(uSrc); 1199 1203 if (iBit) … … 1215 1219 { 1216 1220 /* Note! "undefined" flags: OF, SF, AF, PF, CF. */ 1217 /* * @todo check what real CPUs do. */1221 /* Intel & AMD differs here. This is is the AMD behaviour. */ 1218 1222 unsigned iBit = ASMBitLastSetU64(uSrc); 1219 1223 if (uSrc) … … 1231 1235 { 1232 1236 /* Note! "undefined" flags: OF, SF, AF, PF, CF. */ 1233 /* * @todo check what real CPUs do. */1237 /* Intel & AMD differs here. This is is the AMD behaviour. */ 1234 1238 unsigned iBit = ASMBitLastSetU32(uSrc); 1235 1239 if (uSrc) … … 1246 1250 { 1247 1251 /* Note! "undefined" flags: OF, SF, AF, PF, CF. */ 1248 /* * @todo check what real CPUs do. */1252 /* Intel & AMD differs here. This is is the AMD behaviour. */ 1249 1253 unsigned iBit = ASMBitLastSetU16(uSrc); 1250 1254 if (uSrc) -
trunk/src/VBox/VMM/testcase/Makefile.kmk
r93862 r93866 252 252 # This variant mainly for generating data. 253 253 tstIEMAImplAsm_TEMPLATE = VBOXR3TSTEXE 254 tstIEMAImplAsm_DEFS = $(VMM_COMMON_DEFS) I N_TSTVMSTRUCT254 tstIEMAImplAsm_DEFS = $(VMM_COMMON_DEFS) IEM_WITH_ASSEMBLY IN_TSTVMSTRUCT 255 255 tstIEMAImplAsm_INCS = ../include 256 256 tstIEMAImplAsm_SOURCES = \ 257 257 tstIEMAImpl.cpp \ 258 ../VMMAll/IEMAllAImpl.asm 258 ../VMMAll/IEMAllAImpl.asm \ 259 ../VMMAll/IEMAllAImplC.cpp 259 260 260 261 #
Note:
See TracChangeset
for help on using the changeset viewer.