diff options
author | Mike Larkin <mlarkin@cvs.openbsd.org> | 2011-05-08 23:04:37 +0000 |
---|---|---|
committer | Mike Larkin <mlarkin@cvs.openbsd.org> | 2011-05-08 23:04:37 +0000 |
commit | 0f48b8da1be41c9d51bae8163c8e75c5a4a95577 (patch) | |
tree | 2c63e48610130a9fef166db775d98af60304543b /sys | |
parent | 3dd606e1bf08988c4444090b7da2ec09aa7c71ea (diff) |
Fix a few minor issues in i386 hibernate support code relating to
improper swap dev determination and memory range calculation. Also
fix a knf issue.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/i386/i386/hibernate_machdep.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/arch/i386/i386/hibernate_machdep.c b/sys/arch/i386/i386/hibernate_machdep.c index 6c574ee3b62..c94fdf9985b 100644 --- a/sys/arch/i386/i386/hibernate_machdep.c +++ b/sys/arch/i386/i386/hibernate_machdep.c @@ -70,7 +70,7 @@ get_hibernate_io_function() #if NWD > 0 /* XXX - Only support wd hibernate presently */ - if (strcmp(findblkname(major(swapdev)), "wd") == 0) + if (strcmp(findblkname(major(swdevt[0].sw_dev)), "wd") == 0) return wd_hibernate_io; else return NULL; @@ -99,9 +99,9 @@ get_hibernate_info(struct hibernate_info *hiber_info) hiber_info->image_size = 0; for(i=0; i<ndumpmem; i++) { - hiber_info->ranges[i].base = dumpmem[i].start; + hiber_info->ranges[i].base = dumpmem[i].start * PAGE_SIZE; hiber_info->ranges[i].end = - (dumpmem[i].start + dumpmem[i].end * PAGE_SIZE); + (dumpmem[i].end * PAGE_SIZE); hiber_info->image_size += hiber_info->ranges[i].end - hiber_info->ranges[i].base; } @@ -129,8 +129,9 @@ get_hibernate_info(struct hibernate_info *hiber_info) } /* Calculate signature block offset in swap */ - hiber_info->sig_offset = DL_BLKTOSEC(&dl, (dl.d_partitions[1].p_size - 1)) * - DL_BLKSPERSEC(&dl); + hiber_info->sig_offset = DL_BLKTOSEC(&dl, + dl.d_partitions[1].p_size - 1)) * + DL_BLKSPERSEC(&dl); /* Calculate memory image offset in swap */ hiber_info->image_offset = dl.d_partitions[1].p_offset + @@ -229,6 +230,7 @@ hibernate_write_image() pmap_kenter_pa(HIBERNATE_TEMP_PAGE, HIBERNATE_TEMP_PAGE, VM_PROT_ALL); pmap_kenter_pa(HIBERNATE_ALLOC_PAGE, HIBERNATE_ALLOC_PAGE, VM_PROT_ALL); + pmap_kenter_pa(HIBERNATE_IO_PAGE, HIBERNATE_IO_PAGE, VM_PROT_ALL); blkctr = hiber_info.image_offset; @@ -236,7 +238,7 @@ hibernate_write_image() range_base = hiber_info.ranges[i].base; range_end = hiber_info.ranges[i].end; - for (j=0; j < (range_end - range_base)/NBPG; + for (j=0; j < (range_end - range_base); blkctr += (NBPG/512), j += NBPG) { addr = range_base + j; pmap_kenter_pa(HIBERNATE_TEMP_PAGE, addr, |