VirtualBox

Changeset 29276 in vbox


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

iprt/asm.h: cleaned up the hardcoded page size mess so we can deal with sparc64.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/asm.h

    r29273 r29276  
    3030#include <iprt/types.h>
    3131#include <iprt/assert.h>
    32 /** @todo @code #include <iprt/param.h> @endcode for PAGE_SIZE. */
    3332/** @def RT_INLINE_ASM_USES_INTRIN
    3433 * Defined as 1 if we're using a _MSC_VER 1400.
     
    24092408
    24102409
    2411 #if defined(PAGE_SIZE) && !defined(NT_INCLUDED)
    2412 # if PAGE_SIZE != 0x1000
    2413 #  error "PAGE_SIZE is not 0x1000!"
     2410/** @def RT_ASM_PAGE_SIZE
     2411 * We try avoid dragging in iprt/param.h here.
     2412 * @internal
     2413 */
     2414#if defined(RT_ARCH_SPARC64)
     2415# define RT_ASM_PAGE_SIZE   0x2000
     2416# if defined(PAGE_SIZE) && !defined(NT_INCLUDED)
     2417#  if PAGE_SIZE != 0x2000
     2418#   error "PAGE_SIZE is not 0x2000!"
     2419#  endif
     2420# endif
     2421#else
     2422# define RT_ASM_PAGE_SIZE   0x1000
     2423# if defined(PAGE_SIZE) && !defined(NT_INCLUDED)
     2424#  if PAGE_SIZE != 0x1000
     2425#   error "PAGE_SIZE is not 0x1000!"
     2426#  endif
    24142427# endif
    24152428#endif
     
    24272440#  if RT_INLINE_ASM_USES_INTRIN
    24282441#   ifdef RT_ARCH_AMD64
    2429     __stosq((unsigned __int64 *)pv, 0, /*PAGE_SIZE*/0x1000 / 8);
     2442    __stosq((unsigned __int64 *)pv, 0, RT_ASM_PAGE_SIZE / 8);
    24302443#   else
    2431     __stosd((unsigned long *)pv, 0, /*PAGE_SIZE*/0x1000 / 4);
     2444    __stosd((unsigned long *)pv, 0, RT_ASM_PAGE_SIZE / 4);
    24322445#   endif
    24332446
     
    24392452                           "=c" (uDummy)
    24402453                         : "0" (pv),
    2441                            "c" (0x1000 >> 3),
     2454                           "c" (RT_ASM_PAGE_SIZE >> 3),
    24422455                           "a" (0)
    24432456                         : "memory");
     
    24472460                           "=c" (uDummy)
    24482461                         : "0" (pv),
    2449                            "c" (0x1000 >> 2),
     2462                           "c" (RT_ASM_PAGE_SIZE >> 2),
    24502463                           "a" (0)
    24512464                         : "memory");
     
    25922605                         : "mr" (pvPage),
    25932606#  ifdef RT_ARCH_AMD64
    2594                          "0" (0x1000/8),
    2595 #  else
    2596                          "0" (0x1000/4),
     2607                         "0" (RT_ASM_PAGE_SIZE/8),
     2608#  else
     2609                         "0" (RT_ASM_PAGE_SIZE/4),
    25972610#  endif
    25982611                         "1" (pvPage),
     
    26012614# else
    26022615   uintptr_t const *puPtr = (uintptr_t const *)pvPage;
    2603    int              cLeft = 0x1000 / sizeof(uintptr_t) / 8;
     2616   int              cLeft = RT_ASM_PAGE_SIZE / sizeof(uintptr_t) / 8;
    26042617   Assert(!((uintptr_t)pvPage & 15));
    26052618   for (;;)
     
    27372750
    27382751    /* the pages in between pages. */
    2739     while (cbBuf > /*PAGE_SIZE*/0x1000)
     2752    while (cbBuf > RT_ASM_PAGE_SIZE)
    27402753    {
    27412754        ASMProbeReadByte(pu8);
    2742         cbBuf -= /*PAGE_SIZE*/0x1000;
    2743         pu8   += /*PAGE_SIZE*/0x1000;
     2755        cbBuf -= RT_ASM_PAGE_SIZE;
     2756        pu8   += RT_ASM_PAGE_SIZE;
    27442757    }
    27452758
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