Changeset 97183 in vbox for trunk/include/VBox
- Timestamp:
- Oct 17, 2022 10:27:05 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/cpum.h
r97182 r97183 1939 1939 1940 1940 /** 1941 * Checks if we're in an "interrupt shadow", i.e. after a STI, POP For MOV SS,1941 * Checks if we're in an "interrupt shadow", i.e. after a STI, POP SS or MOV SS, 1942 1942 * updating the state if stale. 1943 1943 * 1944 1944 * This also inhibit NMIs, except perhaps for nested guests. 1945 1945 * 1946 * @returns true if interrupts are inhibited by interrupt shadow, false if not. 1946 * @retval true if interrupts are inhibited by interrupt shadow. 1947 * @retval false if not. 1947 1948 * @param pCtx Current guest CPU context. 1948 1949 * @note Requires pCtx->rip to be up to date. … … 1962 1963 1963 1964 /** 1964 * Sets the "interrupt shadow" flag, after a STI, POPF or MOV SS instruction. 1965 * Checks if we're in an "interrupt shadow" due to a POP SS or MOV SS 1966 * instruction. 1967 * 1968 * This also inhibit NMIs, except perhaps for nested guests. 1969 * 1970 * @retval true if interrupts are inhibited due to POP/MOV SS. 1971 * @retval false if not. 1972 * @param pCtx Current guest CPU context. 1973 * @note Requires pCtx->rip to be up to date. 1974 * @note Does not clear fInhibit when CPUMCTX::uRipInhibitInt differs 1975 * from CPUMCTX::rip. 1976 * @note Both CPUMIsInInterruptShadowAfterSti() and this function may return 1977 * true depending on the execution engine being used. 1978 */ 1979 DECLINLINE(bool) CPUMIsInInterruptShadowAfterSs(PCCPUMCTX pCtx) 1980 { 1981 if (!(pCtx->fInhibit & CPUMCTX_INHIBIT_SHADOW_SS)) 1982 return false; 1983 1984 CPUMCTX_ASSERT_NOT_EXTRN(pCtx, CPUMCTX_EXTRN_RIP); 1985 return pCtx->uRipInhibitInt == pCtx->rip; 1986 } 1987 1988 /** 1989 * Checks if we're in an "interrupt shadow" due to an STI instruction. 1990 * 1991 * This also inhibit NMIs, except perhaps for nested guests. 1992 * 1993 * @retval true if interrupts are inhibited due to STI. 1994 * @retval false if not. 1995 * @param pCtx Current guest CPU context. 1996 * @note Requires pCtx->rip to be up to date. 1997 * @note Does not clear fInhibit when CPUMCTX::uRipInhibitInt differs 1998 * from CPUMCTX::rip. 1999 * @note Both CPUMIsInInterruptShadowAfterSs() and this function may return 2000 * true depending on the execution engine being used. 2001 */ 2002 DECLINLINE(bool) CPUMIsInInterruptShadowAfterSti(PCCPUMCTX pCtx) 2003 { 2004 if (!(pCtx->fInhibit & CPUMCTX_INHIBIT_SHADOW_STI)) 2005 return false; 2006 2007 CPUMCTX_ASSERT_NOT_EXTRN(pCtx, CPUMCTX_EXTRN_RIP); 2008 return pCtx->uRipInhibitInt == pCtx->rip; 2009 } 2010 2011 /** 2012 * Sets the "interrupt shadow" flag, after a STI, POP SS or MOV SS instruction. 1965 2013 * 1966 2014 * @param pCtx Current guest CPU context. … … 1975 2023 1976 2024 /** 1977 * Sets the "interrupt shadow" flag, after a STI, POP For MOV SS instruction,2025 * Sets the "interrupt shadow" flag, after a STI, POP SS or MOV SS instruction, 1978 2026 * extended version. 1979 2027 * … … 1985 2033 pCtx->fInhibit |= CPUMCTX_INHIBIT_SHADOW; 1986 2034 pCtx->uRipInhibitInt = rip; 2035 } 2036 2037 /** 2038 * Sets the "interrupt shadow" flag after a POP SS or MOV SS instruction. 2039 * 2040 * @param pCtx Current guest CPU context. 2041 * @note Requires pCtx->rip to be up to date. 2042 */ 2043 DECLINLINE(void) CPUMSetInInterruptShadowSs(PCPUMCTX pCtx) 2044 { 2045 CPUMCTX_ASSERT_NOT_EXTRN(pCtx, CPUMCTX_EXTRN_RIP); 2046 pCtx->fInhibit |= CPUMCTX_INHIBIT_SHADOW_SS; 2047 pCtx->uRipInhibitInt = pCtx->rip; 2048 } 2049 2050 /** 2051 * Sets the "interrupt shadow" flag after an STI instruction. 2052 * 2053 * @param pCtx Current guest CPU context. 2054 * @note Requires pCtx->rip to be up to date. 2055 */ 2056 DECLINLINE(void) CPUMSetInInterruptShadowSti(PCPUMCTX pCtx) 2057 { 2058 CPUMCTX_ASSERT_NOT_EXTRN(pCtx, CPUMCTX_EXTRN_RIP); 2059 pCtx->fInhibit |= CPUMCTX_INHIBIT_SHADOW_STI; 2060 pCtx->uRipInhibitInt = pCtx->rip; 1987 2061 } 1988 2062 … … 2034 2108 } 2035 2109 return fInhibited; 2110 } 2111 2112 /** 2113 * Update the two "interrupt shadow" flags separately, extended version. 2114 * 2115 * @param pCtx Current guest CPU context. 2116 * @param fInhibitedBySs The new state for the MOV SS & POP SS aspect. 2117 * @param fInhibitedBySti The new state for the STI aspect. 2118 * @param rip The RIP for which it is inhibited. 2119 */ 2120 DECLINLINE(void) CPUMUpdateInterruptShadowSsStiEx(PCPUMCTX pCtx, bool fInhibitedBySs, bool fInhibitedBySti, uint64_t rip) 2121 { 2122 if (!(fInhibitedBySs | fInhibitedBySti)) 2123 pCtx->fInhibit &= (uint8_t)~CPUMCTX_INHIBIT_SHADOW; 2124 else 2125 { 2126 pCtx->fInhibit |= (fInhibitedBySs ? CPUMCTX_INHIBIT_SHADOW_SS : 0) 2127 | (fInhibitedBySti ? CPUMCTX_INHIBIT_SHADOW_STI : 0); 2128 pCtx->uRipInhibitInt = rip; 2129 } 2036 2130 } 2037 2131
Note:
See TracChangeset
for help on using the changeset viewer.