VirtualBox

Changeset 331 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
Jan 25, 2007 8:47:51 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
17884
Message:

Bool and AMD64 hacking.

Location:
trunk/src/VBox/Runtime
Files:
5 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/Makefile

    r289 r331  
    533533        VBox/strformat-vbox.cpp \
    534534        r0drv/alloc-r0drv.cpp \
     535        r0drv/initterm-r0drv.cpp \
    535536        generic/RTLogWriteStdErr-stub-generic.cpp \
    536537        generic/RTLogWriteStdOut-stub-generic.cpp \
     
    541542
    542543RuntimeR0Drv_SOURCES.linux = \
     544        alloc/heapsimple.cpp \
    543545        r0drv/linux/alloc-r0drv-linux.c \
     546        r0drv/linux/initterm-r0drv-linux.c \
    544547        r0drv/linux/RTLogWriteDebugger-r0drv-linux.c \
    545548        r0drv/linux/semaphore-r0drv-linux.c \
    546549        r0drv/linux/spinlock-r0drv-linux.c \
    547550        r0drv/linux/thread-r0drv-linux.c
    548 RuntimeR0Drv_SOURCES.linux.amd64 = \
    549         alloc/heapsimple.cpp
    550551
    551552RuntimeR0Drv_SOURCES.win = \
    552553        nt/RTErrConvertFromNtStatus.cpp \
    553554        r0drv/nt/alloc-r0drv-nt.cpp \
     555        r0drv/nt/initterm-r0drv-nt.cpp \
    554556        r0drv/nt/RTLogWriteDebugger-r0drv-nt.cpp \
    555557        r0drv/nt/semaphore-r0drv-nt.cpp \
     
    564566        RTErrConvertFromErrno.cpp \
    565567        string/memchr.asm \
    566         r0drv/initterm-r0drv.cpp \
    567568        r0drv/memobj-r0drv.cpp \
    568569        r0drv/thread-r0drv.cpp \
  • trunk/src/VBox/Runtime/alloc/heapsimple.cpp

    r329 r331  
    311311                     - sizeof(RTHEAPSIMPLEINTERNAL);
    312312    pHeapInt->pFreeTail = pHeapInt->pFreeHead = (PRTHEAPSIMPLEFREE)(pHeapInt + 1);
    313     for (unsigned i = 0; i < ELEMENTS(pHeapInt->auAlignment); i++)
     313    unsigned i;
     314    for (i = 0; i < ELEMENTS(pHeapInt->auAlignment); i++)
    314315        pHeapInt->auAlignment[i] = ~(size_t)0;
    315316
     
    448449     */
    449450    PRTHEAPSIMPLEBLOCK  pRet = NULL;
    450     for (PRTHEAPSIMPLEFREE pFree = pHeapInt->pFreeHead;
     451    PRTHEAPSIMPLEFREE   pFree;
     452    for (pFree = pHeapInt->pFreeHead;
    451453         pFree;
    452454         pFree = pFree->pNext)
     
    768770    PRTHEAPSIMPLEFREE pPrev = NULL;
    769771    PRTHEAPSIMPLEFREE pPrevFree = NULL;
    770     for (PRTHEAPSIMPLEFREE pBlock = (PRTHEAPSIMPLEFREE)(pHeapInt + 1);
     772    PRTHEAPSIMPLEFREE pBlock;
     773    for (pBlock = (PRTHEAPSIMPLEFREE)(pHeapInt + 1);
    771774         pBlock;
    772775         pBlock = (PRTHEAPSIMPLEFREE)pBlock->Core.pNext)
     
    881884              Heap, pHeapInt->cbHeap, pHeapInt->cbFree);
    882885
    883     for (PRTHEAPSIMPLEFREE pBlock = (PRTHEAPSIMPLEFREE)(pHeapInt + 1);
     886    PRTHEAPSIMPLEFREE pBlock;
     887    for (pBlock = (PRTHEAPSIMPLEFREE)(pHeapInt + 1);
    884888         pBlock;
    885889         pBlock = (PRTHEAPSIMPLEFREE)pBlock->Core.pNext)
  • trunk/src/VBox/Runtime/include/internal/initterm.h

    r207 r331  
    2323#define __internal_initterm_h_
    2424
    25 #include <sys/cdefs.h>
     25#include <iprt/cdefs.h>
    2626
    2727__BEGIN_DECLS
  • trunk/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c

    r291 r331  
    2525*******************************************************************************/
    2626#include "the-linux-kernel.h"
    27 #include <iprt/alloc.h>
     27#include <iprt/mem.h>
    2828#include <iprt/assert.h>
    2929#include "r0drv/alloc-r0drv.h"
     
    6060 * This is as RTMemExecDonate specific to AMD64 Linux/GNU.
    6161 */
    62 RTDECL(void) RTMemExecCleanup(void)
     62void rtR0MemExecCleanup(void)
    6363{
    6464    RTSpinlockDestroy(g_HeapExecSpinlock);
     
    8282 * @param   cb          The size of the memory block.
    8383 */
    84 RTDECL(int) RTMemExecDonate(void *pvMemory, size_t cb)
     84RTR0DECL(int) RTR0MemExecDonate(void *pvMemory, size_t cb)
    8585{
    8686    int rc;
     
    9292        rc = RTHeapSimpleInit(&g_HeapExec, pvMemory, cb);
    9393        if (RT_FAILURE(rc))
    94             RTMemExecCleanup();
     94            rtR0MemExecCleanup();
    9595    }
    9696    return rc;
  • trunk/src/VBox/Runtime/r0drv/linux/initterm-r0drv-linux.c

    r303 r331  
    11/* $Id$ */
    22/** @file
    3  * InnoTek Portable Runtime - Initialization & Termination, R0 Driver, Darwin.
     3 * InnoTek Portable Runtime - Initialization & Termination, R0 Driver, Linux.
    44 */
    55
     
    2424*   Header Files                                                               *
    2525*******************************************************************************/
    26 #include "the-darwin-kernel.h"
     26#include "the-linux-kernel.h"
    2727#include <iprt/err.h>
    2828#include <iprt/assert.h>
     
    3131
    3232/*******************************************************************************
    33 *   Global Variables                                                           *
     33*   Internal Functions                                                         *
    3434*******************************************************************************/
    35 /** Pointer to the lock group used by IPRT. */
    36 lck_grp_t *g_pDarwinLockGroup = NULL;
    37 
     35#ifdef __AMD64__
     36/* in alloc-r0drv0-linux.c */
     37extern void rtR0MemExecCleanup(void);
     38#endif
    3839
    3940
    4041int rtR0InitNative(void)
    4142{
    42     /*
    43      * Create the lock group.
    44      */
    45     g_pDarwinLockGroup = lck_grp_alloc_init("IPRT", LCK_GRP_ATTR_NULL);
    46     AssertReturn(g_pDarwinLockGroup, VERR_NO_MEMORY);
    47 
    4843    return VINF_SUCCESS;
    4944}
     
    5247void rtR0TermNative(void)
    5348{
    54     /*
    55      * Free the lock group.
    56      */
    57     if (g_pDarwinLockGroup)
    58     {
    59         lck_grp_free(g_pDarwinLockGroup);
    60         g_pDarwinLockGroup = NULL;
    61     }
     49#ifdef __AMD64__
     50    rtR0MemExecCleanup();
     51#endif
    6252}
    6353
  • trunk/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h

    r260 r331  
    2323#define __the_linux_kernel_h__
    2424
    25 #ifndef bool /* Linux 2.6.19 C++ nightmare */
    26 #define bool bool_type
    27 #define true true_type
    28 #define false false_type
    29 #define _Bool int
    30 #define bool_type_r0drv_the_linux_kernel_h__
    31 #endif
     25/*
     26 * Include iprt/types.h to install the bool wrappers.
     27 * Then use the linux bool type for all the stuff include here.
     28 */
     29#include <iprt/types.h>
     30#define bool linux_bool
    3231
    3332#include <linux/autoconf.h>
     
    5453#  define KBUILD_STR(s) #s
    5554# endif
    56 #endif
    57 #include <iprt/cdefs.h>
    58 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
    59 # undef ALIGN
    6055#endif
    6156#include <linux/string.h>
     
    9085#include <asm/div64.h>
    9186
    92 #ifdef bool_type_r0drv_the_linux_kernel_h__
    93 #undef bool
    94 #undef true
    95 #undef false
    96 #undef _Bool
    97 #undef bool_type_r0drv_the_linux_kernel_h__
    98 #endif
    99 
    10087#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
    10188# ifndef page_to_pfn
     
    228215#endif
    229216
    230 #endif
    231 
     217/*
     218 * Stop using the linux bool type.
     219 */
     220#undef bool
     221
     222#endif
     223
  • trunk/src/VBox/Runtime/r0drv/nt/initterm-r0drv-nt.cpp

    r303 r331  
    11/* $Id$ */
    22/** @file
    3  * InnoTek Portable Runtime - Initialization & Termination, R0 Driver, Darwin.
     3 * InnoTek Portable Runtime - Initialization & Termination, R0 Driver, NT.
    44 */
    55
     
    2424*   Header Files                                                               *
    2525*******************************************************************************/
    26 #include "the-darwin-kernel.h"
     26#include "the-nt-kernel.h"
    2727#include <iprt/err.h>
    2828#include <iprt/assert.h>
    2929#include "internal/initterm.h"
    3030
    31 
    32 /*******************************************************************************
    33 *   Global Variables                                                           *
    34 *******************************************************************************/
    35 /** Pointer to the lock group used by IPRT. */
    36 lck_grp_t *g_pDarwinLockGroup = NULL;
    37 
    38 
    39 
    4031int rtR0InitNative(void)
    4132{
    42     /*
    43      * Create the lock group.
    44      */
    45     g_pDarwinLockGroup = lck_grp_alloc_init("IPRT", LCK_GRP_ATTR_NULL);
    46     AssertReturn(g_pDarwinLockGroup, VERR_NO_MEMORY);
    47 
    4833    return VINF_SUCCESS;
    4934}
     
    5237void rtR0TermNative(void)
    5338{
    54     /*
    55      * Free the lock group.
    56      */
    57     if (g_pDarwinLockGroup)
    58     {
    59         lck_grp_free(g_pDarwinLockGroup);
    60         g_pDarwinLockGroup = NULL;
    61     }
    6239}
    6340
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