1 ;------------------------------------------------------------------------------
3 ; A minimal Int10h stub that allows the Windows 2008 R2 SP1 UEFI guest's buggy,
4 ; default VGA driver to switch to 1024x768x32, on the stdvga and QXL video
7 ; Copyright (C) 2014, Red Hat, Inc.
8 ; Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>
10 ; SPDX-License-Identifier: BSD-2-Clause-Patent
12 ;------------------------------------------------------------------------------
14 ; enable this macro for debug messages
52 DebugLog StrUnkownFunction
64 DebugLog StrEnterGetInfo
66 ; target (es:di) set on input
70 ; source (ds:si) set now
91 DebugLog StrEnterGetModeInfo
93 and cx, ~0x4000 ; clear potentially set LFB bit in mode number
96 DebugLog StrUnkownMode
99 ; target (es:di) set on input
103 ; source (ds:si) set now
117 %define ATT_ADDRESS_REGISTER 0x03c0
118 %define VBE_DISPI_IOPORT_INDEX 0x01ce
119 %define VBE_DISPI_IOPORT_DATA 0x01d0
121 %define VBE_DISPI_INDEX_XRES 0x1
122 %define VBE_DISPI_INDEX_YRES 0x2
123 %define VBE_DISPI_INDEX_BPP 0x3
124 %define VBE_DISPI_INDEX_ENABLE 0x4
125 %define VBE_DISPI_INDEX_BANK 0x5
126 %define VBE_DISPI_INDEX_VIRT_WIDTH 0x6
127 %define VBE_DISPI_INDEX_VIRT_HEIGHT 0x7
128 %define VBE_DISPI_INDEX_X_OFFSET 0x8
129 %define VBE_DISPI_INDEX_Y_OFFSET 0x9
131 %define VBE_DISPI_ENABLED 0x01
132 %define VBE_DISPI_LFB_ENABLED 0x40
138 mov dx, VBE_DISPI_IOPORT_INDEX
142 mov dx, VBE_DISPI_IOPORT_DATA
154 DebugLog StrEnterSetMode
158 DebugLog StrUnkownMode
163 mov dx, ATT_ADDRESS_REGISTER
167 BochsWrite VBE_DISPI_INDEX_ENABLE, 0
168 BochsWrite VBE_DISPI_INDEX_BANK, 0
169 BochsWrite VBE_DISPI_INDEX_X_OFFSET, 0
170 BochsWrite VBE_DISPI_INDEX_Y_OFFSET, 0
171 BochsWrite VBE_DISPI_INDEX_BPP, 32
172 BochsWrite VBE_DISPI_INDEX_XRES, 1024
173 BochsWrite VBE_DISPI_INDEX_VIRT_WIDTH, 1024
174 BochsWrite VBE_DISPI_INDEX_YRES, 768
175 BochsWrite VBE_DISPI_INDEX_VIRT_HEIGHT, 768
176 BochsWrite VBE_DISPI_INDEX_ENABLE, VBE_DISPI_ENABLED | VBE_DISPI_LFB_ENABLED
184 DebugLog StrEnterGetMode
190 DebugLog StrGetPmCapabilities
200 DebugLog StrEnterSetModeLegacy
206 DebugLog StrUnkownMode
210 jmp SetModeLegacyDone
214 DebugLog StrExitSuccess
219 DebugLog StrExitSuccess
225 DebugLog StrExitUnsupported
233 push ds ; save original
242 jmp PrintStringSiLoop
244 pop ds ; restore original
253 db 'Unsupported', 0x0a, 0
256 db 'Unknown Function', 0x0a, 0
259 db 'GetInfo', 0x0a, 0
262 db 'GetModeInfo', 0x0a, 0
265 db 'GetMode', 0x0a, 0
268 db 'SetMode', 0x0a, 0
270 StrEnterSetModeLegacy:
271 db 'SetModeLegacy', 0x0a, 0
274 db 'Unkown Mode', 0x0a, 0
276 StrGetPmCapabilities:
277 db 'GetPmCapabilities', 0x0a, 0
280 db 'ReadEdid', 0x0a, 0