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

« back to all changes in this revision

Viewing changes to boot/i386/pc/cdboot.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
 
/* -*-Asm-*- */
2
 
/*
3
 
 *  GRUB  --  GRand Unified Bootloader
4
 
 *  Copyright (C) 2008,2009  Free Software Foundation, Inc.
5
 
 *
6
 
 *  GRUB is free software: you can redistribute it and/or modify
7
 
 *  it under the terms of the GNU General Public License as published by
8
 
 *  the Free Software Foundation, either version 3 of the License, or
9
 
 *  (at your option) any later version.
10
 
 *
11
 
 *  GRUB is distributed in the hope that it will be useful,
12
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
 *  GNU General Public License for more details.
15
 
 *
16
 
 *  You should have received a copy of the GNU General Public License
17
 
 *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
18
 
 */
19
 
 
20
 
#include <grub/symbol.h>
21
 
#include <grub/boot.h>
22
 
#include <grub/machine/boot.h>
23
 
#include <grub/machine/kernel.h>
24
 
#include <multiboot.h>
25
 
 
26
 
        .file   "cdboot.S"
27
 
 
28
 
#define CODE_ADDR       0x6000
29
 
#define DATA_ADDR       ((GRUB_BOOT_MACHINE_KERNEL_ADDR) + 0x200)
30
 
 
31
 
#define CDSEC_SHIFT     11
32
 
#define CDBLK_LENG      16
33
 
 
34
 
        .text
35
 
 
36
 
        .code16
37
 
 
38
 
        .globl  start, _start
39
 
 
40
 
start:
41
 
_start:
42
 
        call    LOCAL(next)
43
 
 
44
 
LOCAL(next):
45
 
        jmp     1f
46
 
 
47
 
        . = start + 8
48
 
 
49
 
bi_pvd:
50
 
        .long 0         /* LBA of primary volume descriptor.  */
51
 
bi_file:
52
 
        .long 0         /* LBA of boot file. */
53
 
bi_length:
54
 
        .long 0         /* Length of boot file. */
55
 
bi_csum:
56
 
        .long 0         /* Checksum of boot file */
57
 
bi_reserved:
58
 
        .space (10*4)   /* Reserved */
59
 
 
60
 
1:
61
 
        popw    %bx
62
 
 
63
 
        /* Boot from CDROM.  */
64
 
 
65
 
        xorw    %ax, %ax
66
 
        movw    %ax, %ss
67
 
        movw    $(CODE_ADDR), %sp
68
 
        movw    %ax, %ds
69
 
        movw    %ax, %es
70
 
 
71
 
        movw    $(0x7C00 + err_noboot_msg - start), %si
72
 
        movl    %cs: bi_length - LOCAL(next)(%bx), %ecx
73
 
        orl     %ecx, %ecx
74
 
        jz      LOCAL(fail)
75
 
 
76
 
        addl    $((1 << CDSEC_SHIFT) - 1), %ecx
77
 
        shrl    $CDSEC_SHIFT, %ecx
78
 
 
79
 
        movl    %cs: bi_file - LOCAL(next)(%bx), %esi
80
 
 
81
 
        call    LOCAL(read_cdrom)
82
 
 
83
 
        ljmp    $(DATA_ADDR >> 4), $0
84
 
 
85
 
/*
86
 
 * Parameters:
87
 
 *   esi: start sector
88
 
 *   ecx: number of sectors
89
 
 */
90
 
LOCAL(read_cdrom):
91
 
        xorl    %eax, %eax
92
 
 
93
 
        /* Number of blocks to read.  */
94
 
        pushw   $CDBLK_LENG
95
 
 
96
 
        /* Block number.  */
97
 
        pushl   %eax
98
 
        pushl   %esi
99
 
 
100
 
        /* Buffer address.  */
101
 
        pushw   $((DATA_ADDR - 0x400)>> 4)
102
 
        pushl   %eax
103
 
        pushw   $0x10
104
 
 
105
 
        xorl    %edi, %edi
106
 
        movw    %sp, %si
107
 
 
108
 
1:
109
 
        movw    0x10(%si), %di
110
 
        cmpl    %ecx, %edi
111
 
        jbe     2f
112
 
        movl    %ecx, %edi
113
 
 
114
 
2:
115
 
        mov     %di, 2(%si)
116
 
 
117
 
        pushl   %ecx
118
 
 
119
 
        movb    $0x42, %ah
120
 
        int     $0x13
121
 
 
122
 
        jnc     3f
123
 
 
124
 
        movb    $0x42, %ah              /* Try again.  */
125
 
        int     $0x13
126
 
 
127
 
        jnc     3f
128
 
 
129
 
2:
130
 
        shrw    $1, %di                 /* Reduce transfer size.  */
131
 
        jz      LOCAL(cdrom_fail)
132
 
        movw    %di, 0x10(%si)
133
 
        movw    %di, 2(%si)
134
 
        movb    $0x42, %ah
135
 
        int     $0x13
136
 
        jc      2b
137
 
 
138
 
3:
139
 
 
140
 
        movw    %di, %ax
141
 
        shlw    $(CDSEC_SHIFT - 4), %ax
142
 
        addw    %ax, 6(%si)
143
 
        addl    %edi, 8(%si)
144
 
 
145
 
        popl    %ecx
146
 
        subl    %edi, %ecx
147
 
        jnz     1b
148
 
 
149
 
        addw    $0x12, %sp
150
 
        ret
151
 
 
152
 
LOCAL(cdrom_fail):
153
 
        movw    $(0x7C00 + err_cdfail_msg - start), %si
154
 
 
155
 
LOCAL(fail):
156
 
        movb    $0x0e, %ah
157
 
        xorw    %bx, %bx
158
 
1:
159
 
        lodsb   (%si), %al
160
 
        int     $0x10
161
 
        cmpb    $0, %al
162
 
        jne     1b
163
 
1:      jmp     1b
164
 
 
165
 
err_noboot_msg:
166
 
        .ascii  "no boot info\0"
167
 
 
168
 
err_cdfail_msg:
169
 
        .ascii  "cdrom read fails\0"
170
 
 
171
 
        . = start + 0x1FF
172
 
 
173
 
        .byte   0