1 /* 2 * Copyright (c) 2000-2024 Apple Inc. All rights reserved. 3 * 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. The rights granted to you under the License 10 * may not be used to create, or enable the creation or redistribution of, 11 * unlawful or unlicensed copies of an Apple operating system, or to 12 * circumvent, violate, or enable the circumvention or violation of, any 13 * terms of an Apple operating system software license agreement. 14 * 15 * Please obtain a copy of the License at 16 * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 * 18 * The Original Code and all software distributed under the License are 19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 * Please see the License for the specific language governing rights and 24 * limitations under the License. 25 * 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 */ 28 29 #pragma once 30 31 #if PRIVATE 32 33 #include <sys/cdefs.h> 34 #include <mach/machine/kern_return.h> 35 36 37 /* 38 * c_segment_info and c_slot_info are used for output of ### 39 * one c_segment_info is dumped for every c_segment in memory, followed by a number of c_slot_info 40 * Every change to this format should increment the version number in vm_compressor_segments() 41 */ 42 struct c_slot_info { 43 uint32_t csi_size; 44 } __attribute__((packed)); 45 46 struct c_segment_info { 47 uint32_t csi_mysegno; 48 uint32_t csi_creation_ts; 49 uint32_t csi_swappedin_ts; 50 int32_t csi_bytes_unused; 51 int32_t csi_bytes_used; 52 uint32_t csi_populated_offset; 53 54 uint32_t csi_state: 4, 55 csi_swappedin: 1, 56 csi_on_minor_compact_q: 1, 57 csi_has_donated_pages: 1, 58 csi_reserved: 25; 59 int csi_slot_var_array_len;/* max is 1024 so this can be short in needed */ 60 uint32_t csi_decompressions_since_swapin; 61 uint16_t csi_slots_used; 62 uint16_t csi_slots_len; /* count of csi_slots */ 63 struct c_slot_info csi_slots[0]; 64 } __attribute__((packed)); 65 66 #define VM_C_SEGMENT_INFO_MAGIC 'C001' 67 68 /* 69 * vm_map_info_hdr and vm_map_entry_info are used for output of ### 70 * a starting header gives the number of entries that follow, the every entry in the vm_map 71 * is represented by a vm_map_entry_info 72 */ 73 struct vm_map_info_hdr { 74 int vmi_nentries; 75 } __attribute__((packed)); 76 77 struct vm_map_entry_info { 78 vm_map_offset_t vmei_start; /* start address */ 79 vm_map_offset_t vmei_end; /* end address */ 80 unsigned long long 81 /* vm_tag_t */ vmei_alias:12, /* entry VM tag */ 82 /* vm_object_offset_t*/ vmei_offset:(64 - 12); /* offset into object */ 83 uint32_t vmei_is_sub_map: 1, 84 vmei_is_compressor_pager: 1, 85 vmei_protection: 3; 86 uint32_t vmei_slot_mapping_count; 87 int slot_mappings[0]; 88 } __attribute__((packed)); 89 90 #define VM_MAP_ENTRY_INFO_MAGIC 'S001' 91 92 #endif /* PRIVATE */ 93