1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _KBOOT_MMU_H 28 #define _KBOOT_MMU_H 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 /* 35 * Kernel boot-time interfaces for handling MMU mappings before the HAT proper 36 * is running (i.e. before khat_running is set). 37 */ 38 39 #include <sys/mach_mmu.h> 40 41 struct xboot_info; 42 43 extern void kbm_init(struct xboot_info *); 44 45 /* 46 * Interface to remap the page table window, also used by HAT during init. 47 */ 48 extern void *kbm_remap_window(paddr_t physaddr, int writeable); 49 50 /* 51 * Find the next mapping at or above VA, if found returns non-zero and sets: 52 * - va : virtual address 53 * - pfn : pfn of real address 54 * - size : pagesize of the mapping 55 * - prot : protections 56 */ 57 extern int kbm_probe(uintptr_t *va, size_t *len, pfn_t *pfn, uint_t *prot); 58 59 /* 60 * Add a new mapping 61 */ 62 extern void kbm_map(uintptr_t va, paddr_t pa, uint_t level, uint_t is_kernel); 63 64 #ifdef __xpv 65 extern void kbm_map_ma(maddr_t ma, uintptr_t va, uint_t level); 66 #endif 67 68 /* 69 * unmap a single 4K page at VA 70 */ 71 extern void kbm_unmap(uintptr_t va); 72 73 /* 74 * Remap a single 4K page at VA (always PROT_READ|PROT_WRITE). 75 * Returns the pfn of the old mapping. 76 */ 77 extern pfn_t kbm_remap(uintptr_t va, pfn_t pfn); 78 79 /* 80 * Make a page mapping read only 81 */ 82 extern void kbm_read_only(uintptr_t va, paddr_t pa); 83 84 85 /* 86 * interface for kmdb to map a physical page, stack is only 1 deep 87 */ 88 extern void *kbm_push(paddr_t pa); 89 extern void kbm_pop(void); 90 91 /* 92 * These are needed by mmu_init() 93 */ 94 extern int kbm_nx_support; 95 extern int kbm_pae_support; 96 extern int kbm_largepage_support; 97 98 /* 99 * The size of memory mapped for the initial kernel nucleus text 100 * and data regions setup by the boot loader. needed for startup 101 */ 102 extern uint_t kbm_nucleus_size; 103 104 #ifdef __cplusplus 105 } 106 #endif 107 108 #endif /* _KBOOT_MMU_H */ 109