From 4c7a7f266f103350f6e2a4a4c68aff5a7c494f09 Mon Sep 17 00:00:00 2001 From: Jung-uk Kim Date: Wed, 4 Apr 2012 21:38:26 +0000 Subject: [PATCH] Do not copy VESA state buffer if the VBE call has failed for any reason. Do not unnecessarily clear the state buffer before calling the function. --- sys/dev/fb/vesa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/fb/vesa.c b/sys/dev/fb/vesa.c index 78c29c1e855e..bd13461ed7ee 100644 --- a/sys/dev/fb/vesa.c +++ b/sys/dev/fb/vesa.c @@ -542,7 +542,8 @@ vesa_bios_save_restore(int code, void *p) switch (code) { case STATE_SAVE: x86bios_intr(®s, 0x10); - bcopy(vesa_state_buf, p, vesa_state_buf_size); + if (regs.R_AX == 0x004f) + bcopy(vesa_state_buf, p, vesa_state_buf_size); break; case STATE_LOAD: bcopy(p, vesa_state_buf, vesa_state_buf_size); @@ -1481,7 +1482,6 @@ vesa_save_state(video_adapter_t *adp, void *p, size_t size) } else vesa_vmem_buf = NULL; ((adp_state_t *)p)->sig = V_STATE_SIG; - bzero(((adp_state_t *)p)->regs, vesa_state_buf_size); return (vesa_bios_save_restore(STATE_SAVE, ((adp_state_t *)p)->regs)); }