~darkmuggle-deactivatedaccount/ubuntu/quantal/grub2/fix-872244

« back to all changes in this revision

Viewing changes to boot/sparc64/ieee1275/boot.S

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson, Colin Watson, Evan Broder, Mario Limonciello
  • Date: 2010-11-24 13:59:55 UTC
  • mfrom: (1.17.6 upstream) (17.6.15 experimental)
  • Revision ID: james.westby@ubuntu.com-20101124135955-r6ii5sepayr7jt53
Tags: 1.99~20101124-1ubuntu1
[ Colin Watson ]
* Resynchronise with Debian experimental.  Remaining changes:
  - Adjust for default Ubuntu boot options ("quiet splash").
  - Default to hiding the menu; holding down Shift at boot will show it.
  - Set a monochromatic theme for Ubuntu.
  - Apply Ubuntu GRUB Legacy changes to legacy update-grub script: title,
    recovery mode, quiet option, tweak how memtest86+ is displayed, and
    use UUIDs where appropriate.
  - Fix backslash-escaping in merge_debconf_into_conf.
  - Remove "GNU/Linux" from default distributor string.
  - Add crashkernel= options if kdump and makedumpfile are available.
  - If other operating systems are installed, then automatically unhide
    the menu.  Otherwise, if GRUB_HIDDEN_TIMEOUT is 0, then use keystatus
    if available to check whether Shift is pressed.  If it is, show the
    menu, otherwise boot immediately.  If keystatus is not available, then
    fall back to a short delay interruptible with Escape.
  - Allow Shift to interrupt 'sleep --interruptible'.
  - Don't display introductory message about line editing unless we're
    actually offering a shell prompt.  Don't clear the screen just before
    booting if we never drew the menu in the first place.
  - Remove some verbose messages printed before reading the configuration
    file.
  - Suppress progress messages as the kernel and initrd load for
    non-recovery kernel menu entries.
  - Change prepare_grub_to_access_device to handle filesystems
    loop-mounted on file images.
  - Ignore devices loop-mounted from files in 10_linux.
  - Show the boot menu if the previous boot failed, that is if it failed
    to get to the end of one of the normal runlevels.
  - Don't generate /boot/grub/device.map during grub-install or
    grub-mkconfig by default.
  - Adjust upgrade version checks for Ubuntu.
  - Don't display "GRUB loading" unless Shift is held down.
  - Adjust versions of grub-doc and grub-legacy-doc conflicts to tolerate
    our backport of the grub-doc split.
  - Fix LVM/RAID probing in the absence of /boot/grub/device.map.
  - Look for .mo files in /usr/share/locale-langpack as well, in
    preference.
  - Make sure GRUB_TIMEOUT isn't quoted unnecessarily.
  - Probe all devices in 'grub-probe --target=drive' if
    /boot/grub/device.map is missing.
  - Build-depend on qemu-kvm rather than qemu-system for grub-pc tests.
  - Use qemu rather than qemu-system-i386.
  - Program vesafb on BIOS systems rather than efifb.
  - Add a grub-rescue-efi-amd64 package containing a rescue CD-ROM image
    for EFI-AMD64.
  - On Wubi, don't ask for an install device, but just update wubildr
    using the diverted grub-install.
  - When embedding the core image in a post-MBR gap, check for and avoid
    sectors matching any of a list of known signatures.
  - Disable video_bochs and video_cirrus on PC BIOS systems, as probing
    PCI space seems to break on some systems.
* Downgrade "ACPI shutdown failed" error to a debug message, since it can
  cause spurious test failures.

[ Evan Broder ]
* Enable lua from grub-extras.
* Incorporate the bitop library into lua.
* Add enum_pci function to grub module in lua.
* Switch back to gfxpayload=keep by default, unless the video hardware
  is known to not support it.

