2
* GRUB -- GRand Unified Bootloader
3
* Copyright (C) 1999,2000,2001,2002,2003,2005,2006,2007,2008 Free Software Foundation, Inc.
5
* GRUB is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* (at your option) any later version.
10
* GRUB is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19
#include <grub/symbol.h>
20
#include <grub/i386/memory.h>
26
* grub_vbe_bios_status_t grub_vbe_get_controller_info (struct grub_vbe_info_block *controller_info)
28
* Register allocations for parameters:
29
* %eax *controller_info
31
FUNCTION(grub_vbe_bios_get_controller_info)
36
movw %ax, %di /* Store *controller_info to %edx:%di. */
39
mov %eax, %edx /* PROT_TO_REAL destroys %eax. */
46
movw %dx, %es /* *controller_info is now on %es:%di. */
50
movw %ax, %dx /* REAL_TO_PROT destroys %eax. */
58
andl $0x0FFFF, %eax /* Return value in %eax. */
66
* grub_vbe_status_t grub_vbe_bios_get_mode_info (grub_uint32_t mode,
67
* struct grub_vbe_mode_info_block *mode_info)
69
* Register allocations for parameters:
73
FUNCTION(grub_vbe_bios_get_mode_info)
77
movl %eax, %ecx /* Store mode number to %ecx. */
79
movw %dx, %di /* Store *mode_info to %edx:%di. */
88
movw %dx, %es /* *mode_info is now on %es:%di. */
92
movw %ax, %dx /* REAL_TO_PROT destroys %eax. */
100
andl $0x0FFFF, %eax /* Return value in %eax. */
107
* grub_vbe_status_t grub_vbe_bios_set_mode (grub_uint32_t mode,
108
* struct grub_vbe_crtc_info_block *crtc_info)
110
* Register allocations for parameters:
114
FUNCTION(grub_vbe_bios_set_mode)
119
movl %eax, %ebx /* Store mode in %ebx. */
121
movw %dx, %di /* Store *crtc_info to %edx:%di. */
130
movw %dx, %es /* *crtc_info is now on %es:%di. */
135
movw %ax, %dx /* REAL_TO_PROT destroys %eax. */
143
andl $0xFFFF, %eax /* Return value in %eax. */
151
* grub_vbe_status_t grub_vbe_bios_get_mode (grub_uint32_t *mode)
153
* Register allocations for parameters:
156
FUNCTION(grub_vbe_bios_get_mode)
161
pushl %eax /* Push *mode to stack. */
169
movw %ax, %dx /* REAL_TO_PROT destroys %eax. */
174
popl %edi /* Pops *mode from stack to %edi. */
179
andl $0xFFFF, %eax /* Return value in %eax. */
188
* grub_vbe_status_t grub_vbe_bios_getset_dac_palette_width (int set, int *dac_mask_size)
190
* Register allocations for parameters:
192
* %edx *dac_mask_size
194
FUNCTION(grub_vbe_bios_getset_dac_palette_width)
200
/* If we only want to fetch the value, set %bl to 1. */
206
/* Put desired width in %bh. */
216
movw %ax, %cx /* REAL_TO_PROT destroys %eax. */
221
/* Move result back to *dac_mask_size. */
233
* grub_vbe_status_t grub_vbe_bios_set_memory_window (grub_uint32_t window,
234
* grub_uint32_t position);
236
* Register allocations for parameters:
240
FUNCTION(grub_vbe_bios_set_memory_window)
250
andw $0x00ff, %bx /* BL = window, BH = 0, Set memory window. */
253
movw %ax, %dx /* REAL_TO_PROT destroys %eax. */
259
andl $0xFFFF, %eax /* Return value in %eax. */
266
* grub_vbe_status_t grub_vbe_bios_get_memory_window (grub_uint32_t window,
267
* grub_uint32_t *position);
269
* Register allocations for parameters:
273
FUNCTION(grub_vbe_bios_get_memory_window)
277
pushl %edx /* Push *position to stack. */
279
movl %eax, %ebx /* Store window in %ebx. */
285
andw $0x00ff, %bx /* BL = window. */
286
orw $0x0100, %bx /* BH = 1, Get memory window. */
289
movw %ax, %bx /* REAL_TO_PROT destroys %eax. */
294
popl %edi /* pops *position from stack to %edi. */
296
movl %edx, (%edi) /* Return position to caller. */
299
andl $0xFFFF, %eax /* Return value in %eax. */
307
* grub_vbe_status_t grub_vbe_bios_set_scanline_length (grub_uint32_t length)
309
* Register allocations for parameters:
312
FUNCTION(grub_vbe_bios_set_scanline_length)
317
movl %eax, %ecx /* Store length in %ecx. */
323
movw $0x0002, %bx /* BL = 2, Set Scan Line in Bytes. */
326
movw %ax, %dx /* REAL_TO_PROT destroys %eax. */
332
andl $0xFFFF, %eax /* Return value in %eax. */
340
* grub_vbe_status_t grub_vbe_bios_get_scanline_length (grub_uint32_t *length)
342
* Register allocations for parameters:
345
FUNCTION(grub_vbe_bios_get_scanline_length)
349
pushl %edx /* Push *length to stack. */
355
movw $0x0001, %bx /* BL = 1, Get Scan Line Length (in bytes). */
358
movw %ax, %dx /* REAL_TO_PROT destroys %eax. */
363
popl %edi /* Pops *length from stack to %edi. */
365
movl %ebx, (%edi) /* Return length to caller. */
368
andl $0xFFFF, %eax /* Return value in %eax. */
376
* grub_vbe_status_t grub_vbe_bios_set_display_start (grub_uint32_t x,
379
* Register allocations for parameters:
383
FUNCTION(grub_vbe_bios_set_display_start)
387
movl %eax, %ecx /* Store x in %ecx. */
393
movw $0x0080, %bx /* BL = 80h, Set Display Start
394
during Vertical Retrace. */
397
movw %ax, %dx /* REAL_TO_PROT destroys %eax. */
403
andl $0xFFFF, %eax /* Return value in %eax. */
410
* grub_vbe_status_t grub_vbe_bios_get_display_start (grub_uint32_t *x,
413
* Register allocations for parameters:
417
FUNCTION(grub_vbe_bios_get_display_start)
421
pushl %eax /* Push *x to stack. */
422
pushl %edx /* Push *y to stack. */
428
movw $0x0001, %bx /* BL = 1, Get Display Start. */
431
movw %ax, %bx /* REAL_TO_PROT destroys %eax. */
436
popl %edi /* Pops *y from stack to %edi. */
438
movl %edx, (%edi) /* Return y-position to caller. */
440
popl %edi /* Pops *x from stack to %edi. */
442
movl %ecx, (%edi) /* Return x-position to caller. */
445
andl $0xFFFF, %eax /* Return value in %eax. */
453
* grub_vbe_status_t grub_vbe_bios_set_palette_data (grub_uint32_t color_count,
454
* grub_uint32_t start_index,
455
* struct grub_vbe_palette_data *palette_data)
457
* Register allocations for parameters:
462
FUNCTION(grub_vbe_bios_set_palette_data)
467
movl %eax, %ebx /* Store color_count in %ebx. */
469
movw %cx, %di /* Store *palette_data to %ecx:%di. */
478
movw %cx, %es /* *palette_data is now on %es:%di. */
479
movw %bx, %cx /* color_count is now on %cx. */
482
xorw %bx, %bx /* BL = 0, Set Palette Data. */
485
movw %ax, %dx /* REAL_TO_PROT destroys %eax. */
493
andl $0xFFFF, %eax /* Return value in %eax. */