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.
6 ; Copyright (C) 2020, Rebecca Cran <rebecca@bsdio.com>
7 ; Copyright (C) 2015, Nahanni Systems, Inc.
8 ; Copyright (C) 2014, Red Hat, Inc.
9 ; Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>
11 ; SPDX-License-Identifier: BSD-2-Clause-Patent
13 ;------------------------------------------------------------------------------
15 ; enable this macro for debug messages
43 TIMES 56 nop ; filler for 256 bytes
60 DebugLog StrUnkownFunction
72 DebugLog StrEnterGetInfo
74 ; target (es:di) set on input
78 ; source (ds:si) set now
99 DebugLog StrEnterGetModeInfo
101 and cx, ~0x4000 ; clear potentially set LFB bit in mode number
110 DebugLog StrUnkownMode
130 ; target (es:di) set on input
134 ; source (ds:si) set now
153 DebugLog StrEnterSetMode
155 and bx, ~0x4000 ; clear potentially set LFB bit in mode number
162 DebugLog StrUnkownMode
185 DebugLog StrEnterGetMode
192 DebugLog StrGetPmCapabilities
206 ; target (es:di) set on input
210 ; source (ds:si) set now
225 DebugLog StrEnterSetModeLegacy
231 DebugLog StrUnkownMode
234 DebugLog StrLegacyMode3
236 jmp SetModeLegacyDone
240 DebugLog StrExitSuccess
245 DebugLog StrExitSuccess
251 DebugLog StrExitUnsupported
259 push ds ; save original
262 mov dx, 0x220 ; bhyve debug cons port
269 jmp PrintStringSiLoop
271 pop ds ; restore original
277 db 'vOk', 0x0d, 0x0a, 0
280 db 'vUnsupported', 0x0d, 0x0a, 0
283 db 'vUnknown Function', 0x0d, 0x0a, 0
286 db 'vGetInfo', 0x0d, 0x0a, 0
289 db 'vGetModeInfo', 0x0d, 0x0a, 0
292 db 'vGetMode', 0x0d, 0x0a, 0
295 db 'vSetMode', 0x0d, 0x0a, 0
297 StrEnterSetModeLegacy:
298 db 'vSetModeLegacy', 0x0d, 0x0a, 0
301 db 'vUnkown Mode', 0x0d, 0x0a, 0
303 StrGetPmCapabilities:
304 db 'vGetPmCapabilities', 0x0d, 0x0a, 0
307 db 'vReadEdid', 0x0d, 0x0a, 0
310 db 'vLegacyMode3', 0x0d, 0x0a, 0
314 db 'mode_640x480x32', 0x0d, 0x0a, 0
316 db 'mode_800x600x32', 0x0d, 0x0a, 0
318 db 'mode_1024x768x32', 0x0d, 0x0a, 0
320 db 'mode_unused', 0x0d, 0x0a, 0
327 ; EDID stores monitor information. For now, just send back an null item.
330 db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
331 db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
332 db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
333 db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
334 db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
335 db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
336 db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
337 db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
338 db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
339 db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
340 db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
341 db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
342 db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00