-/* $OpenBSD: cpuswitch7.S,v 1.11 2016/08/10 06:46:36 kettenis Exp $ */
+/* $OpenBSD: cpuswitch7.S,v 1.12 2016/08/26 11:59:04 kettenis Exp $ */
/* $NetBSD: cpuswitch.S,v 1.41 2003/11/15 08:44:18 scw Exp $ */
/*
ldr r10, [r8, #(PCB_PAGEDIR)] /* r10 = old L1 */
ldr r11, [r9, #(PCB_PAGEDIR)] /* r11 = new L1 */
- ldr r0, [r8, #(PCB_DACR)] /* r0 = old DACR */
- ldr r1, [r9, #(PCB_DACR)] /* r1 = new DACR */
-
- teq r10, r11 /* Same L1? */
- cmpeq r0, r1 /* Same DACR? */
- beq .Lcs_context_switched /* yes! */
-
- mov r2, #DOMAIN_CLIENT
- cmp r1, r2, lsl #(PMAP_DOMAIN_KERNEL * 2) /* Sw to kernel thread? */
- beq .Lcs_cache_purge_skipped /* Yup. Don't flush cache */
-
- stmfd sp!, {r0-r3}
- ldr r1, .Lcpufuncs
- mov lr, pc
- ldr pc, [r1, #CF_ICACHE_SYNC_ALL]
- ldmfd sp!, {r0-r3}
-
-.Lcs_cache_purge_skipped:
- /* rem: r1 = new DACR */
/* rem: r6 = new proc */
/* rem: r9 = new PCB */
/* rem: r10 = old L1 */
*/
IRQdisableALL
- mcr CP15_DACR(r1) /* Update DACR for new context */
-
cmp r10, r11 /* Switching to the same L1? */
ldr r10, .Lcpufuncs
beq .Lcs_context_switched /* Yup. */
-/* $OpenBSD: pmap7.c,v 1.47 2016/08/24 13:09:52 kettenis Exp $ */
+/* $OpenBSD: pmap7.c,v 1.48 2016/08/26 11:59:04 kettenis Exp $ */
/* $NetBSD: pmap.c,v 1.147 2004/01/18 13:03:50 scw Exp $ */
/*
u_int pmap_modify_pv(struct vm_page *, pmap_t, vaddr_t,
u_int, u_int);
-void pmap_alloc_l1(pmap_t, int);
+void pmap_alloc_l1(pmap_t);
void pmap_free_l1(pmap_t);
struct l2_bucket *pmap_get_l2_bucket(pmap_t, vaddr_t);
* This is called at pmap creation time.
*/
void
-pmap_alloc_l1(pmap_t pm, int domain)
+pmap_alloc_l1(pmap_t pm)
{
struct l1_ttable *l1;
struct pglist plist;
int error;
#ifdef PMAP_DEBUG
-printf("%s: %d %d\n", __func__, domain, ++nl1);
+printf("%s: %d\n", __func__, ++nl1);
#endif
/* XXX use a pool? or move to inside struct pmap? */
l1 = malloc(sizeof(*l1), M_VMPMAP, M_WAITOK);
pmap_init_l1(l1, pl1pt);
pm->pm_l1 = l1;
- pm->pm_domain = domain;
}
/*
pmap_free_l2_bucket(pmap_t pm, struct l2_bucket *l2b, u_int count)
{
struct l2_dtable *l2;
- pd_entry_t *pl1pd, l1pd;
+ pd_entry_t *pl1pd;
pt_entry_t *ptep;
u_short l1idx;
pl1pd = &pm->pm_l1->l1_kva[l1idx];
/*
- * If the L1 slot matches the pmap's domain
- * number, then invalidate it.
+ * Invalidate the L1 slot.
*/
- l1pd = *pl1pd & (L1_TYPE_MASK | L1_C_DOM_MASK);
- if (l1pd == (L1_C_DOM(pm->pm_domain) | L1_TYPE_C)) {
- *pl1pd = L1_TYPE_INV;
- PTE_SYNC(pl1pd);
- pmap_tlb_flushID_SE(pm, l1idx << L1_S_SHIFT);
- }
+ *pl1pd = L1_TYPE_INV;
+ PTE_SYNC(pl1pd);
+ pmap_tlb_flushID_SE(pm, l1idx << L1_S_SHIFT);
/*
* Release the L2 descriptor table back to the pool cache.
pm->pm_refs = 1;
pm->pm_stats.wired_count = 0;
- pmap_alloc_l1(pm, PMAP_DOMAIN_USER_V7);
+ pmap_alloc_l1(pm);
return (pm);
}
/*
* This mapping is likely to be accessed as
* soon as we return to userland. Fix up the
- * L1 entry to avoid taking another
- * page/domain fault.
+ * L1 entry to avoid taking another page fault.
*/
pd_entry_t *pl1pd, l1pd;
pl1pd = &pm->pm_l1->l1_kva[L1_IDX(va)];
- l1pd = l2b->l2b_phys | L1_C_DOM(pm->pm_domain) |
- L1_C_PROTO;
+ l1pd = L1_C_PROTO | l2b->l2b_phys;
if (*pl1pd != l1pd) {
*pl1pd = l1pd;
PTE_SYNC(pl1pd);
pmap_set_pcb_pagedir(pm, pcb);
if (p == curproc) {
- u_int cur_dacr, cur_ttb;
+ u_int cur_ttb;
__asm volatile("mrc p15, 0, %0, c2, c0, 0" : "=r"(cur_ttb));
- __asm volatile("mrc p15, 0, %0, c3, c0, 0" : "=r"(cur_dacr));
cur_ttb &= ~(L1_TABLE_SIZE - 1);
- if (cur_ttb == (u_int)pcb->pcb_pagedir &&
- cur_dacr == pcb->pcb_dacr) {
+ if (cur_ttb == (u_int)pcb->pcb_pagedir) {
/*
* No need to switch address spaces.
*/
*/
}
- cpu_domains(pcb->pcb_dacr);
cpu_setttb(pcb->pcb_pagedir);
enable_interrupts(PSR_I | PSR_F);
/* Distribute new L1 entry to all other L1s */
TAILQ_FOREACH(l1, &l1_list, l1_link) {
pl1pd = &l1->l1_kva[L1_IDX(pmap_curmaxkvaddr)];
- *pl1pd = l2b->l2b_phys | L1_C_DOM(PMAP_DOMAIN_KERNEL) |
- L1_C_PROTO;
+ *pl1pd = L1_C_PROTO | l2b->l2b_phys;
PTE_SYNC(pl1pd);
}
}
{
KDASSERT(pm->pm_l1);
pcb->pcb_pagedir = pm->pm_l1->l1_physaddr;
- pcb->pcb_dacr = (DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL * 2)) |
- (DOMAIN_CLIENT << (pm->pm_domain * 2));
-
pcb->pcb_pl1vec = NULL;
}
* Initialise the kernel pmap object
*/
pm->pm_l1 = l1;
- pm->pm_domain = PMAP_DOMAIN_KERNEL;
pm->pm_refs = 1;
/*
}
pde[va >> L1_S_SHIFT] = L1_S_PROTO | pa | L1_S_V7_AF |
- L1_S_PROT(PTE_KERNEL, prot) | fl | L1_S_DOM(PMAP_DOMAIN_KERNEL);
+ L1_S_PROT(PTE_KERNEL, prot) | fl;
PTE_SYNC(&pde[va >> L1_S_SHIFT]);
}
void
pmap_link_l2pt(vaddr_t l1pt, vaddr_t va, pv_addr_t *l2pv)
{
- pd_entry_t *pde = (pd_entry_t *) l1pt, proto;
+ pd_entry_t *pde = (pd_entry_t *) l1pt;
u_int slot = va >> L1_S_SHIFT;
- proto = L1_C_DOM(PMAP_DOMAIN_KERNEL) | L1_C_PROTO;
-
- pde[slot + 0] = proto | (l2pv->pv_pa + 0x000);
+ pde[slot + 0] = L1_C_PROTO | (l2pv->pv_pa + 0x000);
#ifdef ARM32_NEW_VM_LAYOUT
PTE_SYNC(&pde[slot]);
#else
- pde[slot + 1] = proto | (l2pv->pv_pa + 0x400);
- pde[slot + 2] = proto | (l2pv->pv_pa + 0x800);
- pde[slot + 3] = proto | (l2pv->pv_pa + 0xc00);
+ pde[slot + 1] = L1_C_PROTO | (l2pv->pv_pa + 0x400);
+ pde[slot + 2] = L1_C_PROTO | (l2pv->pv_pa + 0x800);
+ pde[slot + 3] = L1_C_PROTO | (l2pv->pv_pa + 0xc00);
PTE_SYNC_RANGE(&pde[slot + 0], 4);
#endif
printf("S");
#endif
pde[va >> L1_S_SHIFT] = L1_S_PROTO | pa |
- L1_S_V7_AF | L1_S_PROT(PTE_KERNEL, prot) |
- f1 | L1_S_DOM(PMAP_DOMAIN_KERNEL);
+ L1_S_V7_AF | L1_S_PROT(PTE_KERNEL, prot) | f1;
PTE_SYNC(&pde[va >> L1_S_SHIFT]);
va += L1_S_SIZE;
pa += L1_S_SIZE;