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 ; This program and the accompanying materials are licensed and made available
11 ; under the terms and conditions of the BSD License which accompanies this
12 ; distribution. The full text of the license may be found at
13 ; http://opensource.org/licenses/bsd-license.php
15 ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
16 ; WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 ;------------------------------------------------------------------------------
20 ; enable this macro for debug messages
58 DebugLog StrUnkownFunction
70 DebugLog StrEnterGetInfo
72 ; target (es:di) set on input
76 ; source (ds:si) set now
97 DebugLog StrEnterGetModeInfo
99 and cx, ~0x4000 ; clear potentially set LFB bit in mode number
102 DebugLog StrUnkownMode
105 ; target (es:di) set on input
109 ; source (ds:si) set now
123 %define ATT_ADDRESS_REGISTER 0x03c0
124 %define VBE_DISPI_IOPORT_INDEX 0x01ce
125 %define VBE_DISPI_IOPORT_DATA 0x01d0
127 %define VBE_DISPI_INDEX_XRES 0x1
128 %define VBE_DISPI_INDEX_YRES 0x2
129 %define VBE_DISPI_INDEX_BPP 0x3
130 %define VBE_DISPI_INDEX_ENABLE 0x4
131 %define VBE_DISPI_INDEX_BANK 0x5
132 %define VBE_DISPI_INDEX_VIRT_WIDTH 0x6
133 %define VBE_DISPI_INDEX_VIRT_HEIGHT 0x7
134 %define VBE_DISPI_INDEX_X_OFFSET 0x8
135 %define VBE_DISPI_INDEX_Y_OFFSET 0x9
137 %define VBE_DISPI_ENABLED 0x01
138 %define VBE_DISPI_LFB_ENABLED 0x40
144 mov dx, VBE_DISPI_IOPORT_INDEX
148 mov dx, VBE_DISPI_IOPORT_DATA
160 DebugLog StrEnterSetMode
164 DebugLog StrUnkownMode
169 mov dx, ATT_ADDRESS_REGISTER
173 BochsWrite VBE_DISPI_INDEX_ENABLE, 0
174 BochsWrite VBE_DISPI_INDEX_BANK, 0
175 BochsWrite VBE_DISPI_INDEX_X_OFFSET, 0
176 BochsWrite VBE_DISPI_INDEX_Y_OFFSET, 0
177 BochsWrite VBE_DISPI_INDEX_BPP, 32
178 BochsWrite VBE_DISPI_INDEX_XRES, 1024
179 BochsWrite VBE_DISPI_INDEX_VIRT_WIDTH, 1024
180 BochsWrite VBE_DISPI_INDEX_YRES, 768
181 BochsWrite VBE_DISPI_INDEX_VIRT_HEIGHT, 768
182 BochsWrite VBE_DISPI_INDEX_ENABLE, VBE_DISPI_ENABLED | VBE_DISPI_LFB_ENABLED
190 DebugLog StrEnterGetMode
196 DebugLog StrGetPmCapabilities
206 DebugLog StrEnterSetModeLegacy
212 DebugLog StrUnkownMode
216 jmp SetModeLegacyDone
220 DebugLog StrExitSuccess
225 DebugLog StrExitSuccess
231 DebugLog StrExitUnsupported
239 push ds ; save original
248 jmp PrintStringSiLoop
250 pop ds ; restore original
259 db 'Unsupported', 0x0a, 0
262 db 'Unknown Function', 0x0a, 0
265 db 'GetInfo', 0x0a, 0
268 db 'GetModeInfo', 0x0a, 0
271 db 'GetMode', 0x0a, 0
274 db 'SetMode', 0x0a, 0
276 StrEnterSetModeLegacy:
277 db 'SetModeLegacy', 0x0a, 0
280 db 'Unkown Mode', 0x0a, 0
282 StrGetPmCapabilities:
283 db 'GetPmCapabilities', 0x0a, 0
286 db 'ReadEdid', 0x0a, 0