+#else
+#pragma unused(zone, element)
+#endif
+}
+
+#if ZALLOC_ENABLE_POISONING
+__abortlike static void
+zcache_validation_panic(zone_t zone, vm_offset_t *primary, vm_offset_t *backup,
+ vm_offset_t permutation)
+{
+ vm_offset_t primary_value = 0;
+ vm_offset_t backup_value = 0;
+
+ if (permutation == zcache_canary) {
+ primary_value = *primary ^ (vm_offset_t)primary;
+ backup_value = *backup ^ (vm_offset_t)primary;
+ permutation = permutation ^ (vm_offset_t)primary;
+ } else {
+ primary_value = *primary;
+ backup_value = *backup;
+ }
+ if (primary_value != permutation) {
+ panic("Zone cache element was used after free! Element %p was corrupted at "
+ "beginning; Expected 0x%lx but found 0x%lx; canary 0x%lx; zone %p (%s%s)",
+ primary, (uintptr_t) permutation, (uintptr_t) *primary, zcache_canary, zone,
+ zone_heap_name(zone), zone->z_name);
+ } else {
+ panic("Zone cache element was used after free! Element %p was corrupted at end; "
+ "Expected 0x%lx but found 0x%lx; canary 0x%lx; zone %p (%s%s)",
+ primary, (uintptr_t) permutation, (uintptr_t) *backup, zcache_canary, zone,
+ zone_heap_name(zone), zone->z_name);
+ }