From cf7de4af9cb60296225e95bad423209ab5704518 Mon Sep 17 00:00:00 2001 From: Ivan Baravy Date: Fri, 2 Nov 2018 00:14:46 +0000 Subject: [PATCH] Fix kernel crash on high screen resolution. Increase MAX_SCREEN_WIDTH=3840 and MAX_SCREEN_HEIGHT=2160. Replace hardcoded numbers with macros, add runtime checks. git-svn-id: svn://kolibrios.org@7522 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/const.inc | 3 +++ kernel/trunk/data32.inc | 4 ++-- kernel/trunk/video/framebuffer.inc | 4 ++++ kernel/trunk/video/vesa20.inc | 4 ++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/kernel/trunk/const.inc b/kernel/trunk/const.inc index e454517772..29db8e50b3 100644 --- a/kernel/trunk/const.inc +++ b/kernel/trunk/const.inc @@ -733,6 +733,9 @@ virtual at OS_BASE + BOOT_VARS BOOT boot_data end virtual +MAX_SCREEN_WIDTH = 3840 +MAX_SCREEN_HEIGHT = 2160 + struct display_t x dd ? y dd ? diff --git a/kernel/trunk/data32.inc b/kernel/trunk/data32.inc index 2fa23dd1d5..340b6b1577 100644 --- a/kernel/trunk/data32.inc +++ b/kernel/trunk/data32.inc @@ -341,8 +341,8 @@ fpu_data: fpu_data_size = $ - fpu_data draw_data: rb 32*256 -BPSLine_calc_area rd 1440 -d_width_calc_area rd 1140 +BPSLine_calc_area rd MAX_SCREEN_HEIGHT +d_width_calc_area rd MAX_SCREEN_HEIGHT mouseunder rd 16*24 mem_block_list rd 64*2 diff --git a/kernel/trunk/video/framebuffer.inc b/kernel/trunk/video/framebuffer.inc index 854aeddcaf..8dbef71101 100644 --- a/kernel/trunk/video/framebuffer.inc +++ b/kernel/trunk/video/framebuffer.inc @@ -45,6 +45,8 @@ init_video: mov [_display.vrefresh], 60 movzx eax, word [BOOT.x_res]; X max + cmp eax, MAX_SCREEN_WIDTH + ja $ mov [_display.width], eax mov [ebp+FRB.width], eax mov [display_width_standard], eax @@ -52,6 +54,8 @@ init_video: mov [screen_workarea.right], eax movzx eax, word [BOOT.y_res]; Y max + cmp eax, MAX_SCREEN_HEIGHT + ja $ mov [_display.height], eax mov [ebp+FRB.height], eax mov [display_height_standard], eax diff --git a/kernel/trunk/video/vesa20.inc b/kernel/trunk/video/vesa20.inc index e6cbecd231..19b16d07d1 100644 --- a/kernel/trunk/video/vesa20.inc +++ b/kernel/trunk/video/vesa20.inc @@ -21,8 +21,8 @@ $Revision$ uglobal align 4 - bgr_cur_line rd 1920 ; maximum width of screen - bgr_next_line rd 1920 + bgr_cur_line rd MAX_SCREEN_WIDTH + bgr_next_line rd MAX_SCREEN_WIDTH endg iglobal