~hamo/ubuntu/precise/grub2/grub2.hi_res

« back to all changes in this revision

Viewing changes to video/i386/pc/vbe_helper.S

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson, Colin Watson, Robert Millan, Updated translations
  • Date: 2010-11-22 12:24:56 UTC
  • mfrom: (1.26.4 upstream) (17.3.36 sid)
  • mto: (17.3.43 sid)
  • mto: This revision was merged to the branch mainline in revision 89.
  • Revision ID: james.westby@ubuntu.com-20101122122456-y82z3sfb7k4zfdcc
Tags: 1.99~20101122-1
[ Colin Watson ]
* New Bazaar snapshot.  Too many changes to list in full, but some of the
  more user-visible ones are as follows:
  - GRUB script:
    + Function parameters, "break", "continue", "shift", "setparams",
      "return", and "!".
    + "export" command supports multiple variable names.
    + Multi-line quoted strings support.
    + Wildcard expansion.
  - sendkey support.
  - USB hotunplugging and USB serial support.
  - Rename CD-ROM to cd on BIOS.
  - Add new --boot-directory option to grub-install, grub-reboot, and
    grub-set-default; the old --root-directory option is still accepted
    but was often confusing.
  - Basic btrfs detection/UUID support (but no file reading yet).
  - bash-completion for utilities.
  - If a device is listed in device.map, always assume that it is
    BIOS-visible rather than using extra layers such as LVM or RAID.
  - Add grub-mknetdir script (closes: #550658).
  - Remove deprecated "root" command.
  - Handle RAID devices containing virtio components.
  - GRUB Legacy configuration file support (via grub-menulst2cfg).
  - Keyboard layout support (via grub-mklayout and grub-kbdcomp).
  - Check generated grub.cfg for syntax errors before saving.
  - Pause execution for at most ten seconds if any errors are displayed,
    so that the user has a chance to see them.
  - Support submenus.
  - Write embedding zone using Reed-Solomon, so that it's robust against
    being partially overwritten (closes: #550702, #591416, #593347).
  - GRUB_DISABLE_LINUX_RECOVERY and GRUB_DISABLE_NETBSD_RECOVERY merged
    into a single GRUB_DISABLE_RECOVERY variable.
  - Fix loader memory allocation failure (closes: #551627).
  - Don't call savedefault on recovery entries (closes: #589325).
  - Support triple-indirect blocks on ext2 (closes: #543924).
  - Recognise DDF1 fake RAID (closes: #603354).

[ Robert Millan ]
* Use dpkg architecture wildcards.

[ Updated translations ]
* Slovenian (Vanja Cvelbar).  Closes: #604003
* Dzongkha (dawa pemo via Tenzin Dendup).  Closes: #604102

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *  GRUB  --  GRand Unified Bootloader
3
 
 *  Copyright (C) 1999,2000,2001,2002,2003,2005,2006,2007,2008 Free Software Foundation, Inc.
4
 
 *
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.
9
 
 *
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.
14
 
 *
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/>.
17
 
 */
18
 
 
19
 
#include <grub/symbol.h>
20
 
#include <grub/i386/memory.h>
21
 
        
22
 
        LOWMEM
23
 
        .code32
24
 
 
25
 
/*
26
 
 * grub_vbe_bios_status_t grub_vbe_get_controller_info (struct grub_vbe_info_block *controller_info)
27
 
 *
28
 
 * Register allocations for parameters:
29
 
 * %eax         *controller_info
30
 
 */
31
 
FUNCTION(grub_vbe_bios_get_controller_info)
32
 
        pushl   %ebp
33
 
        pushl   %edi
34
 
        pushl   %edx
35
 
 
36
 
        movw    %ax, %di        /* Store *controller_info to %edx:%di.  */
37
 
        xorw    %ax, %ax
38
 
        shrl    $4, %eax
39
 
        mov     %eax, %edx      /* PROT_TO_REAL destroys %eax.  */
40
 
 
41
 
        PROT_TO_REAL
42
 
        .code16
43
 
 
44
 
        pushw   %es
45
 
 
46
 
        movw    %dx, %es        /* *controller_info is now on %es:%di.  */
47
 
        movw    $0x4f00, %ax
48
 
        int     $0x10
49
 
 
50
 
        movw    %ax, %dx        /* REAL_TO_PROT destroys %eax.  */
51
 
 
52
 
        popw    %es
53
 
 
54
 
        REAL_TO_PROT
55
 
        .code32
56
 
 
57
 
        movl    %edx, %eax
58
 
        andl    $0x0FFFF, %eax  /* Return value in %eax.  */
59
 
 
60
 
        pop     %edx
61
 
        popl    %edi
62
 
        popl    %ebp
63
 
        ret
64
 
 
65
 
/*
66
 
 * grub_vbe_status_t grub_vbe_bios_get_mode_info (grub_uint32_t mode,
67
 
 *                                                struct grub_vbe_mode_info_block *mode_info)
68
 
 *
69
 
 * Register allocations for parameters:
70
 
 * %eax         mode
71
 
 * %edx         *mode_info
72
 
 */
73
 
FUNCTION(grub_vbe_bios_get_mode_info)
74
 
        pushl   %ebp
75
 
        pushl   %edi
76
 
 
77
 
        movl    %eax, %ecx      /* Store mode number to %ecx.  */
78
 
 
79
 
        movw    %dx, %di        /* Store *mode_info to %edx:%di.  */
80
 
        xorw    %dx, %dx
81
 
        shrl    $4, %edx
82
 
 
83
 
        PROT_TO_REAL
84
 
        .code16
85
 
 
86
 
        pushw   %es
87
 
 
88
 
        movw    %dx, %es        /* *mode_info is now on %es:%di.  */
89
 
        movw    $0x4f01, %ax
90
 
        int     $0x10
91
 
 
92
 
        movw    %ax, %dx        /* REAL_TO_PROT destroys %eax.  */
93
 
 
94
 
        popw    %es
95
 
 
96
 
        REAL_TO_PROT
97
 
        .code32
98
 
 
99
 
        movl    %edx, %eax
100
 
        andl    $0x0FFFF, %eax  /* Return value in %eax.  */
101
 
 
102
 
        popl    %edi
103
 
        popl    %ebp
104
 
        ret
105
 
 
106
 
/*
107
 
 * grub_vbe_status_t grub_vbe_bios_set_mode (grub_uint32_t mode,
108
 
 *                                           struct grub_vbe_crtc_info_block *crtc_info)
109
 
 *
110
 
 * Register allocations for parameters:
111
 
 * %eax         mode
112
 
 * %edx         *crtc_info
113
 
 */
114
 
FUNCTION(grub_vbe_bios_set_mode)
115
 
        pushl   %ebp
116
 
        pushl   %ebx
117
 
        pushl   %edi
118
 
 
119
 
        movl    %eax, %ebx      /* Store mode in %ebx.  */
120
 
 
121
 
        movw    %dx, %di        /* Store *crtc_info to %edx:%di.  */
122
 
        xorw    %dx, %dx
123
 
        shrl    $4, %edx
124
 
 
125
 
        PROT_TO_REAL
126
 
        .code16
127
 
 
128
 
        pushw   %es
129
 
 
130
 
        movw    %dx, %es        /* *crtc_info is now on %es:%di.  */
131
 
 
132
 
        movw    $0x4f02, %ax
133
 
        int     $0x10
134
 
 
135
 
        movw    %ax, %dx        /* REAL_TO_PROT destroys %eax.  */
136
 
 
137
 
        popw    %es
138
 
 
139
 
        REAL_TO_PROT
140
 
        .code32
141
 
 
142
 
        movw    %dx, %ax
143
 
        andl    $0xFFFF, %eax   /* Return value in %eax.  */
144
 
 
145
 
        popl    %edi
146
 
        popl    %ebx
147
 
        popl    %ebp
148
 
        ret
149
 
 
150
 
/*
151
 
 * grub_vbe_status_t grub_vbe_bios_get_mode (grub_uint32_t *mode)
152
 
 *
153
 
 * Register allocations for parameters:
154
 
 * %eax         *mode
155
 
 */
156
 
FUNCTION(grub_vbe_bios_get_mode)
157
 
        pushl   %ebp
158
 
        pushl   %ebx
159
 
        pushl   %edi
160
 
        pushl   %edx
161
 
        pushl   %eax            /* Push *mode to stack.  */
162
 
 
163
 
        PROT_TO_REAL
164
 
        .code16
165
 
 
166
 
        movw    $0x4f03, %ax
167
 
        int     $0x10
168
 
 
169
 
        movw    %ax, %dx        /* REAL_TO_PROT destroys %eax.  */
170
 
 
171
 
        REAL_TO_PROT
172
 
        .code32
173
 
 
174
 
        popl    %edi            /* Pops *mode from stack to %edi.  */
175
 
        andl    $0xFFFF, %ebx
176
 
        movl    %ebx, (%edi)
177
 
 
178
 
        movw    %dx, %ax
179
 
        andl    $0xFFFF, %eax   /* Return value in %eax.  */
180
 
 
181
 
        popl    %edx
182
 
        popl    %edi
183
 
        popl    %ebx
184
 
        popl    %ebp
185
 
        ret
186
 
 
187
 
/*
188
 
 * grub_vbe_status_t grub_vbe_bios_getset_dac_palette_width (int set, int *dac_mask_size)
189
 
 *
190
 
 * Register allocations for parameters:
191
 
 * %eax         set
192
 
 * %edx         *dac_mask_size
193
 
 */
194
 
FUNCTION(grub_vbe_bios_getset_dac_palette_width)
195
 
        pushl   %ebp
196
 
        pushl   %ebx
197
 
 
198
 
        xorl    %ebx, %ebx
199
 
 
200
 
        /* If we only want to fetch the value, set %bl to 1.  */
201
 
        testl   %eax, %eax
202
 
        jne     1f
203
 
        incb    %bl
204
 
1:
205
 
 
206
 
        /* Put desired width in %bh.  */
207
 
        movl    (%edx), %eax
208
 
        movb    %al, %bh
209
 
 
210
 
        PROT_TO_REAL
211
 
        .code16
212
 
 
213
 
        movw    $0x4f08, %ax
214
 
        int     $0x10
215
 
 
216
 
        movw    %ax, %cx        /* REAL_TO_PROT destroys %eax.  */
217
 
 
218
 
        REAL_TO_PROT
219
 
        .code32
220
 
 
221
 
        /* Move result back to *dac_mask_size.  */
222
 
        xor     %eax, %eax
223
 
        movb    %bh, %al
224
 
        movl    %eax, (%edx)
225
 
 
226
 
        movw    %cx, %ax
227
 
 
228
 
        popl    %ebx
229
 
        popl    %ebp
230
 
        ret
231
 
 
232
 
/*
233
 
 * grub_vbe_status_t grub_vbe_bios_set_memory_window (grub_uint32_t window,
234
 
 *                                                    grub_uint32_t position);
235
 
 *
236
 
 * Register allocations for parameters:
237
 
 * %eax         window
238
 
 * %edx         position
239
 
 */
240
 
FUNCTION(grub_vbe_bios_set_memory_window)
241
 
        pushl   %ebp
242
 
        pushl   %ebx
243
 
 
244
 
        movl    %eax, %ebx
245
 
 
246
 
        PROT_TO_REAL
247
 
        .code16
248
 
 
249
 
        movw    $0x4f05, %ax
250
 
        andw    $0x00ff, %bx    /* BL = window, BH = 0, Set memory window.  */
251
 
        int     $0x10
252
 
 
253
 
        movw    %ax, %dx        /* REAL_TO_PROT destroys %eax.  */
254
 
 
255
 
        REAL_TO_PROT
256
 
        .code32
257
 
 
258
 
        movw    %dx, %ax
259
 
        andl    $0xFFFF, %eax   /* Return value in %eax.  */
260
 
 
261
 
        popl    %ebx
262
 
        popl    %ebp
263
 
        ret
264
 
 
265
 
/*
266
 
 * grub_vbe_status_t grub_vbe_bios_get_memory_window (grub_uint32_t window,
267
 
 *                                                    grub_uint32_t *position);
268
 
 *
269
 
 * Register allocations for parameters:
270
 
 * %eax         window
271
 
 * %edx         *position
272
 
 */
273
 
FUNCTION(grub_vbe_bios_get_memory_window)
274
 
        pushl   %ebp
275
 
        pushl   %ebx
276
 
        pushl   %edi
277
 
        pushl   %edx            /* Push *position to stack.  */
278
 
 
279
 
        movl    %eax, %ebx      /* Store window in %ebx.  */
280
 
 
281
 
        PROT_TO_REAL
282
 
        .code16
283
 
 
284
 
        movw    $0x4f05, %ax
285
 
        andw    $0x00ff, %bx    /* BL = window.  */
286
 
        orw     $0x0100, %bx    /* BH = 1, Get memory window.  */
287
 
        int     $0x10
288
 
 
289
 
        movw    %ax, %bx        /* REAL_TO_PROT destroys %eax.  */
290
 
 
291
 
        REAL_TO_PROT
292
 
        .code32
293
 
 
294
 
        popl    %edi            /* pops *position from stack to %edi.  */
295
 
        andl    $0xFFFF, %edx
296
 
        movl    %edx, (%edi)    /* Return position to caller.  */
297
 
 
298
 
        movw    %bx, %ax
299
 
        andl    $0xFFFF, %eax   /* Return value in %eax.  */
300
 
 
301
 
        popl    %edi
302
 
        popl    %ebx
303
 
        popl    %ebp
304
 
        ret
305
 
 
306
 
/*
307
 
 * grub_vbe_status_t grub_vbe_bios_set_scanline_length (grub_uint32_t length)
308
 
 *
309
 
 * Register allocations for parameters:
310
 
 * %eax         length
311
 
 */
312
 
FUNCTION(grub_vbe_bios_set_scanline_length)
313
 
        pushl   %ebp
314
 
        pushl   %ebx
315
 
        pushl   %edx
316
 
 
317
 
        movl    %eax, %ecx      /* Store length in %ecx.  */
318
 
 
319
 
        PROT_TO_REAL
320
 
        .code16
321
 
 
322
 
        movw    $0x4f06, %ax
323
 
        movw    $0x0002, %bx    /* BL = 2, Set Scan Line in Bytes.  */
324
 
        int     $0x10
325
 
 
326
 
        movw    %ax, %dx        /* REAL_TO_PROT destroys %eax.  */
327
 
 
328
 
        REAL_TO_PROT
329
 
        .code32
330
 
 
331
 
        movw    %dx, %ax
332
 
        andl    $0xFFFF, %eax   /* Return value in %eax.  */
333
 
 
334
 
        popl    %edx
335
 
        popl    %ebx
336
 
        popl    %ebp
337
 
        ret
338
 
 
339
 
/*
340
 
 * grub_vbe_status_t grub_vbe_bios_get_scanline_length (grub_uint32_t *length)
341
 
 *
342
 
 * Register allocations for parameters:
343
 
 * %eax         *length
344
 
 */
345
 
FUNCTION(grub_vbe_bios_get_scanline_length)
346
 
        pushl   %ebp
347
 
        pushl   %ebx
348
 
        pushl   %edi
349
 
        pushl   %edx            /* Push *length to stack.  */
350
 
 
351
 
        PROT_TO_REAL
352
 
        .code16
353
 
 
354
 
        movw    $0x4f06, %ax
355
 
        movw    $0x0001, %bx    /* BL = 1, Get Scan Line Length (in bytes).  */
356
 
        int     $0x10
357
 
 
358
 
        movw    %ax, %dx        /* REAL_TO_PROT destroys %eax.  */
359
 
 
360
 
        REAL_TO_PROT
361
 
        .code32
362
 
 
363
 
        popl    %edi            /* Pops *length from stack to %edi.  */
364
 
        andl    $0xFFFF, %ebx
365
 
        movl    %ebx, (%edi)    /* Return length to caller.  */
366
 
 
367
 
        movw    %dx, %ax
368
 
        andl    $0xFFFF, %eax   /* Return value in %eax.  */
369
 
 
370
 
        popl    %edi
371
 
        popl    %ebx
372
 
        popl    %ebp
373
 
        ret
374
 
 
375
 
/*
376
 
 * grub_vbe_status_t grub_vbe_bios_set_display_start (grub_uint32_t x,
377
 
 *                                                    grub_uint32_t y)
378
 
 *
379
 
 * Register allocations for parameters:
380
 
 * %eax         x
381
 
 * %edx         y
382
 
 */
383
 
FUNCTION(grub_vbe_bios_set_display_start)
384
 
        pushl   %ebp
385
 
        pushl   %ebx
386
 
 
387
 
        movl    %eax, %ecx      /* Store x in %ecx.  */
388
 
 
389
 
        PROT_TO_REAL
390
 
        .code16
391
 
 
392
 
        movw    $0x4f07, %ax
393
 
        movw    $0x0080, %bx    /* BL = 80h, Set Display Start
394
 
                                   during Vertical Retrace.  */
395
 
        int     $0x10
396
 
 
397
 
        movw    %ax, %dx        /* REAL_TO_PROT destroys %eax.  */
398
 
 
399
 
        REAL_TO_PROT
400
 
        .code32
401
 
 
402
 
        movw    %dx, %ax
403
 
        andl    $0xFFFF, %eax   /* Return value in %eax.  */
404
 
 
405
 
        popl    %ebx
406
 
        popl    %ebp
407
 
        ret
408
 
 
409
 
/*
410
 
 * grub_vbe_status_t grub_vbe_bios_get_display_start (grub_uint32_t *x,
411
 
 *                                                    grub_uint32_t *y)
412
 
 *
413
 
 * Register allocations for parameters:
414
 
 * %eax         *x
415
 
 * %edx         *y
416
 
 */
417
 
FUNCTION(grub_vbe_bios_get_display_start)
418
 
        pushl   %ebp
419
 
        pushl   %ebx
420
 
        pushl   %edi
421
 
        pushl   %eax            /* Push *x to stack.  */
422
 
        pushl   %edx            /* Push *y to stack.  */
423
 
 
424
 
        PROT_TO_REAL
425
 
        .code16
426
 
 
427
 
        movw    $0x4f07, %ax
428
 
        movw    $0x0001, %bx    /* BL = 1, Get Display Start.  */
429
 
        int     $0x10
430
 
 
431
 
        movw    %ax, %bx        /* REAL_TO_PROT destroys %eax.  */
432
 
 
433
 
        REAL_TO_PROT
434
 
        .code32
435
 
 
436
 
        popl    %edi            /* Pops *y from stack to %edi.  */
437
 
        andl    $0xFFFF, %edx
438
 
        movl    %edx, (%edi)    /* Return y-position to caller.  */
439
 
 
440
 
        popl    %edi            /* Pops *x from stack to %edi.  */
441
 
        andl    $0xFFFF, %ecx
442
 
        movl    %ecx, (%edi)    /* Return x-position to caller.  */
443
 
 
444
 
        movw    %bx, %ax
445
 
        andl    $0xFFFF, %eax   /* Return value in %eax.  */
446
 
 
447
 
        popl    %edi
448
 
        popl    %ebx
449
 
        popl    %ebp
450
 
        ret
451
 
 
452
 
/*
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)
456
 
 *
457
 
 * Register allocations for parameters:
458
 
 * %eax         color_count
459
 
 * %edx         start_index
460
 
 * %ecx         *palette_data
461
 
 */
462
 
FUNCTION(grub_vbe_bios_set_palette_data)
463
 
        pushl   %ebp
464
 
        pushl   %ebx
465
 
        pushl   %edi
466
 
 
467
 
        movl    %eax, %ebx      /* Store color_count in %ebx.  */
468
 
 
469
 
        movw    %cx, %di        /* Store *palette_data to %ecx:%di.  */
470
 
        xorw    %cx, %cx
471
 
        shrl    $4, %ecx
472
 
 
473
 
        PROT_TO_REAL
474
 
        .code16
475
 
 
476
 
        pushw   %es
477
 
 
478
 
        movw    %cx, %es        /* *palette_data is now on %es:%di.  */
479
 
        movw    %bx, %cx        /* color_count is now on %cx.  */
480
 
 
481
 
        movw    $0x4f09, %ax
482
 
        xorw    %bx, %bx        /* BL = 0, Set Palette Data.  */
483
 
        int     $0x10
484
 
 
485
 
        movw    %ax, %dx        /* REAL_TO_PROT destroys %eax.  */
486
 
 
487
 
        popw    %es
488
 
 
489
 
        REAL_TO_PROT
490
 
        .code32
491
 
 
492
 
        movw    %dx, %ax
493
 
        andl    $0xFFFF, %eax   /* Return value in %eax.  */
494
 
 
495
 
        popl    %edi
496
 
        popl    %ebx
497
 
        popl    %ebp
498
 
        ret