Changeset 15320 in vbox for trunk/src/recompiler_new
- Timestamp:
- Dec 11, 2008 5:30:31 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 40747
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/recompiler_new/VBoxREMWrapper.cpp
r15305 r15320 179 179 # define USE_REM_IMPORT_JUMP_GLUE 180 180 #endif 181 181 182 182 183 /******************************************************************************* … … 1941 1942 # endif 1942 1943 } 1943 #endif 1944 1944 1945 #endif /* USE_REM_STUBS */ 1945 1946 #ifdef VBOX_USE_BITNESS_SELECTOR 1946 static bool isRem64Needed(PVM pVM) 1947 { 1948 PCFGMNODE pRoot = CFGMR3GetRoot(pVM); 1949 uint64_t u64Value = 0; 1950 1951 CFGMR3QueryIntegerDef(pRoot, "Rem64Enabled", &u64Value, 0); 1952 1953 return u64Value == 1; 1954 } 1947 1948 /** 1949 * Checks if 64-bit support is enabled. 1950 * 1951 * @returns true / false. 1952 * @param pVM Pointer to the shared VM structure. 1953 */ 1954 static bool remIs64bitEnabled(PVM pVM) 1955 { 1956 bool f; 1957 int rc = CFGMR3QueryBoolDef(CFGMR3GetRoot(pVM), "Rem64Enabled", &f, false); 1958 AssertRCReturn(rc, false); 1959 return f; 1960 } 1961 1955 1962 1956 1963 /** … … 1961 1968 static int remLoadProperObj(PVM pVM) 1962 1969 { 1963 size_t offFilename;1964 char szPath[RTPATH_MAX];1965 int rc = RTPathAppPrivateArch(szPath, sizeof(szPath) - 32);1966 AssertRCReturn(rc, rc);1967 offFilename = strlen(szPath);1968 1969 1970 /* 1970 1971 * Load the VBoxREM32/64 object/DLL. 1971 1972 */ 1972 strcpy(&szPath[offFilename], isRem64Needed(pVM) ? "/VBoxREM64" : "/VBoxREM32"); 1973 rc = RTLdrLoad(szPath, &g_ModREM2); 1973 int rc = SUPR3HardenedLdrLoadAppPriv(remIs64bitEnabled(pVM) ? "VBoxREM64" : "VBoxREM32", &g_ModREM2); 1974 1974 if (RT_SUCCESS(rc)) 1975 1975 { 1976 if (RT_SUCCESS(rc)) 1976 /* 1977 * Resolve exports. 1978 */ 1979 unsigned i; 1980 for (i = 0; i < RT_ELEMENTS(g_aExports); i++) 1977 1981 { 1978 /* 1979 * Resolve exports. 1980 */ 1981 unsigned i; 1982 for (i = 0; i < RT_ELEMENTS(g_aExports); i++) 1983 { 1984 void* Value; 1985 rc = RTLdrGetSymbol(g_ModREM2, g_aExports[i].pszName, &Value); 1986 AssertMsgRC(rc, ("%s rc=%Rrc\n", g_aExports[i].pszName, rc)); 1987 if (RT_FAILURE(rc)) 1988 break; 1989 *(void **)g_aExports[i].pv = Value; 1990 } 1982 void *pvValue; 1983 rc = RTLdrGetSymbol(g_ModREM2, g_aExports[i].pszName, &pvValue); 1984 AssertLogRelMsgRCBreak(rc, ("%s rc=%Rrc\n", g_aExports[i].pszName, rc)); 1985 *(void **)g_aExports[i].pv = pvValue; 1991 1986 } 1992 1987 } 1993 1988 1994 1989 return rc; 1995 1990 } 1991 1996 1992 1997 1993 /** … … 2000 1996 static void remUnloadProperObj(void) 2001 1997 { 2002 unsigned i;2003 2004 1998 /* close module. */ 2005 1999 RTLdrClose(g_ModREM2); 2006 2000 g_ModREM2 = NIL_RTLDRMOD; 2007 2001 } 2008 #endif 2009 2002 2003 #endif /* VBOX_USE_BITNESS_SELECTOR */ 2010 2004 2011 2005 REMR3DECL(int) REMR3Init(PVM pVM) … … 2013 2007 #ifdef USE_REM_STUBS 2014 2008 return VINF_SUCCESS; 2015 #elif VBOX_USE_BITNESS_SELECTOR 2009 2010 #elif defined(VBOX_USE_BITNESS_SELECTOR) 2016 2011 if (!pfnREMR3Init) 2017 2012 { … … 2021 2016 } 2022 2017 return pfnREMR3Init(pVM); 2018 2023 2019 #else 2024 2020 if (!pfnREMR3Init) … … 2036 2032 #ifdef USE_REM_STUBS 2037 2033 return VINF_SUCCESS; 2038 #elif VBOX_USE_BITNESS_SELECTOR 2034 2035 #elif defined(VBOX_USE_BITNESS_SELECTOR) 2039 2036 int rc; 2040 2037 Assert(VALID_PTR(pfnREMR3Term)); … … 2042 2039 remUnloadProperObj(); 2043 2040 return rc; 2041 2044 2042 #else 2045 2043 int rc;
Note:
See TracChangeset
for help on using the changeset viewer.