diff options
author | 2011-05-08 23:04:36 +0000 | |
---|---|---|
committer | 2011-05-08 23:04:36 +0000 | |
commit | e8199875ce3022e7a21bd93b26f6742f40a141b4 (patch) | |
tree | 8f54b13c559ba53526bfd016f9e305a8ac88f780 | |
parent | Reset last pane properly when using break-pane as well, fixes a problem (diff) | |
download | wireguard-openbsd-e8199875ce3022e7a21bd93b26f6742f40a141b4.tar.xz wireguard-openbsd-e8199875ce3022e7a21bd93b26f6742f40a141b4.zip |
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.
-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, |