VirtualBox

Changeset 206 in vbox


Ignore:
Timestamp:
Jan 21, 2007 10:31:42 AM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
17690
Message:

Init/term R0 runtime.

Location:
trunk/src/VBox/HostDrivers/Support/darwin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.c

    r1 r206  
    11/** @file
    2  *
    32 * VBox host drivers - Ring-0 support drivers - Darwin host:
    43 * Darwin driver C code
     
    2524*   Header Files                                                               *
    2625*******************************************************************************/
    27 /* deal with conflicts first, we ignore any Darwin variants of ALIGN, MAX, MIN, and PVM. */
     26/* Deal with conflicts first.
     27 * (This is mess inherited from BSD. The *BSDs has clean this up long ago.) */
    2828#include <sys/param.h>
    29 #undef ALIGN
    30 #undef MAX
    31 #undef MIN
    3229#undef PVM
    3330
    3431#include "SUPDRV.h"
    3532#include <iprt/types.h>
     33#include <iprt/initterm.h>
    3634#include <iprt/assert.h>
    3735#include <iprt/spinlock.h>
     
    126124
    127125    /*
    128      * Initialize the device extension.
    129      */
    130     rc = supdrvInitDevExt(&g_DevExt);
     126     * Initialize IPRT.
     127     */
     128    rc = RTR0Init(0);
    131129    if (RT_SUCCESS(rc))
    132130    {
    133131        /*
    134          * Initialize the session hash table.
     132         * Initialize the device extension.
    135133         */
    136         memset(g_apSessionHashTab, 0, sizeof(g_apSessionHashTab)); /* paranoia */
    137         rc = RTSpinlockCreate(&g_Spinlock);
     134        rc = supdrvInitDevExt(&g_DevExt);
    138135        if (RT_SUCCESS(rc))
    139136        {
    140137            /*
    141              * Registering ourselves as a character device.
     138             * Initialize the session hash table.
    142139             */
    143             g_iMajorDeviceNo = cdevsw_add(-1, &g_DevCW);
    144             if (g_iMajorDeviceNo >= 0)
     140            memset(g_apSessionHashTab, 0, sizeof(g_apSessionHashTab)); /* paranoia */
     141            rc = RTSpinlockCreate(&g_Spinlock);
     142            if (RT_SUCCESS(rc))
    145143            {
    146                 g_hDevFsDevice = devfs_make_node(makedev(g_iMajorDeviceNo, 0), DEVFS_CHAR,
    147                                                  UID_ROOT, GID_WHEEL, 0660, DEVICE_NAME); /** @todo the UID and GID should be configurable! */
    148                 if (g_hDevFsDevice)
     144                /*
     145                 * Registering ourselves as a character device.
     146                 */
     147                g_iMajorDeviceNo = cdevsw_add(-1, &g_DevCW);
     148                if (g_iMajorDeviceNo >= 0)
    149149                {
    150                     OSDBGPRINT(("VBoxDrv: Successfully started. (major=%d)\n", g_iMajorDeviceNo));
    151                     return KMOD_RETURN_SUCCESS;
     150                    g_hDevFsDevice = devfs_make_node(makedev(g_iMajorDeviceNo, 0), DEVFS_CHAR,
     151                                                     UID_ROOT, GID_WHEEL, 0660, DEVICE_NAME); /** @todo the UID and GID should be configurable! */
     152                    if (g_hDevFsDevice)
     153                    {
     154                        OSDBGPRINT(("VBoxDrv: Successfully started. (major=%d)\n", g_iMajorDeviceNo));
     155                        return KMOD_RETURN_SUCCESS;
     156                    }
     157
     158                    OSDBGPRINT(("VBoxDrv: devfs_make_node(makedev(%d,0),,,,%s) failed\n",
     159                                g_iMajorDeviceNo, DEVICE_NAME));
     160                    cdevsw_remove(g_iMajorDeviceNo, &g_DevCW);
     161                    g_iMajorDeviceNo = -1;
    152162                }
    153                 OSDBGPRINT(("VBoxDrv: devfs_make_node(makedev(%d,0),,,,%s) failed\n",
    154                             g_iMajorDeviceNo, DEVICE_NAME));
    155                 cdevsw_remove(g_iMajorDeviceNo, &g_DevCW);
    156                 g_iMajorDeviceNo = -1;
     163                else
     164                    OSDBGPRINT(("VBoxDrv: cdevsw_add failed (%d)\n", g_iMajorDeviceNo));
     165                RTSpinlockDestroy(g_Spinlock);
     166                g_Spinlock = NIL_RTSPINLOCK;
    157167            }
    158168            else
    159                 OSDBGPRINT(("VBoxDrv: cdevsw_add failed (%d)\n", g_iMajorDeviceNo));
    160             RTSpinlockDestroy(g_Spinlock);
    161             g_Spinlock = NIL_RTSPINLOCK;
     169                OSDBGPRINT(("VBoxDrv: RTSpinlockCreate failed (rc=%d)\n", rc));
     170            supdrvDeleteDevExt(&g_DevExt);
    162171        }
    163172        else
    164             OSDBGPRINT(("VBoxDrv: RTSpinlockCreate failed (rc=%d)\n", rc));
    165         supdrvDeleteDevExt(&g_DevExt);
     173            OSDBGPRINT(("VBoxDrv: failed to initialize device extension (rc=%d)\n", rc));
     174        RTR0Term();
    166175    }
    167176    else
    168         OSDBGPRINT(("VBoxDrv: failed to initialize device extension (rc=%d)\n", rc));
     177        OSDBGPRINT(("VBoxDrv: failed to initialize IPRT (rc=%d)\n", rc));
    169178
    170179    memset(&g_DevExt, 0, sizeof(g_DevExt));
     
    200209    AssertRC(rc);
    201210    g_Spinlock = NIL_RTSPINLOCK;
     211
     212    RTR0Term();
    202213
    203214    memset(&g_DevExt, 0, sizeof(g_DevExt));
     
    518529
    519530
    520 /** Runtime assert implementation for Linux Ring-0. */
     531/** Runtime assert implementation for Darwin Ring-0. */
    521532RTDECL(void) AssertMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
    522533{
  • trunk/src/VBox/HostDrivers/Support/darwin/load.sh

    r195 r206  
    1212fi
    1313
     14trap "sudo chown -R `whoami` $DIR; exit 1" INT
     15set -x
    1416sudo chown -R root:wheel "$DIR"
    1517sudo chmod -R o-rwx "$DIR"
    16 sudo kextload -t -v 6 "$DIR"
     18sync ; sleep 1; sync
     19sudo kextload -t "$DIR"
    1720sudo chown -R `whoami` "$DIR"
    1821
     22
     23
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette