summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorMike Larkin <mlarkin@cvs.openbsd.org>2011-07-09 03:10:28 +0000
committerMike Larkin <mlarkin@cvs.openbsd.org>2011-07-09 03:10:28 +0000
commit78d2549fcc7ccef17705243f56b8c0c8ef1cc341 (patch)
tree93f2c6d316fff0cf61f1e50260b3fc851fbddb15 /sys/kern
parent40c354d61763b4d2919ca2a8d30cd90f0d335b12 (diff)
Call (temporarily, until we have RLE page encoding) uvm_pmr_zero_everything
on suspend to ensure we get good zlib compression. Add MI signature block (hibernate_info) comparison routine
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/subr_hibernate.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/sys/kern/subr_hibernate.c b/sys/kern/subr_hibernate.c
index 69cfb2f25ca..1e01e618a8e 100644
--- a/sys/kern/subr_hibernate.c
+++ b/sys/kern/subr_hibernate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_hibernate.c,v 1.11 2011/07/09 01:30:39 mlarkin Exp $ */
+/* $OpenBSD: subr_hibernate.c,v 1.12 2011/07/09 03:10:27 mlarkin Exp $ */
/*
* Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl>
@@ -819,3 +819,34 @@ hibernate_check_overlap(paddr_t r1s, paddr_t r1e, paddr_t r2s, paddr_t r2e)
return (0);
}
+
+/*
+ * hibernate_compare_signature
+ *
+ * Compare two hibernate_infos to determine if they are the same (eg,
+ * we should be performing a hibernate resume on this machine.
+ * Not all fields are checked - just enough to verify that the machine
+ * has the same memory configuration and kernel as the one that
+ * wrote the signature previously.
+ */
+int
+hibernate_compare_signature(union hibernate_info *mine,
+ union hibernate_info *disk)
+{
+ u_int i;
+
+ if (mine->nranges != disk->nranges)
+ return (1);
+
+ if (strcmp(mine->kernel_version, disk->kernel_version) != 0)
+ return (1);
+
+ for (i=0; i< mine->nranges; i++) {
+ if ((mine->ranges[i].base != disk->ranges[i].base) ||
+ (mine->ranges[i].end != disk->ranges[i].end) )
+ return (1);
+ }
+
+ return (0);
+}
+