[ Mario Limonciello ]
* Built part_msdos and vfat into bootx64.efi (LP: #677758)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*-Asm-*- */
2
 
/*
3
 
 *  GRUB  --  GRand Unified Bootloader
4
 
 *  Copyright (C) 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/boot.h>
21
 
#include <grub/machine/boot.h>
22
 
 
23
 
        .text
24
 
        .align  4
25
 
        .globl  _start
26
 
_start:
27
 
        /* OF CIF entry point arrives in %o4 */
28
 
pic_base:
29
 
        call    boot_continue
30
 
         mov    %o4, CIF_REG
31
 
 
32
 
        . = _start + GRUB_BOOT_MACHINE_VER_MAJ
33
 
boot_version:           .byte   GRUB_BOOT_VERSION_MAJOR, GRUB_BOOT_VERSION_MINOR
34
 
 
35
 
        /* The offsets to these locations are defined by the
36
 
         * GRUB_BOOT_MACHINE_foo macros in include/grub/sparc/ieee1275/boot.h,
37
 
         * and grub-setup uses this to patch these next three values as needed.
38
 
         *
39
 
         * The boot_path will be the OF device path of the partition where the
40
 
         * rest of the GRUB kernel image resides.  kernel_sector will be set to
41
 
         * the location of the first block of the GRUB kernel, and
42
 
         * kernel_address is the location where we should load that first block.
43
 
         *
44
 
         * After loading in that block we will execute it by jumping to the
45
 
         * load address plus the size of the prepended A.OUT header (32 bytes).
46
 
         */
47
 
boot_path:
48
 
        . = _start + GRUB_BOOT_MACHINE_KERNEL_BYTE
49
 
boot_path_end:
50
 
kernel_byte:            .xword (2 << 9)
51
 
kernel_address:         .word  GRUB_BOOT_MACHINE_KERNEL_ADDR
52
 
 
53
 
prom_finddev_name:      .asciz "finddevice"
54
 
prom_chosen_path:       .asciz "/chosen"
55
 
prom_getprop_name:      .asciz "getprop"
56
 
prom_stdout_name:       .asciz "stdout"
57
 
prom_write_name:        .asciz "write"
58
 
prom_bootpath_name:     .asciz "bootpath"
59
 
prom_open_name:         .asciz "open"
60
 
prom_seek_name:         .asciz "seek"
61
 
prom_read_name:         .asciz "read"
62
 
prom_exit_name:         .asciz "exit"
63
 
grub_name:              .asciz "GRUB "
64
 
#define GRUB_NAME_LEN   5
65
 
 
66
 
        .align  4
67
 
 
68
 
prom_open_error:
69
 
        GET_ABS(prom_open_name, %o2)
70
 
        call    console_write
71
 
         mov    4, %o3
72
 
        /* fallthru */
73
 
 
74
 
prom_error:
75
 
        GET_ABS(prom_exit_name, %o0)
76
 
        /* fallthru */
77
 
 
78
 
        /* %o0: OF call name
79
 
         * %o1: input arg 1
80
 
         */
81
 
prom_call_1_1_o2:
82
 
        clr     %o2
83
 
        ba      prom_call_x_1
84
 
         mov    1, %g1
85
 
 
86
 
prom_call_getprop:
87
 
        mov     4, %g1
88
 
        stx     %g1, [%l1 + 256]
89
 
        mov     CHOSEN_NODE_REG, %o1
90
 
        ba      prom_call_x_1
91
 
         GET_ABS(prom_getprop_name, %o0)
92
 
 
93
 
prom_call_3_1_o1:
94
 
        ba prom_call_3_1
95
 
         mov    BOOTDEV_REG, %o1
96
 
 
97
 
        
98
 
        /* %o2: message string
99
 
         * %o3: message length
100
 
         */
101
 
console_write:
102
 
        GET_ABS(prom_write_name, %o0)
103
 
        mov     STDOUT_NODE_REG, %o1
104
 
        /* fallthru */
105
 
 
106
 
        /* %o0: OF call name
107
 
         * %o1: input arg 1
108
 
         * %o2: input arg 2
109
 
         * %o3: input arg 3
110
 
         */
111
 
prom_call_3_1:  
112
 
        mov     3, %g1
113
 
prom_call_x_1:
114
 
        mov     1, %o5
115
 
        /* fallthru */
116
 
 
117
 
        /* %o0: OF call name
118
 
         * %g1: num inputs
119
 
         * %o5: num outputs
120
 
         * %o1-%o4: inputs
121
 
         */
122
 
prom_call:
123
 
        stx     %o0, [%l1 + 0x00]
124
 
        stx     %g1, [%l1 + 0x08]
125
 
        stx     %o5, [%l1 + 0x10]
126
 
        stx     %o1, [%l1 + 0x18]
127
 
        stx     %o2, [%l1 + 0x20]
128
 
        stx     %o3, [%l1 + 0x28]
129
 
        stx     %o4, [%l1 + 0x30]
130
 
        jmpl    CIF_REG, %g0
131
 
         mov    %l1, %o0
132
 
 
133
 
boot_continue:
134
 
        mov     %o7, PIC_REG            /* PIC base */
135
 
        sethi   %hi(SCRATCH_PAD_BOOT), %l1      /* OF argument slots */
136
 
 
137
 
        /* Find the /chosen node so we can fetch the stdout handle,
138
 
         * and thus perform console output.
139
 
         *
140
 
         * chosen_node = prom_finddevice("/chosen")
141
 
         */
142
 
        GET_ABS(prom_finddev_name, %o0)
143
 
        call    prom_call_1_1_o2
144
 
         GET_ABS(prom_chosen_path, %o1)
145
 
 
146
 
        ldx     [%l1 + 0x20], CHOSEN_NODE_REG
147
 
        brz     CHOSEN_NODE_REG, prom_error
148
 
 
149
 
        /* getprop(chosen_node, "stdout", &buffer, buffer_size) */
150
 
         GET_ABS(prom_stdout_name, %o2)
151
 
        add     %l1, 256, %o3
152
 
        call    prom_call_getprop
153
 
         mov    1024, %o4
154
 
 
155
 
        lduw    [%l1 + 256], STDOUT_NODE_REG
156
 
        brz,pn  STDOUT_NODE_REG, prom_error
157
 
 
158
 
        /* write(stdout_node, "GRUB ", strlen("GRUB ")) */
159
 
         GET_ABS(grub_name, %o2)
160
 
        call    console_write
161
 
         mov    GRUB_NAME_LEN, %o3
162
 
 
163
 
        GET_ABS(boot_path, %o3)
164
 
        ldub    [%o3], %o1
165
 
        brnz,pn %o1, bootpath_known
166
 
 
167
 
        /* getprop(chosen_node, "bootpath", &buffer, buffer_size) */
168
 
         GET_ABS(prom_bootpath_name, %o2)
169
 
        call    prom_call_getprop
170
 
         mov    (boot_path_end - boot_path), %o4
171
 
 
172
 
bootpath_known: 
173
 
 
174
 
        /* Open up the boot_path, and use that handle to read the
175
 
         * first block of the GRUB kernel image.
176
 
         *
177
 
         * bootdev_handle = open(boot_path)
178
 
         */
179
 
        GET_ABS(prom_open_name, %o0)
180
 
        call    prom_call_1_1_o2
181
 
         GET_ABS(boot_path, %o1)
182
 
 
183
 
        ldx     [%l1 + 0x20], BOOTDEV_REG
184
 
        brz,pn  BOOTDEV_REG, prom_open_error
185
 
 
186
 
        /* Since we have 64-bit cells, the high cell of the seek offset
187
 
         * is zero and the low cell is the entire value.
188
 
         *
189
 
         * seek(bootdev, 0, *kernel_byte)
190
 
         */
191
 
         GET_ABS(prom_seek_name, %o0)
192
 
        clr     %o2
193
 
        call    prom_call_3_1_o1
194
 
         LDX_ABS(kernel_byte, 0x00, %o3)
195
 
 
196
 
        /* read(bootdev, *kernel_address, 512) */
197
 
        GET_ABS(prom_read_name, %o0)
198
 
        LDUW_ABS(kernel_address, 0x00, %o2)
199
 
        call    prom_call_3_1_o1
200
 
         mov    512, %o3
201
 
 
202
 
        LDUW_ABS(kernel_address, 0x00, %o2)
203
 
        jmpl    %o2, %o7
204
 
         nop
205
 
 
206
 
        . = _start + GRUB_BOOT_MACHINE_CODE_END
207
 
 
208
 
/* the last 4 bytes in the sector 0 contain the signature */
209
 
        .word   GRUB_BOOT_MACHINE_SIGNATURE