/* Create 'base_aligned'; referenced as unaligned by 'privbcb'. */
/* TODO: on-demand loading */
- /* Although we do zeroed-page mapping here we just reserve the linears
- * space by it - all the page will be overriden by shmat(2) afterwards anyway.
+ /* Although we do zeroed-page mapping here we just reserve the linear
+ * space by it.
*/
base_aligned=mmap(
NULL, /* start */
- length_mapped_aligned, /* length */
+ PAGE_SIZE+length_mapped_aligned+PAGE_SIZE, /* length; leading and trailing boundary check pages */
PROT_READ|PROT_WRITE, /* prot; read/write must be possible although write is not guaranteed to be flushed yet */
MAP_PRIVATE|MAP_ANONYMOUS, /* flags */
-1, /* fd; ignored due to MAP_ANONYMOUS */
0); /* offset; ignored due to MAP_ANONYMOUS */
g_assert(base_aligned!=NULL);
+ base_aligned+=PAGE_SIZE;
+ errint=munmap(base_aligned-PAGE_SIZE,PAGE_SIZE); /* unmap leading boundary check page */
+ g_assert(errint==0);
+ errint=munmap(base_aligned+length_mapped_aligned,PAGE_SIZE); /* unmap trailing boundary check page */
+ g_assert(errint==0);
+
/* Create 'PublicBcb'; referenced by 'privbcb'. */
captive_new(PublicBcb);
PublicBcb->NodeTypeCode=CAPTIVE_PUBLIC_BCB_NODETYPECODE;