MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vm_page_bits_clear

Function vm_page_bits_clear

freebsd/vm/vm_page.c:4918–4949  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4916}
4917
4918static inline void
4919vm_page_bits_clear(vm_page_t m, vm_page_bits_t *bits, vm_page_bits_t clear)
4920{
4921
4922#if PAGE_SIZE == 32768
4923 atomic_clear_64((uint64_t *)bits, clear);
4924#elif PAGE_SIZE == 16384
4925 atomic_clear_32((uint32_t *)bits, clear);
4926#elif (PAGE_SIZE == 8192) && defined(atomic_clear_16)
4927 atomic_clear_16((uint16_t *)bits, clear);
4928#elif (PAGE_SIZE == 4096) && defined(atomic_clear_8)
4929 atomic_clear_8((uint8_t *)bits, clear);
4930#else /* PAGE_SIZE <= 8192 */
4931 uintptr_t addr;
4932 int shift;
4933
4934 addr = (uintptr_t)bits;
4935 /*
4936 * Use a trick to perform a 32-bit atomic on the
4937 * containing aligned word, to not depend on the existence
4938 * of atomic_{set, clear}_{8, 16}.
4939 */
4940 shift = addr & (sizeof(uint32_t) - 1);
4941#if BYTE_ORDER == BIG_ENDIAN
4942 shift = (sizeof(uint32_t) - sizeof(vm_page_bits_t) - shift) * NBBY;
4943#else
4944 shift *= NBBY;
4945#endif
4946 addr &= ~(sizeof(uint32_t) - 1);
4947 atomic_clear_32((uint32_t *)addr, clear << shift);
4948#endif /* PAGE_SIZE */
4949}
4950
4951static inline vm_page_bits_t
4952vm_page_bits_swap(vm_page_t m, vm_page_bits_t *bits, vm_page_bits_t newbits)

Callers 3

vm_page_clear_dirty_maskFunction · 0.85
vm_page_set_invalidFunction · 0.85
vm_page_invalidFunction · 0.85

Calls 2

atomic_clear_64Function · 0.50
atomic_clear_32Function · 0.50

Tested by

no test coverage detected