Hallo, dies ist ein Test.
PWD: /www/data-lst1/unixsoft/unixsoft/kaempfer/.public_html
Running in File Mode
Relative path: ./../../../../../../usr/include/goa-1.0/../uadi_impl.h
Real path: /usr/include/uadi_impl.h
Zurück
/* * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. */ /* * Implementation-specific declarations for uadi (umem adi), which enables * Application Data Integrity in umem. These * functions are no-ops if the machine does not support ADI or uadi is * disabled. This interface is private to uadi and umem. */ #ifndef _UADI_IMPL_H #define _UADI_IMPL_H #include <sys/int_limits.h> /* UINT16_MAX */ #include <uadi.h> #include <adi.h> #include <sys/types.h> #ifdef __cplusplus extern "C" { #endif #if !defined(_KMDB) #if defined(__sparcv9) #define ADI_ADDR_BITS 64 #define ADI_NBITS 4 #define ADI_VER_MASK ((1 << ADI_NBITS) - 1) #define ADI_ADDR_MASK (~0UL >> ADI_NBITS) #define ADI_BLKSZ 64 #define ADI_SET_PTR_VER(addr, ver) \ ((void *)(((uintptr_t)ver << (ADI_ADDR_BITS - ADI_NBITS)) \ | (((uintptr_t)addr << ADI_NBITS) >> ADI_NBITS))) /* * uadi_set_free_version_addr() relies on "normalized" addresses having * a version of zero, even if this isn't strictly speaking the actual * definition of a normalized address. */ #define ADI_NORMALIZE_ADDR(addr) \ ((void *)(((intptr_t)(addr) << ADI_NBITS) >> ADI_NBITS)) #define ADI_GET_PTR_VER(addr) \ ((int)(((uintptr_t)(addr) >> (ADI_ADDR_BITS - ADI_NBITS)) & \ ADI_VER_MASK)) #define UADI_GET_ALIGN(cp) ((cp->cache_flags & UMF_ADI) ? \ MAX(cp->cache_align, ADI_BLKSZ) : cp->cache_align) #define UADI_GET_MAG_VER(round) \ ((uintptr_t)(round) & ADI_VER_MASK) /* * Mazagine round's address is cacheline aligned before we use the lower 4 bits * to store an ADI version. */ #define UADI_SET_MAG_VER(round, ver) \ ((void *)(((uintptr_t)(round) & ~ADI_VER_MASK) | (ver))) #else /* __sparcv9 */ #define ADI_SET_PTR_VER(addr, ver) (addr) #define ADI_NORMALIZE_ADDR(addr) (addr) #define ADI_GET_PTR_VER(addr) (0) #define UADI_GET_ALIGN(cp) (cp->cache_align) #define UADI_GET_MAG_VER(round) ((uintptr_t)(round)) #define UADI_SET_MAG_VER(round, ver) ((void *)(round)) #endif /* __sparcv9 */ #endif /* _KMDB */ /* The ADI version assigned to freed memory. */ #define UADI_VER_FREE 1 #define UADI_VER_ALLOC_MIN (UADI_VER_FREE + 1) #define UADI_VERMAP_PACK(vermap, i, ver) \ ((vermap) | ((uint64_t)(ver) << ((i) * ADI_NBITS))) #define UADI_VERMAP_NEXT(vermap, old_ver) \ (((vermap) >> ((old_ver) * ADI_NBITS)) & ADI_VER_MASK) /* * Each umem buffer is assigned an initial allocated ADI version when it's * allocated from the slab layer. To ensure even distribution of versions * across objects, remember the next version to assign in the * umem_cache_t-wide version map. This describes only what happens the * first time a umem buffer is allocated from the slab layer and has no * bearing on allocation and free from the magazine (per-cpu) layer. * * For caches with multiple buffers per slab, we maintain separate even * and odd version sets for objects an even or odd offset from the * beginning of the slab respectively. Because there are two sets of * versions, we remember the next version to assign for each set * separately. UADI_VERMAP_SET_ODD, for example, stores the last version * assigned to an odd-offset object being allocated from the slab layer * in the umem_cache_t-wide version map for a umem cache. Then, the next * time an odd-offset object from that cache is allocated from the slab * layer, we retrieve the version we saved with UADI_VERMAP_GET_ODD, * index into the version map with this saved version to get a new * version, assign this version to the umem buffer, and store it away with * UADI_VERMAP_SET_ODD. * * For caches in which a single buffer occupies an entire slab, we cycle * through all available allocated versions in succession, so there's only * one set of versions. Instead of needing both UADI_VERMAP_[GS]ET_ODD and * UADI_VERMAP_[GS]ET_EVEN, we just need one pair of GET/SET macros. We * arbitrarily choose to use UADI_VERMAP_[GS]ET_EVEN for these types of * caches. */ #define UADI_VERMAP_EVEN_SHIFT (0 * (ADI_NBITS)) #define UADI_VERMAP_EVEN_MASK (ADI_VER_MASK) #define UADI_VERMAP_GET_EVEN(vermap) \ (((vermap) >> (UADI_VERMAP_EVEN_SHIFT)) & (ADI_VER_MASK)) #define UADI_VERMAP_SET_EVEN(vermap, ver) \ (((vermap) & ~(UADI_VERMAP_EVEN_MASK)) | \ ((uint64_t)(ver) << (UADI_VERMAP_EVEN_SHIFT))) #define UADI_VERMAP_ODD_SHIFT (1 * (ADI_NBITS)) #define UADI_VERMAP_ODD_MASK ((ADI_VER_MASK) << (UADI_VERMAP_ODD_SHIFT)) #define UADI_VERMAP_GET_ODD(vermap) \ (((vermap) >> (UADI_VERMAP_ODD_SHIFT)) & (ADI_VER_MASK)) #define UADI_VERMAP_SET_ODD(vermap, ver) \ (((vermap) & ~(UADI_VERMAP_ODD_MASK)) | \ ((uint64_t)(ver) << (UADI_VERMAP_ODD_SHIFT))) #define UADI_ENCODED_SZ_MAX (UINT16_MAX) extern uint64_t Uadi_vermap; extern uint64_t Uadi_vermap_large; extern int Uadi_max_version; #ifdef __cplusplus } #endif #endif /* _UADI_IMPL_H */