memalign

  #include "malloc.h"
 

    #if 1
    UINT8* pVirAddr = NULL;
    UINT8* pVirAddr2 = NULL;
    pVirAddr = (UINT8*)memalign(getpagesize(),1024*1024);
    if(pVirAddr == NULL)
        KD_LOGD("memalign failed\n");
    else
        KD_LOGD("memalign pVirAddr is %#x\n",pVirAddr);

    pVirAddr2 = NULL;
    pVirAddr2 = (UINT8*)malloc(1024*1024);
    if(pVirAddr2 == NULL)
        KD_LOGD("malloc failed\n");
    else
        KD_LOGD("malloc pVirAddr2 is %#x\n",pVirAddr2);

    *pVirAddr = 0x55;
    KD_LOGD("*pVirAddr = %#x\n",*pVirAddr);
    *pVirAddr2 = 0xAA;    
    KD_LOGD("*pVirAddr2 = %#x\n",*pVirAddr2);
    #endif

 

01:22:34.938: D:[MAIN] memalign pVirAddr is 0x9003d000
01:22:34.938: D:[UPDATE] receive msg is src=1, what=256, arg1=0, arg2=0
01:22:34.938: D:[MAIN] malloc pVirAddr2 is 0x80537010

你可能感兴趣的:(用户态内存操作)