1 /* Test proper lookup-uncaching of large objects */
15 #define MAP_ANONYMOUS MAP_ANON
18 volatile unsigned char *p;
19 unsigned num = getpagesize ();
23 /* Get a bit of usable address space. We really want an 2**N+1-sized object,
24 so the low/high addresses wrap when hashed into the lookup cache. So we
25 will manually unregister the entire mmap, then re-register a slice. */
26 p = mmap (NULL, num, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
29 /* Now unregister it, as if munmap was called. But don't actually munmap, so
30 we can write into the memory. */
31 __mf_unregister ((void *) p, num, __MF_TYPE_HEAP_I);
33 /* Now register it under a slightly inflated, 2**N+1 size. */
34 __mf_register ((void *) p, num+1, __MF_TYPE_HEAP_I, "fake mmap registration");
36 /* Traverse array to ensure that entire lookup cache is made to point at it. */
40 /* Unregister it. This should clear the entire lookup cache, even though
41 hash(low) == hash (high) (and probably == 0) */
42 __mf_unregister ((void *) p, num+1, __MF_TYPE_HEAP_I);
44 /* Now touch the middle portion of the ex-array. If the lookup cache was
45 well and truly cleaned, then this access should trap. */
53 /* { dg-output "mudflap violation 1.*check/write.*" } */
54 /* { dg-output "Nearby object 1.*" } */
55 /* { dg-output "mudflap dead object.*fake mmap registration.*" } */
56 /* { dg-do run { xfail *-*-* } } */