summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2011-07-04 17:07:27 +0000
committerkettenis <kettenis@openbsd.org>2011-07-04 17:07:27 +0000
commit8b477bc0f2cad4a3de6c8e021800742d0944042e (patch)
treefaec89adecaa49c2da121f1a51259ae7b7ea7754
parentNuke the useless D_KQFILTER flag and just check that d_kqfilter is (diff)
downloadwireguard-openbsd-8b477bc0f2cad4a3de6c8e021800742d0944042e.tar.xz
wireguard-openbsd-8b477bc0f2cad4a3de6c8e021800742d0944042e.zip
Give each pmap its own space ID. The current algorithm is silly, as we'll wrap
and might end up with duplicates, but that's not an issue until we're multi-user. Change the TLB miss code to enter mappings with the right protection ID. Properly switch pmaps on context switches. This makes the copyins we do before starting init actually work instead of failing with EFAULT.
-rw-r--r--sys/arch/hppa64/hppa64/locore.S8
-rw-r--r--sys/arch/hppa64/hppa64/pmap.c5
-rw-r--r--sys/arch/hppa64/hppa64/vm_machdep.c3
3 files changed, 10 insertions, 6 deletions
diff --git a/sys/arch/hppa64/hppa64/locore.S b/sys/arch/hppa64/hppa64/locore.S
index 5fca6168ed5..0d00c6801e8 100644
--- a/sys/arch/hppa64/hppa64/locore.S
+++ b/sys/arch/hppa64/hppa64/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.27 2011/05/05 20:48:34 kettenis Exp $ */
+/* $OpenBSD: locore.S,v 1.28 2011/07/04 17:07:27 kettenis Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -1020,8 +1020,8 @@ EXIT(TLABEL(all))
sub,*= %r16, %r17, %r0 ! \
std %r17, 0(%r25) ! \
extrd,s %r16, 63, 37, %r16 ! \
- depd %r8, 63, 48, %r17 ! \
- depdi 1, 62, 1, %r17
+ depd %r8, 62, 47, %r17 ! \
+ depdi 2, 63, 2, %r17
TLABEL(itlb)
PTPULL(0, TLABEL(all))
@@ -1760,6 +1760,8 @@ switch_exited
ldd TF_PIDR2(%r1), %arg3
mtctl %arg2, %cr30
mtctl %arg3, %pidr2
+ ldd TF_VTOP(%r1), %arg2
+ mtctl %arg2, %cr25
ldo -(HPPA_FRAME_SIZE+20*8)(%sp), %r3
ldo -(HPPA_FRAME_SIZE)(%sp), ap
ldd 0*8(ap), %arg0
diff --git a/sys/arch/hppa64/hppa64/pmap.c b/sys/arch/hppa64/hppa64/pmap.c
index 1a3f5ee177c..de522cfa6bb 100644
--- a/sys/arch/hppa64/hppa64/pmap.c
+++ b/sys/arch/hppa64/hppa64/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.16 2011/05/30 22:25:21 oga Exp $ */
+/* $OpenBSD: pmap.c,v 1.17 2011/07/04 17:07:27 kettenis Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -625,7 +625,7 @@ pmap_create(void)
{
struct pmap *pmap;
struct vm_page *pg;
- pa_space_t space;
+ static pa_space_t space = 0x200;
paddr_t pa;
DPRINTF(PDB_FOLLOW|PDB_PMAP, ("pmap_create()\n"));
@@ -655,6 +655,7 @@ pmap_create(void)
/* TODO for (space = 1 + (arc4random() & HPPA_SID_MAX);
pmap_sdir_get(space); space = (space + 1) % HPPA_SID_MAX); */
pmap->pm_space = space;
+ space += 0x200;
pmap->pm_stats.resident_count = 2;
pmap->pm_stats.wired_count = 0;
diff --git a/sys/arch/hppa64/hppa64/vm_machdep.c b/sys/arch/hppa64/hppa64/vm_machdep.c
index 75cc29443eb..98b93bfd9d5 100644
--- a/sys/arch/hppa64/hppa64/vm_machdep.c
+++ b/sys/arch/hppa64/hppa64/vm_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_machdep.c,v 1.12 2011/04/16 22:02:32 kettenis Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.13 2011/07/04 17:07:27 kettenis Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -121,6 +121,7 @@ cpu_fork(p1, p2, stack, stacksize, func, arg)
sp += sizeof(struct trapframe);
bcopy(p1->p_md.md_regs, tf, sizeof(*tf));
+ tf->tf_vtop = (paddr_t)p2->p_vmspace->vm_map.pmap->pm_pdir;
tf->tf_cr30 = (paddr_t)pcbp->pcb_fpstate;
tf->tf_sr0 = tf->tf_sr1 = tf->tf_sr2 = tf->tf_sr3 =