summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Larkin <mlarkin@cvs.openbsd.org>2014-12-08 07:12:38 +0000
committerMike Larkin <mlarkin@cvs.openbsd.org>2014-12-08 07:12:38 +0000
commit96e518569e7f3ca4731e4b9ecba26dfa13635b8d (patch)
treeb1c3c9b290f562c2af5c0a387841cd86e46b3b24
parentbeccf532063cfbd43373734788e7a3fab89165fd (diff)
Split the ACPI resume trampoline into code and data, move the data page to
.rodata (kernel copies to the RW page), protect the code page with RX permissions, protect the code page with RW permissions. ok deraadt@
-rw-r--r--sys/arch/amd64/amd64/acpi_machdep.c14
-rw-r--r--sys/arch/amd64/amd64/acpi_wakecode.S182
-rw-r--r--sys/arch/amd64/amd64/hibernate_machdep.c12
-rw-r--r--sys/arch/amd64/amd64/machdep.c7
-rw-r--r--sys/arch/amd64/include/hibernate_var.h26
-rw-r--r--sys/arch/i386/include/hibernate_var.h12
-rw-r--r--sys/dev/acpi/acpivar.h3
7 files changed, 145 insertions, 111 deletions
diff --git a/sys/arch/amd64/amd64/acpi_machdep.c b/sys/arch/amd64/amd64/acpi_machdep.c
index 3b04ebc110b..5b3a77c24bd 100644
--- a/sys/arch/amd64/amd64/acpi_machdep.c
+++ b/sys/arch/amd64/amd64/acpi_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi_machdep.c,v 1.65 2014/12/01 04:22:34 mlarkin Exp $ */
+/* $OpenBSD: acpi_machdep.c,v 1.66 2014/12/08 07:12:37 mlarkin Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -56,6 +56,7 @@
#endif
extern u_char acpi_real_mode_resume[], acpi_resume_end[];
+extern u_char acpi_tramp_data_start[], acpi_tramp_data_end[];
extern u_int32_t acpi_pdirpa;
extern paddr_t tramp_pdirpa;
@@ -224,9 +225,18 @@ acpi_attach_machdep(struct acpi_softc *sc)
*/
KASSERT(acpi_resume_end - acpi_real_mode_resume < PAGE_SIZE);
- bcopy(acpi_real_mode_resume, (caddr_t)ACPI_TRAMPOLINE,
+ memcpy((caddr_t)ACPI_TRAMPOLINE, acpi_real_mode_resume,
acpi_resume_end - acpi_real_mode_resume);
+ pmap_kenter_pa(ACPI_TRAMP_DATA, ACPI_TRAMP_DATA,
+ PROT_READ | PROT_WRITE);
+ memcpy((caddr_t)ACPI_TRAMP_DATA, acpi_tramp_data_start,
+ acpi_tramp_data_end - acpi_tramp_data_start);
+
+ /* Remap trampoline code page RX */
+ pmap_kenter_pa(ACPI_TRAMPOLINE, ACPI_TRAMPOLINE,
+ PROT_READ | PROT_EXEC);
+
acpi_pdirpa = tramp_pdirpa;
}
diff --git a/sys/arch/amd64/amd64/acpi_wakecode.S b/sys/arch/amd64/amd64/acpi_wakecode.S
index 377365e7549..ab2903b4aa3 100644
--- a/sys/arch/amd64/amd64/acpi_wakecode.S
+++ b/sys/arch/amd64/amd64/acpi_wakecode.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi_wakecode.S,v 1.34 2014/12/01 04:33:00 mlarkin Exp $ */
+/* $OpenBSD: acpi_wakecode.S,v 1.35 2014/12/08 07:12:37 mlarkin Exp $ */
/*
* Copyright (c) 2001 Takanori Watanabe <takawata@jp.freebsd.org>
* Copyright (c) 2001 Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
@@ -53,9 +53,14 @@
#include <machine/segments.h>
#include <dev/acpi/acpivar.h>
-#define _ACPI_TRMP_LABEL(a) a = . - _C_LABEL(acpi_real_mode_resume) + ACPI_TRAMPOLINE
+#define _ACPI_TRMP_LABEL(a) a = . - _C_LABEL(acpi_real_mode_resume) + \
+ ACPI_TRAMPOLINE
#define _ACPI_TRMP_OFFSET(a) a = . - _C_LABEL(acpi_real_mode_resume)
-#define _ACPI_RM_SEGMENT (ACPI_TRAMPOLINE >> 4)
+#define _ACPI_TRMP_DATA_LABEL(a) a = . - _C_LABEL(acpi_tramp_data_start) + \
+ ACPI_TRAMP_DATA
+#define _ACPI_TRMP_DATA_OFFSET(a) a = . - _C_LABEL(acpi_tramp_data_start)
+#define _ACPI_RM_CODE_SEG (ACPI_TRAMPOLINE >> 4)
+#define _ACPI_RM_DATA_SEG (ACPI_TRAMP_DATA >> 4)
/*
* On wakeup, we'll start executing at acpi_real_mode_resume.
@@ -76,7 +81,6 @@
* 4. Enter long mode
* 5. Restore saved CPU registers
*/
-
.text
.code16
.align 4
@@ -85,6 +89,8 @@
.global _C_LABEL(acpi_long_mode_resume)
.global _C_LABEL(acpi_resume_end)
.global _C_LABEL(acpi_pdirpa)
+ .global _C_LABEL(acpi_tramp_data_start)
+ .global _C_LABEL(acpi_tramp_data_end)
_C_LABEL(acpi_real_mode_resume):
_ACPI_TRMP_OFFSET(acpi_s3_vector_real)
nop
@@ -97,10 +103,11 @@ _ACPI_TRMP_OFFSET(acpi_s3_vector_real)
* ant real dependencies on data or stack, so we'll just use
* the code segment for data and stack (eg, a 64k memory space).
*/
- movw %cs,%ax
- movw %ax,%ds
- movw %ax,%es
- movw %ax,%ss
+ movw $(_ACPI_RM_DATA_SEG), %ax
+ movw %ax, %ds
+ movw %ax, %ss
+ movw %cs, %ax
+ movw %ax, %es
lidtl clean_idt
/*
@@ -118,13 +125,6 @@ _ACPI_TRMP_OFFSET(acpi_s3_vector_real)
popfl
/*
- * Set up esi to point to start of current routine's CS.
- */
- xorl %esi,%esi
- movw %cs,%si
- shll $4,%esi
-
- /*
* Flush instruction prefetch queue
*/
jmp 1f
@@ -137,8 +137,7 @@ _ACPI_TRMP_OFFSET(acpi_s3_vector_real)
* extending from 0x00000000-0xffffffff and one for data
* with the same range. This GDT will only be in use for a short
* time, until we restore the saved GDT that we had when we went
- * to sleep (although on i386, the saved GDT will most likely
- * represent something similar based on machine/segment.h).
+ * to sleep.
*/
data32 addr32 lgdt tmp_gdt
@@ -150,11 +149,9 @@ _ACPI_TRMP_OFFSET(acpi_s3_vector_real)
mov %eax,%cr0
/*
- * Force CPU into protected mode
- * by making an intersegment jump (to ourselves, just a few lines
- * down from here. We rely on the kernel to fixup the jump
- * target addres previously.
- *
+ * Force CPU into protected mode by making an intersegment jump (to
+ * ourselves, just a few lines down from here). We rely on the kernel
+ * to fixup the jump target addres previously.
*/
ljmpl $0x8, $acpi_protected_mode_trampoline
@@ -184,8 +181,7 @@ _C_LABEL(acpi_protected_mode_resume):
* because we haven't put anything on the stack via a
* call or push that we haven't cleaned up already.
*/
- movl %esi, %esp
- addl $0x0FFE, %esp
+ addl $(ACPI_TRAMP_DATA), %esp
/* Set CR4 to something sane for entry into long mode */
mov $(CR4_PAE|CR4_OSFXSR|CR4_OSXMMEXCPT|CR4_PSE),%eax
@@ -213,6 +209,7 @@ _C_LABEL(acpi_protected_mode_resume):
jmp 1f
1: jmp 1f
1:
+
/* Reenable paging by setting the appropriate bits in CR0 */
movl %cr0,%eax
orl $(CR0_PE|CR0_PG|CR0_NE|CR0_TS|CR0_MP|CR0_WP),%eax
@@ -231,6 +228,9 @@ _C_LABEL(acpi_protected_mode_resume):
_ACPI_TRMP_LABEL(acpi_long_mode_trampoline)
_C_LABEL(acpi_long_mode_resume):
+ /* Reset stack */
+ movq $(ACPI_TRAMP_DATA + 0x0FF8), %rsp
+
/* Load GDT based on our saved copy */
lgdt acpi_saved_gdt
@@ -292,6 +292,7 @@ _C_LABEL(acpi_long_mode_resume):
jmp 1f
1: jmp 1f
1:
+
movq acpi_saved_cr2, %rax
movq %rax, %cr2
movq acpi_saved_cr0, %rax
@@ -355,10 +356,8 @@ _ACPI_TRMP_LABEL(hibernate_resume_vector_2)
/* Get out of 64 bit CS */
lgdtq tmp_gdt6416
+ /* Jump out of 64 bit mode, to hibernate_resume_vector_3 below */
ljmp *(hibernate_indirect_16)
-_ACPI_TRMP_LABEL(hibernate_indirect_16)
- .long hibernate_resume_vector_3
- .word 0x18
_ACPI_TRMP_OFFSET(hibernate_resume_vector_3)
.code16
@@ -371,8 +370,9 @@ _ACPI_TRMP_OFFSET(hibernate_resume_vector_3)
movl %eax, %cr0
/* Set up real mode segment selectors */
- movw $(ACPI_TRAMPOLINE >> 4), %ax
+ movw $(_ACPI_RM_DATA_SEG), %ax
movw %ax, %ds
+ movw %ax, %ss
movw %ax, %es
movw %ax, %fs
movw %ax, %gs
@@ -380,7 +380,7 @@ _ACPI_TRMP_OFFSET(hibernate_resume_vector_3)
lidtl clean_idt
/* Jump to the S3 resume vector */
- ljmp $(ACPI_TRAMPOLINE >> 4), $acpi_s3_vector_real
+ ljmp $(_ACPI_RM_CODE_SEG), $acpi_s3_vector_real
NENTRY(hibernate_drop_to_real_mode)
.code64
@@ -393,10 +393,8 @@ _ACPI_TRMP_LABEL(hibernate_resume_vector_2b)
/* Get out of 64 bit CS */
lgdtq tmp_gdt6416
+ /* Jump out of 64 bit mode, to hibernate_resume_vector_3b below */
ljmp *(hibernate_indirect_16b)
-_ACPI_TRMP_LABEL(hibernate_indirect_16b)
- .long hibernate_resume_vector_3b
- .word 0x18
_ACPI_TRMP_OFFSET(hibernate_resume_vector_3b)
.code16
@@ -409,19 +407,18 @@ _ACPI_TRMP_OFFSET(hibernate_resume_vector_3b)
movl %eax, %cr0
/* Set up real mode segment selectors */
- movw $(ACPI_TRAMPOLINE >> 4), %ax
+ movw $(_ACPI_RM_DATA_SEG), %ax
movw %ax, %ds
movw %ax, %es
movw %ax, %fs
movw %ax, %gs
+ movw %ax, %ss
movl $0x0FFE, %esp
lidtl clean_idt
- ljmp $(ACPI_TRAMPOLINE >> 4), $hib_hlt_real
-
_ACPI_TRMP_OFFSET(hib_hlt_real)
hlt
- ljmp $(ACPI_TRAMPOLINE >> 4), $hib_hlt_real
+ ljmp $(_ACPI_RM_CODE_SEG), $hib_hlt_real
.code64
/* Switch to hibernate resume pagetable */
@@ -459,13 +456,23 @@ NENTRY(hibernate_flush)
ret
#endif /* HIBERNATE */
- .align 8
-_ACPI_TRMP_OFFSET(tmp_gdt)
+ /*
+ * End of resume code (code copied to ACPI_TRAMPOLINE)
+ */
+_C_LABEL(acpi_resume_end):
+
+ /*
+ * Initial copy of this data gets placed in .rodata, kernel makes
+ * RW copy of it in the tramp data page.
+ */
+ .section .rodata
+_C_LABEL(acpi_tramp_data_start):
+_ACPI_TRMP_DATA_OFFSET(tmp_gdt)
.word tmp_gdt_end - tmp_gdtable
.long tmp_gdtable
.align 8
-_ACPI_TRMP_LABEL(tmp_gdtable)
+_ACPI_TRMP_DATA_LABEL(tmp_gdtable)
/*
* null
*/
@@ -502,129 +509,132 @@ _ACPI_TRMP_LABEL(tmp_gdtable)
*/
.word 0xffff, 0
.byte 0, 0x93, 0xcf, 0
-_ACPI_TRMP_LABEL(tmp_gdt_end)
+_ACPI_TRMP_DATA_LABEL(tmp_gdt_end)
.align 8
-_ACPI_TRMP_OFFSET(clean_idt)
+_ACPI_TRMP_DATA_OFFSET(clean_idt)
.word 0xffff
.long 0
.word 0
.align 8
-_ACPI_TRMP_LABEL(tmp_gdt64)
+_ACPI_TRMP_DATA_LABEL(tmp_gdt64)
.word tmp_gdt64_end - tmp_gdtable64
.long tmp_gdtable64
.align 8
-_ACPI_TRMP_LABEL(tmp_gdtable64)
+_ACPI_TRMP_DATA_LABEL(tmp_gdtable64)
.quad 0x0000000000000000
.quad 0x00af9a000000ffff
.quad 0x00cf92000000ffff
-_ACPI_TRMP_LABEL(tmp_gdt64_end)
+_ACPI_TRMP_DATA_LABEL(tmp_gdt64_end)
.align 8
-_ACPI_TRMP_LABEL(tmp_gdt6416)
+_ACPI_TRMP_DATA_LABEL(tmp_gdt6416)
.word tmp_gdt6416_end - tmp_gdtable6416
.quad tmp_gdtable6416
.align 8
-_ACPI_TRMP_LABEL(tmp_gdtable6416)
+_ACPI_TRMP_DATA_LABEL(tmp_gdtable6416)
.quad 0x0000000000000000
.quad 0x00af9a000000ffff
.quad 0x00cf92000000ffff
.word 0x0fff, (ACPI_TRAMPOLINE % 0x10000)
.byte (ACPI_TRAMPOLINE >> 16), 0x9a, 0, 0
-_ACPI_TRMP_LABEL(tmp_gdt6416_end)
+_ACPI_TRMP_DATA_LABEL(tmp_gdt6416_end)
.align 8
-_ACPI_TRMP_LABEL(acpi_saved_rbx)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_rbx)
.quad 0
-_ACPI_TRMP_LABEL(acpi_saved_rcx)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_rcx)
.quad 0
-_ACPI_TRMP_LABEL(acpi_saved_rdx)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_rdx)
.quad 0
-_ACPI_TRMP_LABEL(acpi_saved_rbp)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_rbp)
.quad 0
-_ACPI_TRMP_LABEL(acpi_saved_rsi)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_rsi)
.quad 0
-_ACPI_TRMP_LABEL(acpi_saved_rdi)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_rdi)
.quad 0
-_ACPI_TRMP_LABEL(acpi_saved_rsp)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_rsp)
.quad 0
-_ACPI_TRMP_LABEL(acpi_saved_r8)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_r8)
.quad 0
-_ACPI_TRMP_LABEL(acpi_saved_r9)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_r9)
.quad 0
-_ACPI_TRMP_LABEL(acpi_saved_r10)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_r10)
.quad 0
-_ACPI_TRMP_LABEL(acpi_saved_r11)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_r11)
.quad 0
-_ACPI_TRMP_LABEL(acpi_saved_r12)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_r12)
.quad 0
-_ACPI_TRMP_LABEL(acpi_saved_r13)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_r13)
.quad 0
-_ACPI_TRMP_LABEL(acpi_saved_r14)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_r14)
.quad 0
-_ACPI_TRMP_LABEL(acpi_saved_r15)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_r15)
.quad 0
-_ACPI_TRMP_LABEL(acpi_saved_fl)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_fl)
.quad 0
-_ACPI_TRMP_LABEL(acpi_saved_cr0)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_cr0)
.quad 0
-_ACPI_TRMP_LABEL(acpi_saved_cr2)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_cr2)
.quad 0
-_ACPI_TRMP_LABEL(acpi_saved_cr3)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_cr3)
.quad 0
-_ACPI_TRMP_LABEL(acpi_saved_cr4)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_cr4)
.quad 0
-_ACPI_TRMP_LABEL(acpi_saved_cr8)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_cr8)
.quad 0
-_ACPI_TRMP_LABEL(acpi_saved_ret)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_ret)
.quad 0
.align 8
-_ACPI_TRMP_LABEL(acpi_saved_idt)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_idt)
.space 10
.align 8
-_ACPI_TRMP_LABEL(acpi_saved_gdt)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_gdt)
.space 10
.align 8
-_ACPI_TRMP_LABEL(acpi_saved_ldt)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_ldt)
.space 10
-_ACPI_TRMP_LABEL(acpi_saved_tr)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_tr)
.short 0
.align 4
-_ACPI_TRMP_LABEL(acpi_saved_efer)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_efer)
.long 0
.align 8
-_ACPI_TRMP_LABEL(acpi_saved_fsbase)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_fsbase)
.quad 0
-_ACPI_TRMP_LABEL(acpi_saved_gsbase)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_gsbase)
.quad 0
-_ACPI_TRMP_LABEL(acpi_saved_kgs)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_kgs)
.quad 0
-_ACPI_TRMP_LABEL(acpi_saved_star)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_star)
.quad 0
-_ACPI_TRMP_LABEL(acpi_saved_lstar)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_lstar)
.quad 0
-_ACPI_TRMP_LABEL(acpi_saved_cstar)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_cstar)
.quad 0
-_ACPI_TRMP_LABEL(acpi_saved_sfmask)
+_ACPI_TRMP_DATA_LABEL(acpi_saved_sfmask)
.quad 0
.align 4
-_ACPI_TRMP_LABEL(acpi_pdirpa)
+_ACPI_TRMP_DATA_LABEL(acpi_pdirpa)
.long 0
+_ACPI_TRMP_DATA_LABEL(hibernate_indirect_16)
+ .long hibernate_resume_vector_3
+ .word 0x18
+_ACPI_TRMP_DATA_LABEL(hibernate_indirect_16b)
+ .long hibernate_resume_vector_3b
+ .word 0x18
- /*
- * End of resume code (code copied to ACPI_TRAMPOLINE)
- */
-_C_LABEL(acpi_resume_end):
+_C_LABEL(acpi_tramp_data_end):
/*
* acpi_savecpu saves the processor's registers and flags
diff --git a/sys/arch/amd64/amd64/hibernate_machdep.c b/sys/arch/amd64/amd64/hibernate_machdep.c
index 2859e281885..d65bba37e68 100644
--- a/sys/arch/amd64/amd64/hibernate_machdep.c
+++ b/sys/arch/amd64/amd64/hibernate_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hibernate_machdep.c,v 1.32 2014/11/22 18:31:46 mlarkin Exp $ */
+/* $OpenBSD: hibernate_machdep.c,v 1.33 2014/12/08 07:12:37 mlarkin Exp $ */
/*
* Copyright (c) 2012 Mike Larkin <mlarkin@openbsd.org>
@@ -132,6 +132,7 @@ get_hibernate_info_md(union hibernate_info *hiber_info)
}
#if NACPI > 0
+ /* Record ACPI trampoline code page */
if (hiber_info->nranges >= VM_PHYSSEG_MAX)
return (1);
hiber_info->ranges[hiber_info->nranges].base = ACPI_TRAMPOLINE;
@@ -139,6 +140,15 @@ get_hibernate_info_md(union hibernate_info *hiber_info)
hiber_info->ranges[hiber_info->nranges].base + PAGE_SIZE;
hiber_info->image_size += PAGE_SIZE;
hiber_info->nranges++;
+
+ /* Record ACPI trampoline data page */
+ if (hiber_info->nranges >= VM_PHYSSEG_MAX)
+ return (1);
+ hiber_info->ranges[hiber_info->nranges].base = ACPI_TRAMP_DATA;
+ hiber_info->ranges[hiber_info->nranges].end =
+ hiber_info->ranges[hiber_info->nranges].base + PAGE_SIZE;
+ hiber_info->image_size += PAGE_SIZE;
+ hiber_info->nranges++;
#endif
#ifdef MULTIPROCESSOR
/* Record MP trampoline code page */
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c
index 3853c0f554d..98edbd6f045 100644
--- a/sys/arch/amd64/amd64/machdep.c
+++ b/sys/arch/amd64/amd64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.199 2014/12/02 18:13:10 tedu Exp $ */
+/* $OpenBSD: machdep.c,v 1.200 2014/12/08 07:12:37 mlarkin Exp $ */
/* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */
/*-
@@ -1200,9 +1200,10 @@ map_tramps(void)
PROT_READ | PROT_WRITE); /* protection */
#endif /* MULTIPROCESSOR */
+ /* Map trampoline code page RW (to copy code) */
pmap_kenter_pa((vaddr_t)ACPI_TRAMPOLINE, /* virtual */
(paddr_t)ACPI_TRAMPOLINE, /* physical */
- PROT_MASK); /* protection */
+ PROT_READ | PROT_WRITE); /* protection */
}
#endif
@@ -1296,6 +1297,8 @@ init_x86_64(paddr_t first_avail)
#if (NACPI > 0 && !defined(SMALL_KERNEL))
if (avail_start < ACPI_TRAMPOLINE + PAGE_SIZE)
avail_start = ACPI_TRAMPOLINE + PAGE_SIZE;
+ if (avail_start < ACPI_TRAMP_DATA + PAGE_SIZE)
+ avail_start = ACPI_TRAMP_DATA + PAGE_SIZE;
#endif
#ifdef HIBERNATE
diff --git a/sys/arch/amd64/include/hibernate_var.h b/sys/arch/amd64/include/hibernate_var.h
index 103cccd3354..8731b22d241 100644
--- a/sys/arch/amd64/include/hibernate_var.h
+++ b/sys/arch/amd64/include/hibernate_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: hibernate_var.h,v 1.11 2014/11/22 20:09:36 mlarkin Exp $ */
+/* $OpenBSD: hibernate_var.h,v 1.12 2014/12/08 07:12:37 mlarkin Exp $ */
/*
* Copyright (c) 2011 Mike Larkin <mlarkin@openbsd.org>
@@ -21,39 +21,39 @@
/*
* PML4 table for resume
*/
-#define HIBERNATE_PML4T (PAGE_SIZE * 20)
+#define HIBERNATE_PML4T (PAGE_SIZE * 21)
/*
* amd64 uses a PDPT to map the first 512GB phys mem plus one more
* to map any ranges of phys mem past 512GB (if needed)
*/
-#define HIBERNATE_PDPT_LOW (PAGE_SIZE * 21)
-#define HIBERNATE_PDPT_HI (PAGE_SIZE * 22)
+#define HIBERNATE_PDPT_LOW (PAGE_SIZE * 22)
+#define HIBERNATE_PDPT_HI (PAGE_SIZE * 23)
/*
* amd64 uses one PD to map the first 1GB phys mem plus one more to map any
* other 1GB ranges within the first 512GB phys, plus one more to map any
* 1GB range in any subsequent 512GB range
*/
-#define HIBERNATE_PD_LOW (PAGE_SIZE * 23)
-#define HIBERNATE_PD_LOW2 (PAGE_SIZE * 24)
-#define HIBERNATE_PD_HI (PAGE_SIZE * 25)
+#define HIBERNATE_PD_LOW (PAGE_SIZE * 24)
+#define HIBERNATE_PD_LOW2 (PAGE_SIZE * 25)
+#define HIBERNATE_PD_HI (PAGE_SIZE * 26)
/*
* amd64 uses one PT to map the first 2MB phys mem plus one more to map any
* other 2MB range within the first 1GB, plus one more to map any 2MB range
* in any subsequent 512GB range.
*/
-#define HIBERNATE_PT_LOW (PAGE_SIZE * 26)
-#define HIBERNATE_PT_LOW2 (PAGE_SIZE * 27)
-#define HIBERNATE_PT_HI (PAGE_SIZE * 28)
+#define HIBERNATE_PT_LOW (PAGE_SIZE * 27)
+#define HIBERNATE_PT_LOW2 (PAGE_SIZE * 28)
+#define HIBERNATE_PT_HI (PAGE_SIZE * 29)
/* 3 pages for stack */
-#define HIBERNATE_STACK_PAGE (PAGE_SIZE * 31)
+#define HIBERNATE_STACK_PAGE (PAGE_SIZE * 32)
-#define HIBERNATE_INFLATE_PAGE (PAGE_SIZE * 32)
+#define HIBERNATE_INFLATE_PAGE (PAGE_SIZE * 33)
/* HIBERNATE_HIBALLOC_PAGE must be the last stolen page (see machdep.c) */
-#define HIBERNATE_HIBALLOC_PAGE (PAGE_SIZE * 33)
+#define HIBERNATE_HIBALLOC_PAGE (PAGE_SIZE * 34)
/* Use 4MB hibernation chunks */
#define HIBERNATE_CHUNK_SIZE 0x400000
diff --git a/sys/arch/i386/include/hibernate_var.h b/sys/arch/i386/include/hibernate_var.h
index 6dc69e280c4..0fe75131ae4 100644
--- a/sys/arch/i386/include/hibernate_var.h
+++ b/sys/arch/i386/include/hibernate_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: hibernate_var.h,v 1.11 2014/11/22 20:09:36 mlarkin Exp $ */
+/* $OpenBSD: hibernate_var.h,v 1.12 2014/12/08 07:12:37 mlarkin Exp $ */
/*
* Copyright (c) 2011 Mike Larkin <mlarkin@openbsd.org>
@@ -18,13 +18,13 @@
#define PIGLET_PAGE_MASK (PD_MASK)
-#define HIBERNATE_PD_PAGE (PAGE_SIZE * 20)
-#define HIBERNATE_PT_PAGE (PAGE_SIZE * 21)
+#define HIBERNATE_PD_PAGE (PAGE_SIZE * 21)
+#define HIBERNATE_PT_PAGE (PAGE_SIZE * 22)
/* 2 pages for stack */
-#define HIBERNATE_STACK_PAGE (PAGE_SIZE * 23)
-#define HIBERNATE_INFLATE_PAGE (PAGE_SIZE * 24)
+#define HIBERNATE_STACK_PAGE (PAGE_SIZE * 24)
+#define HIBERNATE_INFLATE_PAGE (PAGE_SIZE * 25)
/* HIBERNATE_HIBALLOC_PAGE must be the last stolen page (see machdep.c) */
-#define HIBERNATE_HIBALLOC_PAGE (PAGE_SIZE * 25)
+#define HIBERNATE_HIBALLOC_PAGE (PAGE_SIZE * 26)
/* Use 4MB hibernation chunks */
#define HIBERNATE_CHUNK_SIZE 0x400000
diff --git a/sys/dev/acpi/acpivar.h b/sys/dev/acpi/acpivar.h
index 2960bacb65d..f7aaba803c9 100644
--- a/sys/dev/acpi/acpivar.h
+++ b/sys/dev/acpi/acpivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpivar.h,v 1.78 2014/11/22 18:31:46 mlarkin Exp $ */
+/* $OpenBSD: acpivar.h,v 1.79 2014/12/08 07:12:37 mlarkin Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -19,6 +19,7 @@
#define _DEV_ACPI_ACPIVAR_H_
#define ACPI_TRAMPOLINE (19 * NBPG)
+#define ACPI_TRAMP_DATA (20 * NBPG)
#ifndef _ACPI_WAKECODE