Lines Matching defs:mem
100 static inline u4* getBlockHeader(void* mem)
102 return ((u4*) mem) -1;
401 void* mem = dvmLinearAlloc(classLoader, len+1);
402 memcpy(mem, str, len+1);
404 dvmLinearSetReadOnly(classLoader, mem);
405 return (char*) mem;
417 void* dvmLinearRealloc(Object* classLoader, void* mem, size_t newSize)
420 return realloc(mem, newSize);
422 /* make sure we have the right region (and mem != NULL) */
423 assert(mem != NULL);
424 assert(mem >= (void*) getHeader(classLoader)->mapAddr &&
425 mem < (void*) (getHeader(classLoader)->mapAddr +
428 const u4* pLen = getBlockHeader(mem);
434 dvmLinearSetReadWrite(classLoader, mem);
435 return mem;
442 memcpy(newMem, mem, *pLen);
443 dvmLinearFree(classLoader, mem);
452 static void updatePages(Object* classLoader, void* mem, int direction)
458 assert(mem >= (void*) pHdr->mapAddr &&
459 mem < (void*) (pHdr->mapAddr + pHdr->curOffset));
461 u4* pLen = getBlockHeader(mem);
466 lastPage = ((u1*)mem - (u1*)pHdr->mapAddr + (len-1)) / SYSTEM_PAGE_SIZE;
483 LOGW("Double RO on %p", mem);
518 LOGW("Double RW on %p", mem);
536 void dvmLinearSetReadOnly(Object* classLoader, void* mem)
541 updatePages(classLoader, mem, -1);
545 * Make the pages on which "mem" sits read-write.
552 void dvmLinearSetReadWrite(Object* classLoader, void* mem)
557 updatePages(classLoader, mem, 1);
563 void dvmLinearFree(Object* classLoader, void* mem)
566 free(mem);
569 if (mem == NULL)
573 assert(mem >= (void*) getHeader(classLoader)->mapAddr &&
574 mem < (void*) (getHeader(classLoader)->mapAddr +
578 dvmLinearSetReadWrite(classLoader, mem);
580 u4* pLen = getBlockHeader(mem);
584 dvmLinearSetReadOnly(classLoader, mem);