Hallo, dies ist ein Test.
PWD: /www/data-lst1/unixsoft/unixsoft/kaempfer/.public_html
Running in File Mode
Relative path: ./../../../../../data-stud/../../usr/include/vm/types.h
Real path: /usr/include/vm/types.h
Zurück
/* * Copyright (c) 2012, 2023, Oracle and/or its affiliates. */ #ifndef _VM_TYPES_H #define _VM_TYPES_H #include <sys/types.h> #ifdef __cplusplus extern "C" { #endif /* * Some of the core data types used in the virtual memory system. * This allows function declarations to use pointers to these data types * without requiring every header file to forward-declare the types. */ typedef struct as as_t; /* address space */ typedef struct breadline breadline_t; /* breadline state */ typedef struct cachelist cachelist_t; /* cachelist state */ typedef struct capture capture_t; /* generic capture state */ typedef struct crd crd_t; /* cash register drawer */ typedef struct fakemw fakemw_t; /* legacy mapping window */ typedef struct fed fed_t; /* freelist equity dispenser */ typedef struct fed_history fedh_t; /* fed history */ typedef struct fed_period fedp_t; /* A period of fed history */ typedef struct fhs fhs_t; /* Fed_history summary */ typedef struct flb flb_t; /* freelist bucket */ typedef struct flr flr_t; /* freelist request */ typedef struct flrs flrs_t; /* freelist request state */ typedef struct memgrp memgrp_t; /* memgroup */ typedef struct miter miter_t; /* memory iterator */ typedef struct mnode mnode_t; /* leaf lgrp's memory */ typedef struct mo mo_t; /* memory object */ typedef struct mo_anchor mo_anchor_t; /* global list of MOs */ typedef struct mo_capture mo_capture_t; /* MO capture structure */ typedef struct mo_load_sum mo_load_sum_t; /* summary of mo_load() op */ typedef struct moc_callbacks moc_callbacks_t; /* MO capture callbacks */ typedef struct mvec mvec_t; /* memory multi-vector */ typedef struct mw mw_t; /* mapping window */ typedef struct mw_ops mw_ops_t; /* mapping window ops */ typedef struct offiter offiter_t; /* Offset-space iterator */ typedef struct offiter_intersect offiter_intersect_t; /* intersection */ typedef struct pa_capture pa_capture_t; /* physical address capture */ typedef struct pac_loan pac_loan_t; /* PAC rm_capturing loan */ typedef struct pac_pool pac_pool_t; /* pool of preallocated PACs */ typedef struct pfn_rangeset pfn_rangeset_t; /* set of PFN ranges */ typedef struct physical_constants physical_constants_t; typedef struct psfw psfw_t; /* PSF waiter */ typedef union rm rm_t; /* reverse map entry */ typedef struct rmg rmg_t; /* RM group (mutex, waiters) */ typedef struct rmw rmw_t; /* RM waiter */ typedef struct sac sac_t; /* system available colormap */ typedef struct seg seg_t; /* segment */ typedef struct sgl sgl_t; /* Scatter-gather list */ typedef struct system system_t; /* System information */ typedef struct tcm tcm_t; /* tile / color map */ typedef struct tile tile_t; /* tile specific data */ typedef struct tile_trickle tile_trickle_t; /* tile trickle thread data */ typedef struct tilechunk tilechunk_t; /* tilechunk specific data */ typedef struct tilelet tilelet_t; /* tilelet specific data */ typedef struct tileset tileset_t; /* A set of tiles */ typedef uint16_t tileid_t; /* tileid number */ typedef uint16_t tileletidx_t; /* tilelet index in a tile */ typedef uint32_t tilechunkid_t; /* global tilechunk number */ typedef uint16_t tilechunkidx_t; /* tilechunk index in a tile */ typedef uint32_t tileletid_t; /* (tileid << N) + tileidx */ typedef uint32_t rmgoffset_t; /* RM offset in RMG */ typedef uint8_t mnodeid_t; /* mnode index */ typedef uint8_t szc_t; /* size code */ typedef uint32_t szcmap_t; /* size code bitmap */ typedef uint64_t mnodeset_t; /* mnode ID bitmap */ typedef uint16_t memgrpid_t; /* memgrp index */ typedef uint8_t tl_busy_t; /* tilelet lock flag */ #define TILE_INVALID ((tileid_t)-1) #define TILELET_INVALID ((tileletid_t)-1) #define TILECHUNK_INVALID ((tilechunkid_t)-1) #define MNODEID_INVALID ((mnodeid_t)-1) #define MGID_INVALID ((memgrpid_t)-1) #define MNODESET_EMPTY ((mnodeset_t)0) #define MNODESET_ISEMPTY(set) ((set) == MNODESET_EMPTY) #define MNODESET_FORID(i) (((mnodeset_t)1) << (i)) #define MNODE_INSET(set, id) (((set) & MNODESET_FORID(id)) != 0) #define MNODE_ABOVESET(set, id) /* id is greater than largest mnid in set */ \ ((size_t)(id) >= MAXMNODES || (MNODESET_FORID(id) > (set))) #define MNODESET_LOWEST(set) ((mnodeid_t)(lowbit(set) - 1)) /* * Returns an mnodeset with bits from [i, j) set. Without worrying about * wrap-around, etc, the answer is just: * * MNODESET_FORID(j) - MNODESET_FORID(i) * = (1 << j) - (1 << i) * * But we have to be careful with j, since if it is 64, that will * overflow C shifts, yielding undefined behavior and the wrong answer. * So we compute: * * (1 << j) - (1 << i) * = (1 << (1 + (j - 1))) - (1 << i) * = ((1 << 1) << (j - 1)) - (1 << i) * = (2 << (j - 1)) - (1 << i) * * which works correctly if j == 64, but fails if j == 0. By adding * a "j <= i" check, we know j == 0 cannot occur. */ #define MNODESET_RANGE(i, j) \ (((j) <= (i)) ? 0 : \ ((((mnodeset_t)2) << ((j) - 1)) - MNODESET_FORID(i))) /* * This is the "invalid PFN" that VM2 uses. It is (2^^52 - 1), because that * corresponds to the "invalid PA" of (2^^64 - 1) on a machine with 4K pages * (the smallest page size supported by VM2). As a result, some VM2 data * structures (such as RMs and FLBs) assume that PFNs can fit into 52 bits. */ #define VM2_PFN_INVALID (0x000fffffffffffffULL) /* * A bitmap of memgrp IDs. Each bit set in mgs_idmap[] corresponds to a * memgrp of interest. The bitmap macros BT_TEST, BT_SET, and BT_CLEAR * should be used for bitmap manipulation. * * The mgs_idmap field is a variable-length array. The mgs_alloc field should * be used to indicate the value of "nmg" that was used to allocate the * memgrpset, and the mgs_set field should indicate the number of bits set in * mgs_idmap[]. * * The MEMGRPSET_SIZE(nmg) macro provides the size (in bytes) of a memgrpset * that is large enough to hold "nmg" bits' worth of information in mgs_idmap. */ typedef struct { uint_t mgs_set; /* # nonzero mgs_idmap[] bits */ uint_t mgs_alloc; /* # mgs_idmap[] bits alloc */ ulong_t mgs_idmap[1]; /* variable sized array */ } memgrpset_t; #define MEMGRPSET_SIZE(nmg) \ (offsetof(memgrpset_t, mgs_idmap[BT_BITOUL(nmg)])) /* * The memrange_t is used to describe a range of physical memory. * It is also used for describing memory ranges in suspend images * for kernel zones. If you must change this structure be sure to * implement a new structure for kernel zones that does not change * since suspend images must continue to work across different versions * of Solaris. */ typedef struct { uint64_t mr_pa; /* Starting physical address */ size_t mr_len; /* Length, in bytes */ } memrange_t; /* * pfnranges describe a range of PFNs: [pr_spfn, pr_epfn) */ typedef struct { pfn_t pr_spfn; pfn_t pr_epfn; } pfnrange_t; /* * ------------------------------------------------------------------ * Enumerations for types of things. * * Generally, we only put enums here (as opposed to vm/foo.h) if they are * used by multiple different headers, instead of just vm/foo.h and * vm/foo_impl.h. */ /* many arrays of [2] use these as element numbers */ enum { KU_USER = 0, /* hopefully most pages in the system */ KU_KCAGE = 1, /* pages in the kernel cage */ KU_NTYPES }; typedef uint8_t ku_type_t; /* would be an enum, but they're *signed*. */ typedef enum { FED_CREDIT_USER, /* == KU_USER */ FED_CREDIT_KCAGE, /* == KU_KCAGE */ FED_CREDIT_BORROW, /* for counting fed_borrow_activity */ FED_CREDIT_NTYPES, FED_CREDIT_NALLOC = 4 /* rounded up */ } fed_credit_type_t; /* We track tiles in tilesets of various types */ typedef enum { TS_USER = KU_USER, /* Tiles with KU_USER tilelets */ TS_KCAGE = KU_KCAGE, /* Tiles with KU_KCAGE tilelets */ TS_CAGE_AVAIL = KU_NTYPES, /* Tiles which are TK_AVAIL */ TS_CAGE_GROWING, /* Tiles which are TK_GROWING */ TS_ALL, /* Tiles with valid tilelets */ TS_NTYPES } tileset_type_t; /* We track varying kinds of memgrpsets */ typedef enum { MGS_ALL, /* all known memgrps */ MGS_KCAGE, /* all kcaged-allowed memgrps */ MGS_NTYPES } memgrpset_type_t; /* Types of tracked PFN ranges */ typedef enum { SPR_ACTIVE = 0, /* Memory actively used */ SPR_PLAT_MISSING, /* Memory platform prevents use of */ SPR_FAKEDR, /* Memory fakeDR-ed out */ SPR_NTYPES } syspfnrange_type_t; /* * Per-cpu locks for which a single read lock will keep the resource around * and all of the write locks are needed to remove a resource. * * You are only allowed to hold a single read lock of each type at a time. * Locks of different types must be acquired in the order given by the * enumeration. */ typedef enum { VPC_MEMRANGE_LOCK, /* to keep memranges from being changed */ VPC_TILESET_LOCK, /* to keep tiles in tilesets */ VPC_FLB_LOCK, /* to keep flb's from being remapped */ VPC_LOCK_COUNT /* must be last */ } vpc_locks_t; #define MEMRANGE_WRITELOCK() vpc_writelock(VPC_MEMRANGE_LOCK) #define MEMRANGE_WRITEUNLOCK() vpc_writeunlock(VPC_MEMRANGE_LOCK) #define MEMRANGE_TRYUSE() vpc_tryreadlock(VPC_MEMRANGE_LOCK) #define MEMRANGE_USE() vpc_readlock(VPC_MEMRANGE_LOCK) #define MEMRANGE_DONE(mrlp) vpc_readunlock(VPC_MEMRANGE_LOCK, (mrlp)) #define MEMRANGE_WRITEHELD() vpc_writeheld(VPC_MEMRANGE_LOCK) /* * PA Capture error codes * * Note that these reveal much about the internal implementation of capture. * Most consumers should just rely on the fact that non-zero is failure. */ typedef enum pac_error { PAC_NOERR = 0, /* * Canceled in various ways */ PAC_ERR_SIGINTR, /* canceled by a signal */ PAC_ERR_CANCELED, /* canceled by a pac_cancel() call */ PAC_ERR_TIMEDOUT, /* canceled by hitting a timeout */ /* * Errors allocating the initial capture structure */ PAC_ERR_ALLOC_NOMEM, /* pac_alloc() failed */ PAC_ERR_ALLOC_POOL_NOMEM, /* PAC pool had nothing available */ /* * First pass: Setting rm_capturing bits and establishing the * precise capturing range. */ PAC_ERR_SETBITS_NOMEM, /* tracking structures alloc failed */ PAC_ERR_SETBITS_EXACT_MISALIGN_START, /* PAC_EXACT, but initial address is in the middle of an RM */ PAC_ERR_SETBITS_EXACT_MISALIGN_END, /* PAC_EXACT, but final address is in the middle of an RM */ PAC_ERR_SETBITS_CANNOT_SUCCEED, /* Cannot succeed given the constraints and pages we found */ PAC_ERR_SETBITS_INCOMPLETE, /* PAC_COMPLETE/PAC_ALLFREE, but we could not target whole range */ PAC_ERR_SETBITS_AVAILRMEM_FAILURE, /* PAC_HOLD_AVAILRMEM, not enough availrmem for expanded range */ /* * Pass 2: Capture free pages */ PAC_ERR_CAPTURE_FREE_NOMEM, /* unable to allocate credits for all free pages targeted */ PAC_ERR_CAPTURE_FREE_CANCELED, /* our operation was canceled. */ /* * Pass 3: Capture everything else */ PAC_ERR_CAPTURE_NOMEM, /* Unable to allocate sufficient credits */ PAC_ERR_CAPTURE_MIN_CAPTURED, /* * Capture could not allocate enough credits to guarantee the * capture of the requested number of base pages */ PAC_ERR_CAPTURE_LOOP_NOMEM, /* Unable to allocate sufficient credits later in the loop */ PAC_ERR_CAPTURE_FINAL_INCOMPLETE, /* PAC_COMPLETE specified, but some pages not captured */ PAC_ERR_CAPTURE_FINAL_MIN_CAPTURED, /* Could not capture the requested number of pages */ /* * Timeout was set and capture could not complete before * it expired. */ PAC_ERR_CAPTURE_FINAL_TIMEDOUT, PAC_ERR_MAX /* must be last */ } pac_error_t; /* * These values should be kept in sync with the values of memtype_t, defined in * <sys/memtype.h>. The routine kmemtype_for_memtype() verifies that they are. * * Values greater than KMT_DEFAULT and less than the value returned by * memtype_numtypes() are also valid kmemtype_t values. */ typedef enum { KMT_ANY = -2, /* any memtype can be used */ KMT_INVALID = -1, /* no valid memtype available */ KMT_DEFAULT = 0, /* system's default memory type */ KMT_COUNT = 4 /* max # mem types on any platform */ } kmemtype_t; /* * Requestable memory types. * * Values greater than KRMT_DEFAULT and less than the value returned from * memtype_numrtypes() are also valid krmemtype_t values. */ typedef enum { KRMT_ANY = -2, /* any rtype can be used */ KRMT_INVALID = -1, /* not a valid rtype */ KRMT_DEFAULT = 0, /* KMT_DEFAULT's rtype */ KRMT_COUNT = 2 /* max # rmem types on any platform */ } krmemtype_t; /* * These values should be kept in sync with the values of memattr_t, defined in * <sys/memtype.h>. The routine kmemattr_for_memattr() verifies that they are. */ typedef enum { KMA_INVALID = -1, /* kernel only: invalid attr given */ KMA_SIDE_EFFECT = 0, /* loads/stores have side effects */ KMA_PERSISTENT = 1, /* data persists across poweroff */ KMA_ENCRYPTED = 2, /* how is data encrypted at rest */ KMA_LOAD_LATENCY = 3, /* minimum latency of a load */ KMA_REQUESTABLE = 4, /* can this memtype be requested */ KMA_COUNT = 5 /* max # mem attrs on any platform */ } kmemattr_t; /* * These values should be kept in sync with the values of memattr_encrypt_t, * defined in <sys/memtype.h>. */ typedef enum { KMA_ENCR_NO = 0, /* not encrypted */ KMA_ENCR_TRANSIENT = 1, /* encrypted using random key */ KMA_ENCR_PERSISTENT = 2 /* encrypted using known key */ } kmemattr_encrypt_t; /* * Memory Object Anchor types. * * These values are mixed case so that ::memstat can just use them directly * after stripping off MOA_, and replacing '_' with ' '. * * Memstat does special processing of MOA_Kernel_Special; all other anchors * are recorded using the associated moa_usagetype, set up in mo_init(). */ enum mo_anchor_type { MOA_Unanchored = 0, /* unachored */ MOA_Kernel, /* kernel data */ MOA_Kernel_Special, /* special handling (Kom_mo, Vm1*_mo) */ MOA_Balloon, /* hvm balloon driver */ MOA_Retained, /* memory retained across reboot */ MOA_Retired, /* retired "toxic" pages */ #define MOA_DUMP_CANNOT_USE(_moa) ((size_t)(_moa) <= (size_t)MOA_Retired) MOA_Kernel_Zones, /* segguest memory */ MOA_OSM, /* Optimized Shared Memory */ MOA_vm2_stress, /* vm2_stress MOs */ MOA_Ramdisk, /* ramdisk memory */ MOA_NTYPES }; typedef uint8_t mo_anchor_type_t; /* * Memory usage categories. * * Note: Changing this requires updating Memusage_kstat_data to match. */ typedef enum memory_usage_type { MUT_KERNEL = 0, /* Kernel data; must be 0! */ MUT_ZFS, /* ZFS ARC & kernel data */ MUT_KZ, /* Kernel Zone data */ MUT_VIRTMEM, /* virtual memory (swap) */ MUT_EXECUTABLE, /* program text/data */ MUT_FILEDATA, /* non-prog/text file data */ MUT_UNKNOWN, /* in use, uncertain type */ MUT_CACHED, /* free cached data */ MUT_FREE, /* not in use */ MUT_COUNT } memory_usage_type_t; #ifdef __cplusplus } #endif #endif /* _VM_TYPES_H */