Index: trunk/src/VBox/HostDrivers/Support/SUPDrv.c
===================================================================
--- trunk/src/VBox/HostDrivers/Support/SUPDrv.c	(revision 37248)
+++ trunk/src/VBox/HostDrivers/Support/SUPDrv.c	(revision 37249)
@@ -4065,5 +4065,5 @@
 
         if (pImage->fNative)
-            rc = supdrvOSLdrLoad(pDevExt, pImage, pReq->u.In.abImage);
+            rc = supdrvOSLdrLoad(pDevExt, pImage, pReq->u.In.abImage, pReq);
         else
             memcpy(pImage->pvImage, &pReq->u.In.abImage[0], pImage->cbImageBits);
Index: trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h
===================================================================
--- trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h	(revision 37248)
+++ trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h	(revision 37249)
@@ -577,9 +577,11 @@
  * @returns IPRT status code.
  * @param   pDevExt             The device globals.
- * @param   pImage              The image data (up to date except for some
- *                              entry point pointers).
+ * @param   pImage              The image data (up to date). Adjust entrypoints
+ *                              and exports if necessary.
  * @param   pbImageBits         The image bits as loaded by ring-3.
- */
-int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits);
+ * @param   pReq                Pointer to the request packet so that the VMMR0
+ *                              entry points can be adjusted.
+ */
+int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits, PSUPLDRLOAD pReq);
 
 
Index: trunk/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp
===================================================================
--- trunk/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp	(revision 37248)
+++ trunk/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp	(revision 37249)
@@ -776,7 +776,7 @@
 
 
-int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits)
-{
-    NOREF(pDevExt); NOREF(pImage); NOREF(pbImageBits);
+int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits, PSUPLDRLOAD pReq)
+{
+    NOREF(pDevExt); NOREF(pImage); NOREF(pbImageBits); NOREF(pReq);
     return VERR_NOT_SUPPORTED;
 }
Index: trunk/src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c
===================================================================
--- trunk/src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c	(revision 37248)
+++ trunk/src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c	(revision 37249)
@@ -616,7 +616,7 @@
 
 
-int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits)
-{
-    NOREF(pDevExt); NOREF(pImage); NOREF(pbImageBits);
+int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits, PSUPLDRLOAD pReq)
+{
+    NOREF(pDevExt); NOREF(pImage); NOREF(pbImageBits); NOREF(pReq);
     return VERR_NOT_SUPPORTED;
 }
Index: trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
===================================================================
--- trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c	(revision 37248)
+++ trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c	(revision 37249)
@@ -740,7 +740,7 @@
 
 
-int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits)
-{
-    NOREF(pDevExt); NOREF(pImage); NOREF(pbImageBits);
+int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits, PSUPLDRLOAD pReq)
+{
+    NOREF(pDevExt); NOREF(pImage); NOREF(pbImageBits); NOREF(pReq);
     return VERR_NOT_SUPPORTED;
 }
Index: trunk/src/VBox/HostDrivers/Support/os2/SUPDrv-os2.cpp
===================================================================
--- trunk/src/VBox/HostDrivers/Support/os2/SUPDrv-os2.cpp	(revision 37248)
+++ trunk/src/VBox/HostDrivers/Support/os2/SUPDrv-os2.cpp	(revision 37249)
@@ -397,7 +397,7 @@
 
 
-int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits)
-{
-    NOREF(pDevExt); NOREF(pImage); NOREF(pbImageBits);
+int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits, PSUPLDRLOAD pReq)
+{
+    NOREF(pDevExt); NOREF(pImage); NOREF(pbImageBits); NOREF(pReq);
     return VERR_NOT_SUPPORTED;
 }
Index: trunk/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c
===================================================================
--- trunk/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c	(revision 37248)
+++ trunk/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c	(revision 37249)
@@ -36,4 +36,5 @@
 #include <sys/modctl.h>
 #include <sys/kobj.h>
+#include <sys/kobj_impl.h>
 #include <sys/open.h>
 #include <sys/conf.h>
@@ -952,4 +953,9 @@
     /*
      * Get the module info.
+     *
+     * Note! The text section is actually not at mi_base, but and the next
+     *       alignment boundrary and there seems to be no easy way of
+     *       getting at this address.  This sabotages supdrvOSLdrLoad.
+     *       Bastards!
      */
     struct modinfo ModInfo;
@@ -960,5 +966,5 @@
 
     mod_release_mod(pImage->pSolModCtl);
