17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5ae115bc7Smrj * Common Development and Distribution License (the "License"). 6ae115bc7Smrj * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22ae115bc7Smrj * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _VM_HTABLE_H 277c478bd9Sstevel@tonic-gate #define _VM_HTABLE_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #ifdef __cplusplus 307c478bd9Sstevel@tonic-gate extern "C" { 317c478bd9Sstevel@tonic-gate #endif 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate #if defined(__GNUC__) && defined(_ASM_INLINES) && defined(_KERNEL) 347c478bd9Sstevel@tonic-gate #include <asm/htable.h> 357c478bd9Sstevel@tonic-gate #endif 367c478bd9Sstevel@tonic-gate 377c478bd9Sstevel@tonic-gate extern void atomic_andb(uint8_t *addr, uint8_t value); 387c478bd9Sstevel@tonic-gate extern void atomic_orb(uint8_t *addr, uint8_t value); 397c478bd9Sstevel@tonic-gate extern void atomic_inc16(uint16_t *addr); 407c478bd9Sstevel@tonic-gate extern void atomic_dec16(uint16_t *addr); 417c478bd9Sstevel@tonic-gate extern void mmu_tlbflush_entry(caddr_t addr); 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gate /* 447c478bd9Sstevel@tonic-gate * Each hardware page table has an htable_t describing it. 457c478bd9Sstevel@tonic-gate * 467c478bd9Sstevel@tonic-gate * We use a reference counter mechanism to detect when we can free an htable. 477c478bd9Sstevel@tonic-gate * In the implmentation the reference count is split into 2 separate counters: 487c478bd9Sstevel@tonic-gate * 497c478bd9Sstevel@tonic-gate * ht_busy is a traditional reference count of uses of the htable pointer 507c478bd9Sstevel@tonic-gate * 517c478bd9Sstevel@tonic-gate * ht_valid_cnt is a count of how references are implied by valid PTE/PTP 527c478bd9Sstevel@tonic-gate * entries in the pagetable 537c478bd9Sstevel@tonic-gate * 547c478bd9Sstevel@tonic-gate * ht_busy is only incremented by htable_lookup() or htable_create() 557c478bd9Sstevel@tonic-gate * while holding the appropriate hash_table mutex. While installing a new 567c478bd9Sstevel@tonic-gate * valid PTE or PTP, in order to increment ht_valid_cnt a thread must have 577c478bd9Sstevel@tonic-gate * done an htable_lookup() or htable_create() but not the htable_release yet. 587c478bd9Sstevel@tonic-gate * 597c478bd9Sstevel@tonic-gate * htable_release(), while holding the mutex, can know that if 607c478bd9Sstevel@tonic-gate * busy == 1 and valid_cnt == 0, the htable can be free'd. 617c478bd9Sstevel@tonic-gate * 627c478bd9Sstevel@tonic-gate * The fields have been ordered to make htable_lookup() fast. Hence, 637c478bd9Sstevel@tonic-gate * ht_hat, ht_vaddr, ht_level and ht_next need to be clustered together. 647c478bd9Sstevel@tonic-gate */ 657c478bd9Sstevel@tonic-gate struct htable { 667c478bd9Sstevel@tonic-gate struct htable *ht_next; /* forward link for hash table */ 677c478bd9Sstevel@tonic-gate struct hat *ht_hat; /* hat this mapping comes from */ 687c478bd9Sstevel@tonic-gate uintptr_t ht_vaddr; /* virt addr at start of this table */ 69ae115bc7Smrj int8_t ht_level; /* page table level: 0=4K, 1=2M, ... */ 70ae115bc7Smrj uint8_t ht_flags; /* see below */ 717c478bd9Sstevel@tonic-gate int16_t ht_busy; /* implements locking protocol */ 727c478bd9Sstevel@tonic-gate int16_t ht_valid_cnt; /* # of valid entries in this table */ 737c478bd9Sstevel@tonic-gate uint32_t ht_lock_cnt; /* # of locked entries in this table */ 747c478bd9Sstevel@tonic-gate /* never used for kernel hat */ 757c478bd9Sstevel@tonic-gate pfn_t ht_pfn; /* pfn of page of the pagetable */ 767c478bd9Sstevel@tonic-gate struct htable *ht_prev; /* backward link for hash table */ 777c478bd9Sstevel@tonic-gate struct htable *ht_parent; /* htable that points to this htable */ 787c478bd9Sstevel@tonic-gate struct htable *ht_shares; /* for HTABLE_SHARED_PFN only */ 797c478bd9Sstevel@tonic-gate }; 807c478bd9Sstevel@tonic-gate typedef struct htable htable_t; 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gate /* 837c478bd9Sstevel@tonic-gate * Flags values for htable ht_flags field: 847c478bd9Sstevel@tonic-gate * 857c478bd9Sstevel@tonic-gate * HTABLE_VLP - this is the top level htable of a VLP HAT. 867c478bd9Sstevel@tonic-gate * 87ae115bc7Smrj * HTABLE_SHARED_PFN - this htable had its PFN assigned from sharing another 887c478bd9Sstevel@tonic-gate * htable. Used by hat_share() for ISM. 897c478bd9Sstevel@tonic-gate */ 90ae115bc7Smrj #define HTABLE_VLP (0x01) 91ae115bc7Smrj #define HTABLE_SHARED_PFN (0x02) 927c478bd9Sstevel@tonic-gate 937c478bd9Sstevel@tonic-gate /* 947c478bd9Sstevel@tonic-gate * The htable hash table hashing function. The 28 is so that high 957c478bd9Sstevel@tonic-gate * order bits are include in the hash index to skew the wrap 967c8868c1Sjosephb * around of addresses. Even though the hash buckets are stored per 977c8868c1Sjosephb * hat we include the value of hat pointer in the hash function so 987c8868c1Sjosephb * that the secondary hash for the htable mutex winds up begin different in 997c8868c1Sjosephb * every address space. 1007c478bd9Sstevel@tonic-gate */ 1017c478bd9Sstevel@tonic-gate #define HTABLE_HASH(hat, va, lvl) \ 1027c8868c1Sjosephb ((((va) >> LEVEL_SHIFT(1)) + ((va) >> 28) + (lvl) + \ 1037c8868c1Sjosephb ((uintptr_t)(hat) >> 4)) & ((hat)->hat_num_hash - 1)) 1047c478bd9Sstevel@tonic-gate 1057c478bd9Sstevel@tonic-gate /* 1067c478bd9Sstevel@tonic-gate * Each CPU gets a unique hat_cpu_info structure in cpu_hat_info. 1077c478bd9Sstevel@tonic-gate */ 1087c478bd9Sstevel@tonic-gate struct hat_cpu_info { 1097c478bd9Sstevel@tonic-gate kmutex_t hci_mutex; /* mutex to ensure sequential usage */ 1107c478bd9Sstevel@tonic-gate #if defined(__amd64) 1117c478bd9Sstevel@tonic-gate pfn_t hci_vlp_pfn; /* pfn of hci_vlp_l3ptes */ 1127c478bd9Sstevel@tonic-gate x86pte_t *hci_vlp_l3ptes; /* VLP Level==3 pagetable (top) */ 1137c478bd9Sstevel@tonic-gate x86pte_t *hci_vlp_l2ptes; /* VLP Level==2 pagetable */ 1147c478bd9Sstevel@tonic-gate #endif /* __amd64 */ 1157c478bd9Sstevel@tonic-gate }; 1167c478bd9Sstevel@tonic-gate 1177c478bd9Sstevel@tonic-gate 1187c478bd9Sstevel@tonic-gate /* 1197c478bd9Sstevel@tonic-gate * Compute the last page aligned VA mapped by an htable. 1207c478bd9Sstevel@tonic-gate * 1217c478bd9Sstevel@tonic-gate * Given a va and a level, compute the virtual address of the start of the 1227c478bd9Sstevel@tonic-gate * next page at that level. 1237c478bd9Sstevel@tonic-gate * 1247c478bd9Sstevel@tonic-gate * XX64 - The check for the VA hole needs to be better generalized. 1257c478bd9Sstevel@tonic-gate */ 1267c478bd9Sstevel@tonic-gate #if defined(__amd64) 127843e1988Sjohnlev #define HTABLE_NUM_PTES(ht) (((ht)->ht_flags & HTABLE_VLP) ? 4 : 512) 1287c478bd9Sstevel@tonic-gate 1297c478bd9Sstevel@tonic-gate #define HTABLE_LAST_PAGE(ht) \ 1307c478bd9Sstevel@tonic-gate ((ht)->ht_level == mmu.max_level ? ((uintptr_t)0UL - MMU_PAGESIZE) :\ 1317c478bd9Sstevel@tonic-gate ((ht)->ht_vaddr - MMU_PAGESIZE + \ 132ae115bc7Smrj ((uintptr_t)HTABLE_NUM_PTES(ht) << LEVEL_SHIFT((ht)->ht_level)))) 1337c478bd9Sstevel@tonic-gate 1347c478bd9Sstevel@tonic-gate #define NEXT_ENTRY_VA(va, l) \ 1357c478bd9Sstevel@tonic-gate ((va & LEVEL_MASK(l)) + LEVEL_SIZE(l) == mmu.hole_start ? \ 1367c478bd9Sstevel@tonic-gate mmu.hole_end : (va & LEVEL_MASK(l)) + LEVEL_SIZE(l)) 1377c478bd9Sstevel@tonic-gate 1387c478bd9Sstevel@tonic-gate #elif defined(__i386) 1397c478bd9Sstevel@tonic-gate 140843e1988Sjohnlev #define HTABLE_NUM_PTES(ht) \ 141843e1988Sjohnlev (!mmu.pae_hat ? 1024 : ((ht)->ht_level == 2 ? 4 : 512)) 142ae115bc7Smrj 1437c478bd9Sstevel@tonic-gate #define HTABLE_LAST_PAGE(ht) ((ht)->ht_vaddr - MMU_PAGESIZE + \ 144ae115bc7Smrj ((uintptr_t)HTABLE_NUM_PTES(ht) << LEVEL_SHIFT((ht)->ht_level))) 1457c478bd9Sstevel@tonic-gate 1467c478bd9Sstevel@tonic-gate #define NEXT_ENTRY_VA(va, l) ((va & LEVEL_MASK(l)) + LEVEL_SIZE(l)) 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gate #endif 1497c478bd9Sstevel@tonic-gate 1507c478bd9Sstevel@tonic-gate #if defined(_KERNEL) 1517c478bd9Sstevel@tonic-gate 1527c478bd9Sstevel@tonic-gate /* 1537c478bd9Sstevel@tonic-gate * initialization function called from hat_init() 1547c478bd9Sstevel@tonic-gate */ 1557c478bd9Sstevel@tonic-gate extern void htable_init(void); 1567c478bd9Sstevel@tonic-gate 1577c478bd9Sstevel@tonic-gate /* 1587c478bd9Sstevel@tonic-gate * Functions to lookup, or "lookup and create", the htable corresponding 1597c478bd9Sstevel@tonic-gate * to the virtual address "vaddr" in the "hat" at the given "level" of 1607c478bd9Sstevel@tonic-gate * page tables. htable_lookup() may return NULL if no such entry exists. 1617c478bd9Sstevel@tonic-gate * 1627c478bd9Sstevel@tonic-gate * On return the given htable is marked busy (a shared lock) - this prevents 1637c478bd9Sstevel@tonic-gate * the htable from being stolen or freed) until htable_release() is called. 1647c478bd9Sstevel@tonic-gate * 1657c478bd9Sstevel@tonic-gate * If kalloc_flag is set on an htable_create() we can't call kmem allocation 1667c478bd9Sstevel@tonic-gate * routines for this htable, since it's for the kernel hat itself. 1677c478bd9Sstevel@tonic-gate * 1687c478bd9Sstevel@tonic-gate * htable_acquire() is used when an htable pointer has been extracted from 1697c478bd9Sstevel@tonic-gate * an hment and we need to get a reference to the htable. 1707c478bd9Sstevel@tonic-gate */ 1717c478bd9Sstevel@tonic-gate extern htable_t *htable_lookup(struct hat *hat, uintptr_t vaddr, level_t level); 1727c478bd9Sstevel@tonic-gate extern htable_t *htable_create(struct hat *hat, uintptr_t vaddr, level_t level, 1737c478bd9Sstevel@tonic-gate htable_t *shared); 1747c478bd9Sstevel@tonic-gate extern void htable_acquire(htable_t *); 1757c478bd9Sstevel@tonic-gate 1767c478bd9Sstevel@tonic-gate extern void htable_release(htable_t *ht); 177ae115bc7Smrj extern void htable_destroy(htable_t *ht); 1787c478bd9Sstevel@tonic-gate 1797c478bd9Sstevel@tonic-gate /* 1807c478bd9Sstevel@tonic-gate * Code to free all remaining htables for a hat. Called after the hat is no 1817c478bd9Sstevel@tonic-gate * longer in use by any thread. 1827c478bd9Sstevel@tonic-gate */ 1837c478bd9Sstevel@tonic-gate extern void htable_purge_hat(struct hat *hat); 1847c478bd9Sstevel@tonic-gate 1857c478bd9Sstevel@tonic-gate /* 1867c478bd9Sstevel@tonic-gate * Find the htable, page table entry index, and PTE of the given virtual 1877c478bd9Sstevel@tonic-gate * address. If not found returns NULL. When found, returns the htable_t *, 1887c478bd9Sstevel@tonic-gate * sets entry, and has a hold on the htable. 1897c478bd9Sstevel@tonic-gate */ 1907c478bd9Sstevel@tonic-gate extern htable_t *htable_getpte(struct hat *, uintptr_t, uint_t *, x86pte_t *, 1917c478bd9Sstevel@tonic-gate level_t); 1927c478bd9Sstevel@tonic-gate 1937c478bd9Sstevel@tonic-gate /* 1947c478bd9Sstevel@tonic-gate * Similar to hat_getpte(), except that this only succeeds if a valid 1957c478bd9Sstevel@tonic-gate * page mapping is present. 1967c478bd9Sstevel@tonic-gate */ 1977c478bd9Sstevel@tonic-gate extern htable_t *htable_getpage(struct hat *hat, uintptr_t va, uint_t *entry); 1987c478bd9Sstevel@tonic-gate 1997c478bd9Sstevel@tonic-gate /* 2007c478bd9Sstevel@tonic-gate * Called to allocate initial/additional htables for reserve. 2017c478bd9Sstevel@tonic-gate */ 2027c478bd9Sstevel@tonic-gate extern void htable_initial_reserve(uint_t); 2037c478bd9Sstevel@tonic-gate extern void htable_reserve(uint_t); 2047c478bd9Sstevel@tonic-gate 2057c478bd9Sstevel@tonic-gate /* 2067c478bd9Sstevel@tonic-gate * Used to readjust the htable reserve after the reserve list has been used. 2077c478bd9Sstevel@tonic-gate * Also called after boot to release left over boot reserves. 2087c478bd9Sstevel@tonic-gate */ 2097c478bd9Sstevel@tonic-gate extern void htable_adjust_reserve(void); 2107c478bd9Sstevel@tonic-gate 2117c478bd9Sstevel@tonic-gate /* 212843e1988Sjohnlev * return number of bytes mapped by all the htables in a given hat 213843e1988Sjohnlev */ 214843e1988Sjohnlev extern size_t htable_mapped(struct hat *); 215843e1988Sjohnlev 216843e1988Sjohnlev 217843e1988Sjohnlev /* 218ae115bc7Smrj * Attach initial pagetables as htables 219ae115bc7Smrj */ 220ae115bc7Smrj extern void htable_attach(struct hat *, uintptr_t, level_t, struct htable *, 221ae115bc7Smrj pfn_t); 222ae115bc7Smrj 223ae115bc7Smrj /* 2247c478bd9Sstevel@tonic-gate * Routine to find the next populated htable at or above a given virtual 2257c478bd9Sstevel@tonic-gate * address. Can specify an upper limit, or HTABLE_WALK_TO_END to indicate 2267c478bd9Sstevel@tonic-gate * that it should search the entire address space. Similar to 2277c478bd9Sstevel@tonic-gate * hat_getpte(), but used for walking through address ranges. It can be 2287c478bd9Sstevel@tonic-gate * used like this: 2297c478bd9Sstevel@tonic-gate * 2307c478bd9Sstevel@tonic-gate * va = ... 2317c478bd9Sstevel@tonic-gate * ht = NULL; 2327c478bd9Sstevel@tonic-gate * while (va < end_va) { 2337c478bd9Sstevel@tonic-gate * pte = htable_walk(hat, &ht, &va, end_va); 2347c478bd9Sstevel@tonic-gate * if (!pte) 2357c478bd9Sstevel@tonic-gate * break; 2367c478bd9Sstevel@tonic-gate * 2377c478bd9Sstevel@tonic-gate * ... code to operate on page at va ... 2387c478bd9Sstevel@tonic-gate * 2397c478bd9Sstevel@tonic-gate * va += LEVEL_SIZE(ht->ht_level); 2407c478bd9Sstevel@tonic-gate * } 2417c478bd9Sstevel@tonic-gate * if (ht) 2427c478bd9Sstevel@tonic-gate * htable_release(ht); 2437c478bd9Sstevel@tonic-gate * 2447c478bd9Sstevel@tonic-gate */ 2457c478bd9Sstevel@tonic-gate extern x86pte_t htable_walk(struct hat *hat, htable_t **ht, uintptr_t *va, 2467c478bd9Sstevel@tonic-gate uintptr_t eaddr); 2477c478bd9Sstevel@tonic-gate 2487c478bd9Sstevel@tonic-gate #define HTABLE_WALK_TO_END ((uintptr_t)-1) 2497c478bd9Sstevel@tonic-gate 2507c478bd9Sstevel@tonic-gate /* 2517c478bd9Sstevel@tonic-gate * Utilities convert between virtual addresses and page table entry indeces. 2527c478bd9Sstevel@tonic-gate */ 2537c478bd9Sstevel@tonic-gate extern uint_t htable_va2entry(uintptr_t va, htable_t *ht); 2547c478bd9Sstevel@tonic-gate extern uintptr_t htable_e2va(htable_t *ht, uint_t entry); 2557c478bd9Sstevel@tonic-gate 2567c478bd9Sstevel@tonic-gate /* 2577c478bd9Sstevel@tonic-gate * Interfaces that provide access to page table entries via the htable. 2587c478bd9Sstevel@tonic-gate * 2597c478bd9Sstevel@tonic-gate * Note that all accesses except x86pte_copy() and x86pte_zero() are atomic. 2607c478bd9Sstevel@tonic-gate */ 261ae115bc7Smrj extern void x86pte_cpu_init(cpu_t *); 262ae115bc7Smrj extern void x86pte_cpu_fini(cpu_t *); 2637c478bd9Sstevel@tonic-gate 2647c478bd9Sstevel@tonic-gate extern x86pte_t x86pte_get(htable_t *, uint_t entry); 2657c478bd9Sstevel@tonic-gate 266ae115bc7Smrj /* 267ae115bc7Smrj * x86pte_set returns LPAGE_ERROR if it's asked to overwrite a page table 268ae115bc7Smrj * link with a large page mapping. 269ae115bc7Smrj */ 270ae115bc7Smrj #define LPAGE_ERROR (-(x86pte_t)1) 2717c478bd9Sstevel@tonic-gate extern x86pte_t x86pte_set(htable_t *, uint_t entry, x86pte_t new, void *); 2727c478bd9Sstevel@tonic-gate 273ae115bc7Smrj extern x86pte_t x86pte_inval(htable_t *ht, uint_t entry, 274ae115bc7Smrj x86pte_t old, x86pte_t *ptr); 2757c478bd9Sstevel@tonic-gate 2767c478bd9Sstevel@tonic-gate extern x86pte_t x86pte_update(htable_t *ht, uint_t entry, 2777c478bd9Sstevel@tonic-gate x86pte_t old, x86pte_t new); 2787c478bd9Sstevel@tonic-gate 2797c478bd9Sstevel@tonic-gate extern void x86pte_copy(htable_t *src, htable_t *dest, uint_t entry, 2807c478bd9Sstevel@tonic-gate uint_t cnt); 2817c478bd9Sstevel@tonic-gate 282ae115bc7Smrj /* 283ae115bc7Smrj * access to a pagetable knowing only the pfn 284ae115bc7Smrj */ 285ae115bc7Smrj extern x86pte_t *x86pte_mapin(pfn_t, uint_t, htable_t *); 286ae115bc7Smrj extern void x86pte_mapout(void); 2877c478bd9Sstevel@tonic-gate 2887c478bd9Sstevel@tonic-gate /* 2897c478bd9Sstevel@tonic-gate * these are actually inlines for "lock; incw", "lock; decw", etc. instructions. 2907c478bd9Sstevel@tonic-gate */ 2917c478bd9Sstevel@tonic-gate #define HTABLE_INC(x) atomic_inc16((uint16_t *)&x) 2927c478bd9Sstevel@tonic-gate #define HTABLE_DEC(x) atomic_dec16((uint16_t *)&x) 293*1a5e258fSJosef 'Jeff' Sipek #define HTABLE_LOCK_INC(ht) atomic_inc_32(&(ht)->ht_lock_cnt) 294*1a5e258fSJosef 'Jeff' Sipek #define HTABLE_LOCK_DEC(ht) atomic_dec_32(&(ht)->ht_lock_cnt) 2957c478bd9Sstevel@tonic-gate 296843e1988Sjohnlev #ifdef __xpv 297843e1988Sjohnlev extern void xen_flush_va(caddr_t va); 298843e1988Sjohnlev extern void xen_gflush_va(caddr_t va, cpuset_t); 299843e1988Sjohnlev extern void xen_flush_tlb(void); 300843e1988Sjohnlev extern void xen_gflush_tlb(cpuset_t); 301843e1988Sjohnlev extern void xen_pin(pfn_t, level_t); 302843e1988Sjohnlev extern void xen_unpin(pfn_t); 303843e1988Sjohnlev extern int xen_kpm_page(pfn_t, uint_t); 304843e1988Sjohnlev 305843e1988Sjohnlev /* 306843e1988Sjohnlev * The hypervisor maps all page tables into our address space read-only. 307843e1988Sjohnlev * Under normal circumstances, the hypervisor then handles all updates to 308843e1988Sjohnlev * the page tables underneath the covers for us. However, when we are 309843e1988Sjohnlev * trying to dump core after a hypervisor panic, the hypervisor is no 310843e1988Sjohnlev * longer available to do these updates. To work around the protection 311843e1988Sjohnlev * problem, we simply disable write-protect checking for the duration of a 312843e1988Sjohnlev * pagetable update operation. 313843e1988Sjohnlev */ 314843e1988Sjohnlev #define XPV_ALLOW_PAGETABLE_UPDATES() \ 315843e1988Sjohnlev { \ 316843e1988Sjohnlev if (IN_XPV_PANIC()) \ 317843e1988Sjohnlev setcr0((getcr0() & ~CR0_WP) & 0xffffffff); \ 318843e1988Sjohnlev } 319843e1988Sjohnlev #define XPV_DISALLOW_PAGETABLE_UPDATES() \ 320843e1988Sjohnlev { \ 321843e1988Sjohnlev if (IN_XPV_PANIC() > 0) \ 322843e1988Sjohnlev setcr0((getcr0() | CR0_WP) & 0xffffffff); \ 323843e1988Sjohnlev } 324843e1988Sjohnlev 325843e1988Sjohnlev #else /* __xpv */ 326843e1988Sjohnlev 327843e1988Sjohnlev #define XPV_ALLOW_PAGETABLE_UPDATES() 328843e1988Sjohnlev #define XPV_DISALLOW_PAGETABLE_UPDATES() 329843e1988Sjohnlev 330843e1988Sjohnlev #endif 331843e1988Sjohnlev 3327c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 3337c478bd9Sstevel@tonic-gate 3347c478bd9Sstevel@tonic-gate 3357c478bd9Sstevel@tonic-gate #ifdef __cplusplus 3367c478bd9Sstevel@tonic-gate } 3377c478bd9Sstevel@tonic-gate #endif 3387c478bd9Sstevel@tonic-gate 3397c478bd9Sstevel@tonic-gate #endif /* _VM_HTABLE_H */ 340