Coarse grained memory allocation, in C.
#include <stdio.h>
static int allocate_mem(unsigned long size_in_bytes, unsigned long flags,
void **virt_addr)
{
int r;
return r;
*virt_addr = 0;
flags & L4RE_MA_SUPER_PAGES
{
return r;
}
return 0;
}
static int free_mem(void *virt_addr)
{
int r;
return r;
return 0;
}
int main(void)
{
void *virt;
return 1;
printf("Allocated memory.\n");
printf("Touched memory.\n");
if (free_mem(virt))
return 2;
printf("Freed and done. Bye.\n");
return 0;
}