-    LogRel(("supdrvOSLdrOpen: succeeded for '%s' (mi_base=%p mi_base=%#x), id=%d ctl=%p\n",
+    LogRel(("supdrvOSLdrOpen: succeeded for '%s' (mi_base=%p mi_size=%#x), id=%d ctl=%p\n",
             pszFilename, ModInfo.mi_base, ModInfo.mi_size, idMod, pModCtl));
     return VINF_SUCCESS;
@@ -975,6 +981,33 @@
 
 
-int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits)
-{
+/**
+ * Resolves a module entry point address.
+ *
+ * @returns VBox status code.
+ * @param   pImage              The image.
+ * @param   pszSymbol           The symbol name.
+ * @param   ppvValue            Where to store the value.  On input this holds
+ *                              the symbol value SUPLib calculated.
+ */
+static int supdrvSolLdrResolvEp(PSUPDRVLDRIMAGE pImage, const char *pszSymbol, void **ppvValue)
+{
+    /* Don't try resolve symbols which, according to SUPLib, aren't there. */
+    if (!*ppvValue)
+        return VINF_SUCCESS;
+
+    uintptr_t uValue = modlookup_by_modctl(pImage->pSolModCtl, pszSymbol);
+    if (!uValue)
+    {
+        LogRel(("supdrvOSLdrLoad on %s failed to resolve %s\n", pImage->szName, pszSymbol));
+        return VERR_SYMBOL_NOT_FOUND;
+    }
+    *ppvValue = (void *)uValue;
+    return VINF_SUCCESS;
+}
+
+
+int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits, PSUPLDRLOAD pReq)
+{
+#if 0 /* This doesn't work because of text alignment. */
     /*
      * Comparing is very very difficult since text and data may be allocated
@@ -984,13 +1017,13 @@
     if (memcmp(pImage->pvImage, pbImageBits, cbCompare))
     {
-        LogRel(("Image mismatch: %s\n", pImage->szName));
+        LogRel(("Image mismatch: %s (%p)\n", pImage->szName, pImage->pvImage));
         LogRel(("Native: %.*Rhxs\n", cbCompare, pImage->pvImage));
         LogRel(("SUPLib: %.*Rhxs\n", cbCompare, pbImageBits));
         return VERR_LDR_MISMATCH_NATIVE;
     }
-
-
-    /*
-     * Get the symbol addresses.
+#endif
+
+    /*
+     * Get the exported symbol addresses.
      */
     int rc;
@@ -1018,4 +1051,35 @@
 
         rc = iSym == UINT32_MAX ? VINF_SUCCESS : VERR_LDR_GENERAL_FAILURE;
+
+        /*
+         * Get the standard module entry points.
+         */
+        if (RT_SUCCESS(rc))
+        {
+            rc = supdrvSolLdrResolvEp(pImage, "ModuleInit", (void **)&pImage->pfnModuleInit);
+            if (RT_SUCCESS(rc))
+                rc = supdrvSolLdrResolvEp(pImage, "ModuleTerm", (void **)&pImage->pfnModuleTerm);
+
+            switch (pReq->u.In.eEPType)
+            {
+                case SUPLDRLOADEP_VMMR0:
+                {
+                    if (RT_SUCCESS(rc))
+                        rc = supdrvSolLdrResolvEp(pImage, "VMMR0EntryInt",  (void **)&pReq->u.In.EP.VMMR0.pvVMMR0EntryInt);
+                    if (RT_SUCCESS(rc))
+                        rc = supdrvSolLdrResolvEp(pImage, "VMMR0EntryFast", (void **)&pReq->u.In.EP.VMMR0.pvVMMR0EntryFast);
+                    if (RT_SUCCESS(rc))
+                        rc = supdrvSolLdrResolvEp(pImage, "VMMR0EntryEx",   (void **)&pReq->u.In.EP.VMMR0.pvVMMR0EntryEx);
+                    break;
+                }
+
+                case SUPLDRLOADEP_SERVICE:
+                {
+                    /** @todo we need the name of the entry point. */
+                    return VERR_NOT_SUPPORTED;
+                }
+            }
+        }
+
         mod_release_mod(pImage->pSolModCtl);
     }
@@ -1059,7 +1123,7 @@
 
 
-int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits)
-{
-    NOREF(pDevExt); NOREF(pImage); NOREF(pbImageBits);
+int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits, PSUPLDRLOAD pReq)
+{
+    NOREF(pDevExt); NOREF(pImage); NOREF(pbImageBits); NOREF(pReq);
     return VERR_NOT_SUPPORTED;
 }
Index: trunk/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp
===================================================================
--- trunk/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp	(revision 37248)
+++ trunk/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp	(revision 37249)
@@ -766,7 +766,7 @@
 }
 
-int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits)
-{
-    NOREF(pDevExt); NOREF(pImage); NOREF(pbImageBits);
+int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits, PSUPLDRLOAD pReq)
+{
+    NOREF(pDevExt); NOREF(pReq);
     if (pImage->pvNtSectionObj)
     {
