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 * Copyright (c) 2012 Gary Mills
23 * Copyright 2016 PALO, Richard.
24 *
25 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
26 */
27
28 #include <sys/types.h>
29 #include <sys/clock.h>
30 #include <sys/psm.h>
31 #include <sys/archsystm.h>
32 #include <sys/machsystm.h>
33 #include <sys/compress.h>
34 #include <sys/modctl.h>
35 #include <sys/trap.h>
36 #include <sys/panic.h>
37 #include <sys/regset.h>
38 #include <sys/frame.h>
39 #include <sys/kobj.h>
40 #include <sys/apic.h>
41 #include <sys/apic_timer.h>
42 #include <sys/dumphdr.h>
43 #include <sys/mem.h>
44 #include <sys/x86_archext.h>
45 #include <sys/xpv_panic.h>
157
158 static void
159 xpv_panic_map(int level, pfn_t pfn)
160 {
161 x86pte_t pte, *pteptr;
162
163 /*
164 * The provided pfn represents a level 'level' page table. Map it
165 * into the 'level' slot in the list of page table windows.
166 */
167 pteptr = (x86pte_t *)PWIN_PTE_VA(level);
168 pte = pfn_to_pa(pfn) | PT_VALID;
169
170 XPV_ALLOW_PAGETABLE_UPDATES();
171 if (mmu.pae_hat)
172 *pteptr = pte;
173 else
174 *(x86pte32_t *)pteptr = pte;
175 XPV_DISALLOW_PAGETABLE_UPDATES();
176
177 mmu_tlbflush_entry(PWIN_VA(level));
178 }
179
180 /*
181 * Walk the page tables to find the pfn mapped by the given va.
182 */
183 static pfn_t
184 xpv_va_walk(uintptr_t *vaddr)
185 {
186 int l, idx;
187 pfn_t pfn;
188 x86pte_t pte;
189 x86pte_t *ptep;
190 uintptr_t va = *vaddr;
191 uintptr_t scan_va;
192 caddr_t ptable_window;
193 static pfn_t toplevel_pfn;
194 static uintptr_t lastva;
195
196 /*
197 * If we do anything other than a simple scan through memory, don't
|
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 * Copyright (c) 2012 Gary Mills
23 * Copyright 2016 PALO, Richard.
24 *
25 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
26 *
27 * Copyright 2018 Joyent, Inc.
28 */
29
30 #include <sys/types.h>
31 #include <sys/clock.h>
32 #include <sys/psm.h>
33 #include <sys/archsystm.h>
34 #include <sys/machsystm.h>
35 #include <sys/compress.h>
36 #include <sys/modctl.h>
37 #include <sys/trap.h>
38 #include <sys/panic.h>
39 #include <sys/regset.h>
40 #include <sys/frame.h>
41 #include <sys/kobj.h>
42 #include <sys/apic.h>
43 #include <sys/apic_timer.h>
44 #include <sys/dumphdr.h>
45 #include <sys/mem.h>
46 #include <sys/x86_archext.h>
47 #include <sys/xpv_panic.h>
159
160 static void
161 xpv_panic_map(int level, pfn_t pfn)
162 {
163 x86pte_t pte, *pteptr;
164
165 /*
166 * The provided pfn represents a level 'level' page table. Map it
167 * into the 'level' slot in the list of page table windows.
168 */
169 pteptr = (x86pte_t *)PWIN_PTE_VA(level);
170 pte = pfn_to_pa(pfn) | PT_VALID;
171
172 XPV_ALLOW_PAGETABLE_UPDATES();
173 if (mmu.pae_hat)
174 *pteptr = pte;
175 else
176 *(x86pte32_t *)pteptr = pte;
177 XPV_DISALLOW_PAGETABLE_UPDATES();
178
179 mmu_flush_tlb_page((uintptr_t)PWIN_VA(level));
180 }
181
182 /*
183 * Walk the page tables to find the pfn mapped by the given va.
184 */
185 static pfn_t
186 xpv_va_walk(uintptr_t *vaddr)
187 {
188 int l, idx;
189 pfn_t pfn;
190 x86pte_t pte;
191 x86pte_t *ptep;
192 uintptr_t va = *vaddr;
193 uintptr_t scan_va;
194 caddr_t ptable_window;
195 static pfn_t toplevel_pfn;
196 static uintptr_t lastva;
197
198 /*
199 * If we do anything other than a simple scan through memory, don't
|