VirtualBox

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


Ignore:
Timestamp:
May 9, 2010 5:53:58 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
61332
Message:

iprt/asm*.h: split out asm-math.h, don't include asm-*.h from asm.h, don't include asm.h from sup.h. Fixed a couple file headers.

Location:
trunk/src/VBox/Runtime
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/VBox/logbackdoor.cpp

    r28800 r29250  
    3030#include <VBox/log.h>
    3131#include "internal/iprt.h"
    32 #include <iprt/asm.h>
     32#include <iprt/asm-amd64-x86.h>
    3333#include <iprt/string.h>
    3434#ifdef IN_GUEST_R3
  • trunk/src/VBox/Runtime/common/log/log.cpp

    r28800 r29250  
    4747#include <iprt/time.h>
    4848#include <iprt/asm.h>
     49#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
     50# include <iprt/asm-amd64-x86.h>
     51#endif
    4952#include <iprt/assert.h>
    5053#include <iprt/err.h>
  • trunk/src/VBox/Runtime/common/log/logcom.cpp

    r28800 r29250  
    4949
    5050#include <iprt/asm.h>
     51#include <iprt/asm-amd64-x86.h>
    5152#include <iprt/stdarg.h>
    5253#include <iprt/string.h>
  • trunk/src/VBox/Runtime/common/rand/rand.cpp

    r28800 r29250  
    3333
    3434#include <iprt/time.h>
    35 #include <iprt/asm.h>
     35#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
     36# include <iprt/asm-amd64-x86.h>
     37#endif
    3638#include <iprt/err.h>
    3739#include <iprt/assert.h>
     
    6870    if (RT_SUCCESS(rc))
    6971    {
     72#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
    7073        RTRandAdvSeed(hRand, ASMReadTSC() >> 8);
     74#else
     75        RTRandAdvSeed(hRand, RTTimeNanoTS() >> 8);
     76#endif
    7177        g_hRand = hRand;
    7278    }
  • trunk/src/VBox/Runtime/common/rand/randparkmiller.cpp

    r28800 r29250  
    3131#include "internal/iprt.h"
    3232
    33 #include <iprt/asm.h>
     33#include <iprt/asm-math.h>
    3434#include <iprt/mem.h>
    3535#include <iprt/string.h>
  • trunk/src/VBox/Runtime/common/time/timesup.cpp

    r28800 r29250  
    3333#include "internal/iprt.h"
    3434
    35 #include <iprt/asm.h>
    3635#include <iprt/assert.h>
    3736#include <iprt/err.h>
    3837#include <iprt/log.h>
    3938#ifndef IN_GUEST
     39# include <iprt/asm.h>
     40# include <iprt/asm-amd64-x86.h>
    4041# include <VBox/sup.h>
    4142# include <VBox/x86.h>
  • trunk/src/VBox/Runtime/common/time/timesupref.cpp

    r28800 r29250  
    3434
    3535#include <iprt/asm.h>
     36#include <iprt/asm-math.h>
     37#include <iprt/asm-amd64-x86.h>
    3638#include <VBox/sup.h>
    3739#include "internal/time.h"
  • trunk/src/VBox/Runtime/generic/spinlock-generic.cpp

    r28800 r29250  
    4343#include <iprt/alloc.h>
    4444#include <iprt/asm.h>
     45#include <iprt/asm-amd64-x86.h>
    4546#include <iprt/err.h>
    4647#include <iprt/assert.h>
  • trunk/src/VBox/Runtime/include/internal/alignmentchecks.h

    r28800 r29250  
    4949 */
    5050
    51 #ifdef IPRT_WITH_ALIGNMENT_CHECKS
    52 # include <iprt/asm.h>
     51#if defined(IPRT_WITH_ALIGNMENT_CHECKS) \
     52 && (   defined(RT_ARCH_AMD64) \
     53     || defined(RT_ARCH_X86) )
     54# include <iprt/asm-amd64-x86.h>
    5355
    5456RT_C_DECLS_BEGIN
  • trunk/src/VBox/Runtime/include/internal/iprt.h

    r28800 r29250  
    170170 * Asserts that interrupts are disabled when RT_MORE_STRICT is defined.   */
    171171#ifdef RT_MORE_STRICT
    172 # define RT_ASSERT_INTS_ON()            Assert(ASMIntAreEnabled())
     172# if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
     173#  define RT_ASSERT_INTS_ON()           Assert(ASMIntAreEnabled())
     174# else /* PORTME: Add architecture/platform specific test. */
     175#  define RT_ASSERT_INTS_ON()           Assert(RTThreadPreemptIsEnabled(NIL_RTTHREAD))
     176# endif
    173177#else
    174178# define RT_ASSERT_INTS_ON()            do { } while (0)
  • trunk/src/VBox/Runtime/r0drv/alloc-r0drv.cpp

    r28800 r29250  
    3232#include "internal/iprt.h"
    3333
    34 #include <iprt/asm.h>
     34#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
     35# include <iprt/asm-amd64-x86.h>
     36#endif
    3537#include <iprt/assert.h>
    3638#include <iprt/param.h>
  • trunk/src/VBox/Runtime/r0drv/generic/semspinmutex-r0drv-generic.c

    r28800 r29250  
    3636#include <iprt/semaphore.h>
    3737#include <iprt/asm.h>
     38#include <iprt/asm-amd64-x86.h>
    3839#include <iprt/assert.h>
    3940#include <iprt/err.h>
  • trunk/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c

    r28800 r29250  
    3333#include <iprt/spinlock.h>
    3434
     35#include <iprt/asm.h>
     36#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
     37# include <iprt/asm-amd64-x86.h>
     38#endif
    3539#include <iprt/assert.h>
    36 #include <iprt/asm.h>
    3740#include <iprt/err.h>
    3841#include <iprt/mem.h>
  • trunk/src/VBox/Runtime/r0drv/mpnotification-r0drv.c

    r28800 r29250  
    55
    66/*
    7  * Copyright (C) 2008 Oracle Corporation
     7 * Copyright (C) 2008-2010 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    3333
    3434#include <iprt/asm.h>
     35#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
     36# include <iprt/asm-amd64-x86.h>
     37#endif
    3538#include <iprt/assert.h>
    3639#include <iprt/err.h>
  • trunk/src/VBox/Runtime/r0drv/powernotification-r0drv.c

    r28800 r29250  
    3333
    3434#include <iprt/asm.h>
     35#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
     36# include <iprt/asm-amd64-x86.h>
     37#endif
    3538#include <iprt/assert.h>
    3639#include <iprt/err.h>
  • trunk/src/VBox/Runtime/r3/posix/thread-posix.cpp

    r28800 r29250  
    4545#include <iprt/assert.h>
    4646#include <iprt/asm.h>
     47#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
     48# include <iprt/asm-amd64-x86.h>
     49#endif
    4750#include <iprt/err.h>
    4851#include <iprt/string.h>
     
    329332RTDECL(bool) RTThreadYield(void)
    330333{
     334#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
    331335    uint64_t u64TS = ASMReadTSC();
     336#endif
    332337#ifdef RT_OS_DARWIN
    333338    pthread_yield_np();
     
    337342    pthread_yield();
    338343#endif
     344#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
    339345    u64TS = ASMReadTSC() - u64TS;
    340346    bool fRc = u64TS > 1500;
    341347    LogFlow(("RTThreadYield: returning %d (%llu ticks)\n", fRc, u64TS));
     348#else
     349    bool fRc = true; /* PORTME: Add heuristics for determining whether the cpus was yielded. */
     350#endif
    342351    return fRc;
    343352}
  • trunk/src/VBox/Runtime/testcase/tstInlineAsm.cpp

    r28800 r29250  
    2929*******************************************************************************/
    3030#include <iprt/asm.h>
     31#include <iprt/asm-math.h>
     32#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
     33# include <iprt/asm-amd64-x86.h>
     34#endif
    3135#include <iprt/stream.h>
    3236#include <iprt/string.h>
     
    6367
    6468
    65 #if !defined(PIC) || !defined(RT_ARCH_X86)
     69#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
     70
    6671const char *getCacheAss(unsigned u)
    6772{
     
    430435     }
    431436}
    432 #endif /* !PIC || !X86 */
    433 
     437
     438#endif /* AMD64 || X86 */
    434439
    435440static void tstASMAtomicXchgU8(void)
     
    11781183    RTPrintf("tstInlineASM: Benchmarking:\n");
    11791184
    1180 #define BENCH(op, str)  \
     1185#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
     1186# define BENCH(op, str) \
     1187    do { \
    11811188        RTThreadYield(); \
    11821189        u64Elapsed = ASMReadTSC(); \
     
    11841191            op; \
    11851192        u64Elapsed = ASMReadTSC() - u64Elapsed; \
    1186         RTPrintf(" %-30s %3llu cycles\n", str, u64Elapsed / cRounds);
     1193        RTPrintf(" %-30s %3llu cycles\n", str, u64Elapsed / cRounds); \
     1194    } while (0)
     1195#else
     1196# define BENCH(op, str) \
     1197    do { \
     1198        RTThreadYield(); \
     1199        u64Elapsed = RTTimeNanoTS(); \
     1200        for (i = cRounds; i > 0; i--) \
     1201            op; \
     1202        u64Elapsed = RTTimeNanoTS() - u64Elapsed; \
     1203        RTPrintf(" %-30s %3llu ns\n", str, u64Elapsed / cRounds); \
     1204    } while (0)
     1205#endif
    11871206
    11881207    BENCH(s_u32 = 0,                            "s_u32 = 0:");
     
    12591278     * Execute the tests.
    12601279     */
    1261 #if !defined(PIC) || !defined(RT_ARCH_X86)
     1280#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
    12621281    tstASMCpuId();
    12631282#endif
  • trunk/src/VBox/Runtime/testcase/tstPrfRT.cpp

    r28800 r29250  
    3333#include <iprt/stream.h>
    3434#include <iprt/thread.h>
    35 #include <iprt/asm.h>
     35#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
     36# include <iprt/asm-amd64-x86.h>
    3637
    3738
     
    4243}
    4344
    44 #define ITERATE(preexpr, expr, postexpr, cIterations) \
     45# define ITERATE(preexpr, expr, postexpr, cIterations) \
    4546    for (i = 0, u64TotalTS = 0, u64MinTS = ~0, u64MaxTS = 0; i < (cIterations); i++) \
    4647    { \
     
    6162        u64TotalTS += u64ElapsedTS; \
    6263    }
     64
     65#else  /* !AMD64 && !X86 */
     66
     67void PrintResult(uint64_t cNs, uint64_t cNsMax, uint64_t cNsMin, unsigned cTimes, const char *pszOperation)
     68{
     69    RTPrintf("tstPrfRT: %-32s %5lld / %5lld / %5lld ns per call (%u calls %lld ns)\n",
     70             pszOperation, cNsMin, cNs / (uint64_t)cTimes, cNsMax, cTimes, cNs);
     71}
     72
     73# define ITERATE(preexpr, expr, postexpr, cIterations) \
     74    for (i = 0, u64TotalTS = 0, u64MinTS = ~0, u64MaxTS = 0; i < (cIterations); i++) \
     75    { \
     76        { preexpr } \
     77        uint64_t u64StartTS = RTTimeNanoTS(); \
     78        { expr } \
     79        uint64_t u64ElapsedTS = RTTimeNanoTS() - u64StartTS; \
     80        { postexpr } \
     81        if (u64ElapsedTS > u64MinTS * 32) \
     82        { \
     83            i--; \
     84            continue; \
     85        } \
     86        if (u64ElapsedTS < u64MinTS) \
     87            u64MinTS = u64ElapsedTS; \
     88        if (u64ElapsedTS > u64MaxTS) \
     89            u64MaxTS = u64ElapsedTS; \
     90        u64TotalTS += u64ElapsedTS; \
     91    }
     92
     93#endif /* !AMD64 && !X86 */
     94
    6395
    6496int main()
  • trunk/src/VBox/Runtime/testcase/tstR0ThreadPreemption.cpp

    r28800 r29250  
    3030#include <iprt/thread.h>
    3131
     32#include <iprt/asm-amd64-x86.h>
    3233#include <iprt/err.h>
    3334#include <iprt/time.h>
  • trunk/src/VBox/Runtime/testcase/tstTSC.cpp

    r28800 r29250  
    2828*   Header Files                                                               *
    2929*******************************************************************************/
     30#include <iprt/asm-amd64-x86.h>
    3031#include <iprt/asm.h>
    3132#include <iprt/getopt.h>
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