Chameleon

Chameleon Svn Source Tree

Root/branches/rewrite/i386/include/mach/vm_statistics.h

Source at commit 1146 created 12 years 11 months ago.
By azimutz, Sync with trunk (r1145). Add nVidia dev id's, 0DF4 for "GeForce GT 450M" (issue 99) and 1251 for "GeForce GTX 560M" (thanks to oSxFr33k for testing).
1/*
2 * Copyright (c) 2000-2009 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 * @OSF_COPYRIGHT@
30 */
31/*
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
34 * All Rights Reserved.
35 *
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
41 *
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56/*
57 */
58/*
59 *File:mach/vm_statistics.h
60 *Author:Avadis Tevanian, Jr., Michael Wayne Young, David Golub
61 *
62 *Virtual memory statistics structure.
63 *
64 */
65
66#ifndef_MACH_VM_STATISTICS_H_
67#define_MACH_VM_STATISTICS_H_
68
69#include <mach/machine/vm_types.h>
70
71
72/*
73 * vm_statistics
74 *
75 * History:
76 *rev0 - original structure.
77 *rev1 - added purgable info (purgable_count and purges).
78 *rev2 - added speculative_count.
79 *
80 * Note: you cannot add any new fields to this structure. Add them below in
81 * vm_statistics64.
82 */
83
84struct vm_statistics {
85natural_tfree_count;/* # of pages free */
86natural_tactive_count;/* # of pages active */
87natural_tinactive_count;/* # of pages inactive */
88natural_twire_count;/* # of pages wired down */
89natural_tzero_fill_count;/* # of zero fill pages */
90natural_treactivations;/* # of pages reactivated */
91natural_tpageins;/* # of pageins */
92natural_tpageouts;/* # of pageouts */
93natural_tfaults;/* # of faults */
94natural_tcow_faults;/* # of copy-on-writes */
95natural_tlookups;/* object cache lookups */
96natural_thits;/* object cache hits */
97
98/* added for rev1 */
99natural_tpurgeable_count;/* # of pages purgeable */
100natural_tpurges;/* # of pages purged */
101
102/* added for rev2 */
103/*
104 * NB: speculative pages are already accounted for in "free_count",
105 * so "speculative_count" is the number of "free" pages that are
106 * used to hold data that was read speculatively from disk but
107 * haven't actually been used by anyone so far.
108 */
109natural_tspeculative_count;/* # of pages speculative */
110};
111
112/* Used by all architectures */
113typedef struct vm_statistics*vm_statistics_t;
114typedef struct vm_statisticsvm_statistics_data_t;
115
116#if defined(__ppc__) /* On ppc, vm statistics are still 32-bit */
117
118typedef struct vm_statistics*vm_statistics64_t;
119typedef struct vm_statisticsvm_statistics64_data_t;
120
121#define VM_STATISTICS_TRUNCATE_TO_32_BIT(value) value
122
123#else /* !(defined(__ppc__)) */
124
125/*
126 * vm_statistics64
127 *
128 * History:
129 *rev0 - original structure.
130 *rev1 - added purgable info (purgable_count and purges).
131 *rev2 - added speculative_count.
132 * ----
133 *rev3 - changed name to vm_statistics64.
134 *changed some fields in structure to 64-bit on
135 *arm, i386 and x86_64 architectures.
136 *
137 */
138
139struct vm_statistics64 {
140natural_tfree_count;/* # of pages free */
141natural_tactive_count;/* # of pages active */
142natural_tinactive_count;/* # of pages inactive */
143natural_twire_count;/* # of pages wired down */
144uint64_tzero_fill_count;/* # of zero fill pages */
145uint64_treactivations;/* # of pages reactivated */
146uint64_tpageins;/* # of pageins */
147uint64_tpageouts;/* # of pageouts */
148uint64_tfaults;/* # of faults */
149uint64_tcow_faults;/* # of copy-on-writes */
150uint64_tlookups;/* object cache lookups */
151uint64_thits;/* object cache hits */
152
153/* added for rev1 */
154uint64_tpurges;/* # of pages purged */
155natural_tpurgeable_count;/* # of pages purgeable */
156
157/* added for rev2 */
158/*
159 * NB: speculative pages are already accounted for in "free_count",
160 * so "speculative_count" is the number of "free" pages that are
161 * used to hold data that was read speculatively from disk but
162 * haven't actually been used by anyone so far.
163 */
164natural_tspeculative_count;/* # of pages speculative */
165
166}
167#ifdef __arm__
168__attribute__((aligned(8)))
169#endif
170;
171
172typedef struct vm_statistics64*vm_statistics64_t;
173typedef struct vm_statistics64vm_statistics64_data_t;
174
175/*
176 * VM_STATISTICS_TRUNCATE_TO_32_BIT
177 *
178 * This is used by host_statistics() to truncate and peg the 64-bit in-kernel values from
179 * vm_statistics64 to the 32-bit values of the older structure above (vm_statistics).
180 */
181#define VM_STATISTICS_TRUNCATE_TO_32_BIT(value) ((uint32_t)(((value) > UINT32_MAX ) ? UINT32_MAX : (value)))
182
183#endif /* !(defined(__ppc__)) */
184
185
186/* included for the vm_map_page_query call */
187
188#define VM_PAGE_QUERY_PAGE_PRESENT 0x1
189#define VM_PAGE_QUERY_PAGE_FICTITIOUS 0x2
190#define VM_PAGE_QUERY_PAGE_REF 0x4
191#define VM_PAGE_QUERY_PAGE_DIRTY 0x8
192#define VM_PAGE_QUERY_PAGE_PAGED_OUT 0x10
193#define VM_PAGE_QUERY_PAGE_COPIED 0x20
194#define VM_PAGE_QUERY_PAGE_SPECULATIVE0x40
195#define VM_PAGE_QUERY_PAGE_EXTERNAL0x80
196#define VM_PAGE_QUERY_PAGE_CS_VALIDATED0x100
197#define VM_PAGE_QUERY_PAGE_CS_TAINTED0x200
198
199
200/*
201 * VM allocation flags:
202 *
203 * VM_FLAGS_FIXED
204 * (really the absence of VM_FLAGS_ANYWHERE)
205 *Allocate new VM region at the specified virtual address, if possible.
206 *
207 * VM_FLAGS_ANYWHERE
208 *Allocate new VM region anywhere it would fit in the address space.
209 *
210 * VM_FLAGS_PURGABLE
211 *Create a purgable VM object for that new VM region.
212 *
213 * VM_FLAGS_NO_PMAP_CHECK
214 *(for DEBUG kernel config only, ignored for other configs)
215 *Do not check that there is no stale pmap mapping for the new VM region.
216 *This is useful for kernel memory allocations at bootstrap when building
217 *the initial kernel address space while some memory is already in use.
218 *
219 * VM_FLAGS_OVERWRITE
220 *The new VM region can replace existing VM regions if necessary
221 *(to be used in combination with VM_FLAGS_FIXED).
222 *
223 * VM_FLAGS_NO_CACHE
224 *Pages brought in to this VM region are placed on the speculative
225 *queue instead of the active queue. In other words, they are not
226 *cached so that they will be stolen first if memory runs low.
227 */
228#define VM_FLAGS_FIXED0x0000
229#define VM_FLAGS_ANYWHERE0x0001
230#define VM_FLAGS_PURGABLE0x0002
231#define VM_FLAGS_NO_CACHE0x0010
232
233/*
234 * VM_FLAGS_SUPERPAGE_MASK
235 *3 bits that specify whether large pages should be used instead of
236 *base pages (!=0), as well as the requested page size.
237 */
238#define VM_FLAGS_SUPERPAGE_MASK0x70000/* bits 0x10000, 0x20000, 0x40000 */
239#define VM_FLAGS_SUPERPAGE_SHIFT 16
240
241#define SUPERPAGE_NONE0/* no superpages, if all bits are 0 */
242#define VM_FLAGS_SUPERPAGE_NONE(SUPERPAGE_NONE<<VM_FLAGS_SUPERPAGE_SHIFT)
243#if defined(__x86_64__) || !defined(KERNEL)
244#define SUPERPAGE_SIZE_2MB1
245#define VM_FLAGS_SUPERPAGE_SIZE_2MB(SUPERPAGE_SIZE_2MB<<VM_FLAGS_SUPERPAGE_SHIFT)
246#endif
247
248#define VM_FLAGS_ALIAS_MASK0xFF000000
249#define VM_GET_FLAGS_ALIAS(flags, alias)\
250(alias) = ((flags) & VM_FLAGS_ALIAS_MASK) >> 24
251#define VM_SET_FLAGS_ALIAS(flags, alias)\
252(flags) = (((flags) & ~VM_FLAGS_ALIAS_MASK) |\
253(((alias) & ~VM_FLAGS_ALIAS_MASK) << 24))
254
255/* These are the flags that we accept from user-space */
256#define VM_FLAGS_USER_ALLOCATE(VM_FLAGS_FIXED |\
257 VM_FLAGS_ANYWHERE |\
258 VM_FLAGS_PURGABLE |\
259 VM_FLAGS_NO_CACHE |\
260 VM_FLAGS_SUPERPAGE_MASK |\
261 VM_FLAGS_ALIAS_MASK)
262#define VM_FLAGS_USER_MAPVM_FLAGS_USER_ALLOCATE
263
264#define VM_MEMORY_MALLOC 1
265#define VM_MEMORY_MALLOC_SMALL 2
266#define VM_MEMORY_MALLOC_LARGE 3
267#define VM_MEMORY_MALLOC_HUGE 4
268#define VM_MEMORY_SBRK 5// uninteresting -- no one should call
269#define VM_MEMORY_REALLOC 6
270#define VM_MEMORY_MALLOC_TINY 7
271#define VM_MEMORY_MALLOC_LARGE_REUSABLE 8
272#define VM_MEMORY_MALLOC_LARGE_REUSED 9
273
274#define VM_MEMORY_ANALYSIS_TOOL 10
275
276#define VM_MEMORY_MACH_MSG 20
277#define VM_MEMORY_IOKIT21
278#define VM_MEMORY_STACK 30
279#define VM_MEMORY_GUARD 31
280#defineVM_MEMORY_SHARED_PMAP 32
281/* memory containing a dylib */
282#define VM_MEMORY_DYLIB33
283#define VM_MEMORY_OBJC_DISPATCHERS 34
284
285// Placeholders for now -- as we analyze the libraries and find how they
286// use memory, we can make these labels more specific.
287#define VM_MEMORY_APPKIT 40
288#define VM_MEMORY_FOUNDATION 41
289#define VM_MEMORY_COREGRAPHICS 42
290#define VM_MEMORY_CARBON 43
291#define VM_MEMORY_JAVA 44
292#define VM_MEMORY_ATS 50
293#define VM_MEMORY_LAYERKIT 51
294#define VM_MEMORY_CGIMAGE 52
295#define VM_MEMORY_TCMALLOC 53
296
297/* private raster data (i.e. layers, some images, QGL allocator) */
298#defineVM_MEMORY_COREGRAPHICS_DATA54
299
300/* shared image and font caches */
301#define VM_MEMORY_COREGRAPHICS_SHARED55
302
303/* Memory used for virtual framebuffers, shadowing buffers, etc... */
304#defineVM_MEMORY_COREGRAPHICS_FRAMEBUFFERS56
305
306/* Window backing stores, custom shadow data, and compressed backing stores */
307#define VM_MEMORY_COREGRAPHICS_BACKINGSTORES57
308
309/* catch-all for other uses, such as the read-only shared data page */
310#define VM_MEMORY_COREGRAPHICS_MISC VM_MEMORY_COREGRAPHICS
311
312/* memory allocated by the dynamic loader for itself */
313#define VM_MEMORY_DYLD 60
314/* malloc'd memory created by dyld */
315#define VM_MEMORY_DYLD_MALLOC 61
316
317/* Used for sqlite page cache */
318#define VM_MEMORY_SQLITE 62
319
320/* JavaScriptCore heaps */
321#define VM_MEMORY_JAVASCRIPT_CORE 63
322/* memory allocated for the JIT */
323#define VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR 64
324#define VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE 65
325
326/* memory allocated for GLSL */
327#define VM_MEMORY_GLSL 66
328
329/* Reserve 240-255 for application */
330#define VM_MEMORY_APPLICATION_SPECIFIC_1 240
331#define VM_MEMORY_APPLICATION_SPECIFIC_16 255
332
333#define VM_MAKE_TAG(tag) ((tag) << 24)
334
335#endif/* _MACH_VM_STATISTICS_H_ */
336

Archive Download this file

Revision: 1146