summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormlarkin <mlarkin@openbsd.org>2013-05-30 17:15:38 +0000
committermlarkin <mlarkin@openbsd.org>2013-05-30 17:15:38 +0000
commit3f7dce04b34771b89ece9fe3dfa9862af85980d6 (patch)
tree375378a09f157b5d52e123daf96daa174f69fa86 /sys
parentcorrect some lies (diff)
downloadwireguard-openbsd-3f7dce04b34771b89ece9fe3dfa9862af85980d6.tar.xz
wireguard-openbsd-3f7dce04b34771b89ece9fe3dfa9862af85980d6.zip
Even though we reserve 3 pages for the amd64 hibernate stack, we set the
resume time stack pointer to the first page reserved, effectively giving us only one page to work with. Found when I was debugging some unrelated stack issues in the resume code.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/hibernate_machdep.c8
-rw-r--r--sys/arch/amd64/include/hibernate_var.h2
2 files changed, 5 insertions, 5 deletions
diff --git a/sys/arch/amd64/amd64/hibernate_machdep.c b/sys/arch/amd64/amd64/hibernate_machdep.c
index 1c0487e2161..3359b3fc086 100644
--- a/sys/arch/amd64/amd64/hibernate_machdep.c
+++ b/sys/arch/amd64/amd64/hibernate_machdep.c
@@ -247,10 +247,10 @@ hibernate_populate_resume_pt(union hibernate_info *hib_info,
/* Identity map 3 pages for stack */
pmap_kenter_pa(HIBERNATE_STACK_PAGE, HIBERNATE_STACK_PAGE, VM_PROT_ALL);
- pmap_kenter_pa(HIBERNATE_STACK_PAGE + PAGE_SIZE,
- HIBERNATE_STACK_PAGE + PAGE_SIZE, VM_PROT_ALL);
- pmap_kenter_pa(HIBERNATE_STACK_PAGE + 2*PAGE_SIZE,
- HIBERNATE_STACK_PAGE + 2*PAGE_SIZE, VM_PROT_ALL);
+ pmap_kenter_pa(HIBERNATE_STACK_PAGE - PAGE_SIZE,
+ HIBERNATE_STACK_PAGE - PAGE_SIZE, VM_PROT_ALL);
+ pmap_kenter_pa(HIBERNATE_STACK_PAGE - 2*PAGE_SIZE,
+ HIBERNATE_STACK_PAGE - 2*PAGE_SIZE, VM_PROT_ALL);
pmap_activate(curproc);
bzero((caddr_t)HIBERNATE_PML4T, PAGE_SIZE);
diff --git a/sys/arch/amd64/include/hibernate_var.h b/sys/arch/amd64/include/hibernate_var.h
index c089055c7ac..f09325e49c1 100644
--- a/sys/arch/amd64/include/hibernate_var.h
+++ b/sys/arch/amd64/include/hibernate_var.h
@@ -55,7 +55,7 @@
#define HIBERNATE_SELTABLE (PAGE_SIZE * 14)
/* 3 pages for stack */
-#define HIBERNATE_STACK_PAGE (PAGE_SIZE * 15)
+#define HIBERNATE_STACK_PAGE (PAGE_SIZE * 17)
#define HIBERNATE_INFLATE_PAGE (PAGE_SIZE * 18)
#define HIBERNATE_COPY_PAGE (PAGE_SIZE * 19)