VirtualBox

Ignore:
Timestamp:
Jan 25, 2007 8:47:51 PM (18 years ago)
Author:
vboxsync
Message:

Bool and AMD64 hacking.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/linux/Makefile

    r213 r331  
    2121#
    2222
     23#
     24# First, figure out which architecture we're targeting.
     25# (We have to support basic cross building (ARCH=i386|x86_64).)
     26#
     27ifeq ($(filter amd64 x86,$(BUILD_TARGET_ARCH)),)
     28 $(warning Ignoring unknown BUILD_TARGET_ARCH value '$(BUILD_TARGET_ARCH)'.)
     29 BUILD_TARGET_ARCH :=
     30endif
     31ifeq ($(BUILD_TARGET_ARCH),)
     32 ifeq ($(ARCH),x86_64)
     33  BUILD_TARGET_ARCH := amd64
     34 else ifeq ($(ARCH),i386)
     35  BUILD_TARGET_ARCH := x86
     36 else ifeq ($(filter-out x86_64 amd64 AMD64,$(shell uname -m)),)
     37  BUILD_TARGET_ARCH := amd64
     38 else
     39  BUILD_TARGET_ARCH := x86
     40 endif
     41endif
     42
     43
    2344MODULE = vboxdrv
    2445OBJS   = \
     
    2647        SUPDRVShared.o \
    2748        r0drv/alloc-r0drv.o \
     49        r0drv/initterm-r0drv.o \
    2850        r0drv/linux/alloc-r0drv-linux.o \
     51        r0drv/linux/initterm-r0drv-linux.o \
    2952        r0drv/linux/semaphore-r0drv-linux.o \
    3053        r0drv/linux/spinlock-r0drv-linux.o \
    31         r0drv/linux/thread-r0drv-linux.o \
     54        r0drv/linux/thread-r0drv-linux.o
     55ifeq ($(BUILD_TARGET_ARCH),amd64)
     56OBJS  += alloc/heapsimple.o
     57endif
     58
    3259
    3360ifneq ($(MAKECMDGOALS),clean)
     
    94121 KFLAGS  += -DCONFIG_VBOXDRV_AS_MISC
    95122endif
    96 ifeq ($(filter-out x86_64 amd64 AMD64,$(shell uname -m)),)
     123ifeq ($(BUILD_TARGET_ARCH),amd64)
    97124 KFLAGS  += -D__AMD64__
    98125else
  • trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c

    r260 r331  
    11/** @file
    2  *
    3  * VBox host drivers - Ring-0 support drivers - Linux host:
    4  * Linux host driver code
     2 * The VirtualBox Support Driver - Linux hosts.
    53 */
    64
     
    2826#include <iprt/spinlock.h>
    2927#include <iprt/semaphore.h>
     28#include <iprt/initterm.h>
     29#include <iprt/err.h>
     30#include <iprt/mem.h>
    3031
    3132#include <linux/module.h>
     
    213214#define DEVICE_MAJOR   234
    214215/** Saved major device number */
    215 static int              g_iModuleMajor;
     216static int              g_iModuleMajor;
    216217#endif /* !CONFIG_VBOXDRV_AS_MISC */
    217218
     
    219220#define DEVICE_NAME    "vboxdrv"
    220221
    221 
     222#ifdef __AMD64__
     223/**
     224 * Memory for the executable memory heap (in IPRT).
     225 */
     226extern uint8_t g_abExecMemory[1572864]; /* 1.5 MB */
     227__asm__(".section execmemory, \"awx\", @progbits\n\t"
     228        ".align 32\n\t"
     229        ".globl g_abExecMemory\n"
     230        "g_abExecMemory:\n\t"
     231        ".zero 1572864\n\t"
     232        ".type g_abExecMemory, @object\n\t"
     233        ".size g_abExecMemory, 1572864\n\t"
     234        ".text\n\t");
     235#endif
    222236
    223237
     
    242256static struct file_operations gFileOpsVBoxDrv =
    243257{
    244         owner:          THIS_MODULE,
    245         open:           VBoxSupDrvCreate,
    246         release:        VBoxSupDrvClose,
    247         ioctl:          VBoxSupDrvDeviceControl,
     258    owner:      THIS_MODULE,
     259    open:       VBoxSupDrvCreate,
     260    release:    VBoxSupDrvClose,
     261    ioctl:      VBoxSupDrvDeviceControl,
    248262};
    249263
     
    378392    if (rc < 0)
    379393    {
    380         dprintf(("VBOX_REGISTER_DEVICE failed with rc=%#x!\n", rc));
     394        dprintf(("VBOX_REGISTER_DEVICE failed with rc=%#x!\n", rc));
    381395        return rc;
    382396    }
     
    398412    if (g_hDevFsVBoxDrv == NULL)
    399413    {
    400         dprintf(("devfs_register failed!\n"));
     414        dprintf(("devfs_register failed!\n"));
    401415        rc = -EINVAL;
    402416    }
     
    406420    {
    407421        /*
    408          * Initialize the device extension.
     422         * Initialize the runtime.
     423         * On AMD64 we'll have to donate the high rwx memory block to the exec allocator.
    409424         */
    410         rc = supdrvInitDevExt(&g_DevExt);
    411         if (!rc)
     425        rc = RTR0Init(0);
     426        if (RT_SUCCESS(rc))
    412427        {
     428#ifdef __AMD64__
     429            rc = RTR0MemExecDonate(&g_abExecMemory[0], sizeof(g_abExecMemory));
     430#endif
    413431            /*
    414              * Create the GIP page.
     432             * Initialize the device extension.
    415433             */
    416             rc = VBoxSupDrvInitGip(&g_DevExt);
     434            if (RT_SUCCESS(rc))
     435                rc = supdrvInitDevExt(&g_DevExt);
    417436            if (!rc)
    418437            {
    419                 dprintf(("VBoxDrv::ModuleInit returning %#x\n", rc));
    420                 return rc;
     438                /*
     439                 * Create the GIP page.
     440                 */
     441                rc = VBoxSupDrvInitGip(&g_DevExt);
     442                if (!rc)
     443                {
     444                    dprintf(("VBoxDrv::ModuleInit returning %#x\n", rc));
     445                    return rc;
     446                }
     447
     448                supdrvDeleteDevExt(&g_DevExt);
    421449            }
    422             supdrvDeleteDevExt(&g_DevExt);
     450            else
     451                rc = -EINVAL;
     452            RTR0Term();
    423453        }
    424454        else
     
    476506
    477507    /*
    478      * Destroy GIP and delete the device extension.
     508     * Destroy GIP, delete the device extension and terminate IPRT.
    479509     */
    480510    VBoxSupDrvTermGip(&g_DevExt);
    481511    supdrvDeleteDevExt(&g_DevExt);
     512    RTR0Term();
    482513}
    483514
     
    540571{
    541572    int                 rc;
    542     SUPDRVIOCTLDATA     Args;
     573    SUPDRVIOCTLDATA     Args;
    543574    void               *pvBuf = NULL;
    544575    int                 cbBuf = 0;
     
    686717int  VBOXCALL   supdrvOSLockMemOne(PSUPDRVMEMREF pMem, PSUPPAGE paPages)
    687718{
    688     int         rc;
     719    int         rc;
    689720    struct page **papPages;
    690721    unsigned    iPage;
     
    14811512{
    14821513#if 1
    1483     va_list      args;
    1484     char        szMsg[512];
     1514    va_list args;
     1515    char    szMsg[512];
    14851516
    14861517    va_start(args, pszFormat);
     
    15131544RTDECL(void) AssertMsg2(const char *pszFormat, ...)
    15141545{   /* forwarder. */
    1515     va_list      ap;
    1516     char        msg[256];
     1546    va_list ap;
     1547    char    msg[256];
    15171548
    15181549    va_start(ap, pszFormat);
Note: See TracChangeset for help on using the changeset viewer.

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