- Timestamp:
- Sep 30, 2024 3:24:34 PM (2 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllInstPython.py
r106180 r106181 2925 2925 return None; 2926 2926 2927 koReRefEflIllegalMemRough = re.compile(r'^IEM_MC_.*(MEM|PUSH_U|POP_GREG|RETN|IND_CALL|REL_CALL)'); 2928 koReRefEflIllegalMemExclude = re.compile(r'^IEM_MC_.*(MEM_COMMIT|MEM_OP|FPU_|UPDATE_FSW)'); 2929 koReRefEflIllegalRaise = re.compile(r'^IEM_MC_(RAISE|MAYBE_RAISE)'); 2930 2931 def checkRefEFlagsUse(self, aoStmts, asState): 2932 """ 2933 Checks that EFLAGS references comes after memory fetches and that there 2934 are no memory stores or conditional raises afterwards. 2935 2936 The problem is postponed EFLAGS calculation management. This gets a 2937 lot easier if we can jettison any postponements when EFLAGS are 2938 referenced. If we had to deal with potential TB exits / exceptions 2939 after they are referenced, this means it would have to delay the 2940 cleanup until the IEM_MC_..._AND_FINISH statement which is kind of 2941 complicated and not very efficient. 2942 """ 2943 fSeenIt = asState.get('fSeenIt', False); 2944 for iStmt, oStmt in enumerate(aoStmts): 2945 if not oStmt.isCppStmt(): 2946 if oStmt.sName in ('IEM_MC_REF_EFLAGS', 'IEM_MC_REF_EFLAGS_EX',): 2947 fSeenIt = True; 2948 elif ( fSeenIt 2949 and ( ( self.koReRefEflIllegalMemRough.match(oStmt.sName) 2950 and not self.koReRefEflIllegalMemExclude.match(oStmt.sName)) 2951 or self.koReRefEflIllegalRaise.match(oStmt.sName) )): 2952 return "statement #%u: %s following REF_EFLAGS! That'll mess up EFLAGS calculation postponing" \ 2953 % (iStmt + 1, oStmt.sName,); 2954 2955 # Go into branches. 2956 if isinstance(oStmt, McStmtCond): 2957 asState['fSeenIt'] = fSeenIt; 2958 sRet = self.checkRefEFlagsUse(oStmt.aoIfBranch, asState); 2959 if sRet: 2960 return sRet; 2961 sRet = self.checkRefEFlagsUse(oStmt.aoElseBranch, asState); 2962 if sRet: 2963 return sRet; 2964 fSeenIt = asState['fSeenIt']; 2965 return None; 2966 2927 2967 def check(self): 2928 2968 """ … … 2945 2985 asRet.append(sRet); 2946 2986 2947 ## @todo Check that IEM_MC_REF_EFLAGS isn't used before memory fetches and does 2948 # not have any stores or conditional raises afterwards. 2987 sRet = self.checkRefEFlagsUse(aoStmts, {}); 2988 if sRet: 2989 asRet.append(sRet); 2949 2990 2950 2991 return asRet;
Note:
See TracChangeset
for help on using the changeset viewer.