How do I get a pointer to the beginning of a page?
I tried the following to no success:
#define PAGESIZE 4096
bool is_page_aligned(void *p)
{
return !((long int)p & 0xFFF);
}
int main(void)
{
bool res;
void *buffer;
buffer = malloc(PAGESIZE*2);
printf("%p\n", (void *) &buffer);
res = is_page_aligned(&buffer);
fputs(res ? "true\n" : "false\n", stdout);
return 0;
}
I'm trying to mitigate TLB misses. Any possible assistance is greatly appreciated.