-/* $OpenBSD: hibernate_machdep.c,v 1.48 2022/01/17 02:54:28 mlarkin Exp $ */
+/* $OpenBSD: hibernate_machdep.c,v 1.49 2022/09/02 09:02:37 mlarkin Exp $ */
/*
* Copyright (c) 2012 Mike Larkin <mlarkin@openbsd.org>
int
hibernate_inflate_skip(union hibernate_info *hib_info, paddr_t dest)
{
- extern char __retguard_start_phys, __retguard_end_phys;
+ extern paddr_t retguard_start_phys, retguard_end_phys;
if (dest >= hib_info->piglet_pa &&
dest <= (hib_info->piglet_pa + 4 * HIBERNATE_CHUNK_SIZE))
return (HIB_SKIP);
- if (dest >= ((paddr_t)&__retguard_start_phys) &&
- dest <= ((paddr_t)&__retguard_end_phys))
+ if (dest >= retguard_start_phys && dest <= retguard_end_phys)
return (HIB_MOVE);
return (0);
-/* $OpenBSD: ld.script,v 1.17 2021/03/07 23:10:54 mortimer Exp $ */
+/* $OpenBSD: ld.script,v 1.18 2022/09/02 09:02:37 mlarkin Exp $ */
/*
* Copyright (c) 2009 Tobias Weingartner <weingart@tepid.org>
.openbsd.randomdata : AT (__kernel_randomdata_phys)
{
__retguard_start = ABSOLUTE(.);
- __retguard_start_phys = . + __kernel_virt_to_phys;
*(.openbsd.randomdata.retguard .openbsd.randomdata.retguard.*)
. = ALIGN(__ALIGN_SIZE);
__retguard_end = ABSOLUTE(.);
- __retguard_end_phys = . + __kernel_virt_to_phys;
*(.openbsd.randomdata .openbsd.randomdata.*)
} :rodata :openbsd_randomize =0xcccccccc
. = ALIGN(0x1000);
-/* $OpenBSD: subr_hibernate.c,v 1.136 2022/09/01 21:50:19 mlarkin Exp $ */
+/* $OpenBSD: subr_hibernate.c,v 1.137 2022/09/02 09:02:37 mlarkin Exp $ */
/*
* Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl>
extern long __guard_local;
#endif /* ! NO_PROPOLICE */
+/* Retguard phys address (need to skip this region during unpack) */
+paddr_t retguard_start_phys, retguard_end_phys;
+extern char __retguard_start, __retguard_end;
+
void hibernate_copy_chunk_to_piglet(paddr_t, vaddr_t, size_t);
int hibernate_calc_rle(paddr_t, paddr_t);
int hibernate_write_rle(union hibernate_info *, paddr_t, paddr_t, daddr_t *,
goto fail;
}
+ pmap_extract(pmap_kernel(), (vaddr_t)&__retguard_start,
+ &retguard_start_phys);
+ pmap_extract(pmap_kernel(), (vaddr_t)&__retguard_end,
+ &retguard_end_phys);
+
hibernate_preserve_entropy(&disk_hib);
printf("Unpacking image...\n");
return (1);
}
+ pmap_extract(pmap_kernel(), (vaddr_t)&__retguard_start,
+ &retguard_start_phys);
+ pmap_extract(pmap_kernel(), (vaddr_t)&__retguard_end,
+ &retguard_end_phys);
+
/* Calculate block offsets in swap */
hib.image_offset = ctod(start);