VirtualBox

Changeset 27283 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Mar 11, 2010 1:42:56 PM (15 years ago)
Author:
vboxsync
Message:

tstRTMemEf.cpp: Use ASMProbeReadByte to prob without optimizer interference.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/testcase/tstRTMemEf.cpp

    r27270 r27283  
    3333*******************************************************************************/
    3434#include <iprt/mem.h>
     35
     36#include <iprt/asm.h>
     37#include <iprt/initterm.h>
    3538#include <iprt/stream.h>
    36 #include <iprt/initterm.h>
    3739#include <iprt/string.h>
    3840
     
    4648static int tstMemAllocEfAccess()
    4749{
    48     char sz[1];
    49     int32_t v;
    50 
    5150    /* Trivial alloc fence test - allocate a single word and access both
    5251     * the word after the allocated block and the word before. One of them
     
    5554    RTPrintf("tstRTMemAllocEfAccess: allocated int32_t at %#p\n", p);
    5655    RTPrintf("tstRTMemAllocEfAccess: triggering buffer overrun...\n");
    57     v = *(p + 1);
    58     /* Dummy use of v so that the compiler cannot optimize it out */
    59     RTStrPrintf(sz, 0, "", v);
     56    ASMProbeReadByte(p + 1);
    6057    RTPrintf("tstRTMemAllocEfAccess: triggering buffer underrun...\n");
    61     v = *(p - 1);
    62     /* Dummy use of v so that the compiler cannot optimize it out */
    63     RTStrPrintf(sz, 0, "", v);
     58    ASMProbeReadByte((char *)p - 1);
    6459
    6560    /* Reaching this is a severe error. */
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