summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMike Larkin <mlarkin@cvs.openbsd.org>2011-07-09 01:30:40 +0000
committerMike Larkin <mlarkin@cvs.openbsd.org>2011-07-09 01:30:40 +0000
commitfcb72f95947e42c2d4ae9d7baa5d0fca11be731e (patch)
tree9d2cd0300c27c22571aa67bf913639c06a927c6d /sys/arch
parentb62ede43b6ac09cc9ba3315db12e28c440c2cce1 (diff)
Extract hibernate_write_signature and hibernate_clear_signature to the MI
hibernate code, and add chunk range overlap checking.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/i386/i386/hibernate_machdep.c50
1 files changed, 1 insertions, 49 deletions
diff --git a/sys/arch/i386/i386/hibernate_machdep.c b/sys/arch/i386/i386/hibernate_machdep.c
index 61f3809829d..cb7f194b1b6 100644
--- a/sys/arch/i386/i386/hibernate_machdep.c
+++ b/sys/arch/i386/i386/hibernate_machdep.c
@@ -54,9 +54,6 @@ void hibernate_enter_resume_4k_pde(vaddr_t);
void hibernate_enter_resume_4m_pde(vaddr_t, paddr_t);
void hibernate_populate_resume_pt(paddr_t *, paddr_t *);
int get_hibernate_info_md(union hibernate_info *);
-int hibernate_write_signature(void);
-int hibernate_clear_signature(void);
-int hibernate_inflate_skip(paddr_t);
union hibernate_info *global_hiber_info;
paddr_t global_image_start;
@@ -324,7 +321,7 @@ hibernate_write_image()
}
/* Image write complete, write the signature and return */
- return hibernate_write_signature();
+ return hibernate_write_signature(&hiber_info);
}
int
@@ -489,51 +486,6 @@ hibernate_resume()
hibernate_resume_machine();
}
-int
-hibernate_write_signature()
-{
- union hibernate_info hiber_info;
- u_int8_t *io_page;
-
- /* Get current running machine's hibernate info */
- if (get_hibernate_info(&hiber_info))
- return (1);
-
- io_page = malloc(PAGE_SIZE, M_DEVBUF, M_NOWAIT);
- if (!io_page)
- return (1);
-
- /* Write hibernate info to disk */
- hiber_info.io_func(hiber_info.device, hiber_info.sig_offset,
- (vaddr_t)&hiber_info, 512, 1, io_page);
-
- free(io_page, M_DEVBUF);
-
- return (0);
-}
-
-int
-hibernate_clear_signature()
-{
- union hibernate_info hiber_info;
- u_int8_t *io_page;
-
- /* Zero out a blank hiber_info */
- bzero(&hiber_info, sizeof(hiber_info));
-
- io_page = malloc(PAGE_SIZE, M_DEVBUF, M_NOWAIT);
- if (!io_page)
- return (1);
-
- /* Write (zeroed) hibernate info to disk */
- hiber_info.io_func(hiber_info.device, hiber_info.sig_offset,
- (vaddr_t)&hiber_info, 512, 1, io_page);
-
- free(io_page, M_DEVBUF);
-
- return (0);
-}
-
/*
* hibernate_inflate_skip
*