I use this, and it works on all linux platforms so far :)
u8 pMemBuff[CODE_SIZE+4095];
u8 *CodeCache;
.....
//some overcomplicated code
CodeCache = (u8*)(((unat)pMemBuff+PAGE_MASK)& ~PAGE_MASK);
printf("\n\t CodeCache addr: %p | from: %p | addr here: %p\n", CodeCache, pMemBuff, recSh4_Init)...