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

« back to all changes in this revision

Viewing changes to debian/grub-extras/ntldr-img/g2hdr.S

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2010-01-11 11:12:55 UTC
  • mfrom: (17.3.7 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100111111255-lr8ebkqw5x41gq6j
Tags: 1.98~20100101-1ubuntu1
* Resynchronise with Debian. 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.
  - Conflict with grub (<< 0.97-54) as well as grub-legacy.
  - 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.
  - If the environment variable "quiet" is set to something other than 0,
    suppress progress messages as the kernel and initrd load. Set this for
    non-recovery kernel menu entries.
  - Add GRUB_DEFAULT=saved, as well as grub-set-default and grub-reboot
    utilities. Provides functionality essentially equivalent to GRUB
    Legacy's savedefault.
  - Keep the loopback file open so that subsequent changes to the "root"
    environment variable don't affect it.
  - 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.
  - Handle RAID devices containing virtio components.
* Update savedefault patch from current Bazaar branch, fixing grub-reboot
  to have distinct behaviour from grub-set-default (LP: #497326).
* Fix grub-mkisofs compilation error with FORTIFY_SOURCE.
* Convert recordfail boilerplate in each menu entry to use a function.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *  GRUB Utilities --  Utilities for GRUB Legacy, GRUB2 and GRUB for DOS
3
 
 *  Copyright (C) 2007 Bean (bean123@126.com)
4
 
 *
5
 
 *  This program 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 2 of the License, or
8
 
 *  (at your option) any later version.
9
 
 *
10
 
 *  This program 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 this program; if not, write to the Free Software
17
 
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
 
 */
19
 
 
20
 
#include <grub/machine/kernel.h>
21
 
 
22
 
        .file   "g2hdr.S"
23
 
 
24
 
        .text
25
 
 
26
 
        .code16
27
 
 
28
 
        .globl  start, _start
29
 
 
30
 
start:
31
 
_start:
32
 
 
33
 
        // We are at 0x2000:0
34
 
        // Move itself to 0x800:0
35
 
        // Don't modify dx
36
 
 
37
 
        cld
38
 
        movw    %cs, %ax
39
 
        movw    %ax, %ds
40
 
        movw    $0x800, %ax
41
 
        movw    %ax, %es
42
 
        xorw    %si, %si
43
 
        movw    %si, %di
44
 
        movw    $0x80, %cx
45
 
 
46
 
        rep
47
 
        movsl
48
 
 
49
 
        ljmp    $0, $(jump_start-start+0x8000)
50
 
 
51
 
jump_start:
52
 
        // Move data from 0x2040:0 to 0x820:0
53
 
 
54
 
        movw    $0x2040, %ax
55
 
        movw    %ax, %ds
56
 
        movw    $0x820, %ax
57
 
        movw    %ax, %es
58
 
        xorl    %eax, %eax
59
 
        movb    %dh, %al
60
 
        movl    %eax, GRUB_KERNEL_MACHINE_INSTALL_DOS_PART
61
 
        movl    GRUB_KERNEL_MACHINE_COMPRESSED_SIZE, %eax
62
 
        addl    $GRUB_KERNEL_MACHINE_RAW_SIZE, %eax
63
 
        xorl    %ecx, %ecx
64
 
 
65
 
1:
66
 
        xorw    %si, %si
67
 
        movw    %si, %di
68
 
 
69
 
        movw    $0x8000, %cx
70
 
        cmpl    %ecx, %eax
71
 
        jae     2f
72
 
        movw    %ax, %cx
73
 
2:
74
 
 
75
 
        pushw   %cx
76
 
        addw    $3, %cx
77
 
        shrw    $2, %cx
78
 
 
79
 
        rep
80
 
        movsl
81
 
 
82
 
        popw    %cx
83
 
 
84
 
        movw    %ds, %si
85
 
        addw    $0x800, %si
86
 
        movw    %si, %ds
87
 
 
88
 
        movw    %es, %si
89
 
        addw    $0x800, %si
90
 
        movw    %si, %es
91
 
 
92
 
        subl    %ecx, %eax
93
 
        jnz     1b
94
 
 
95
 
        ljmp    $0, $(0x8000 + 0x200)
96
 
 
97
 
        . = _start + 0x200 - 2
98
 
 
99
 
        .word 0xAA55
 
1
/*
 
2
 *  GRUB Utilities --  Utilities for GRUB Legacy, GRUB2 and GRUB for DOS
 
3
 *  Copyright (C) 2007 Bean (bean123@126.com)
 
4
 *
 
5
 *  This program 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 2 of the License, or
 
8
 *  (at your option) any later version.
 
9
 *
 
10
 *  This program 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 this program; if not, write to the Free Software
 
17
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
18
 */
 
19
 
 
20
#include <grub/machine/kernel.h>
 
21
 
 
22
        .file   "g2hdr.S"
 
23
 
 
24
        .text
 
25
 
 
26
        .code16
 
27
 
 
28
        .globl  start, _start
 
29
 
 
30
start:
 
31
_start:
 
32
 
 
33
        // We are at 0x2000:0
 
34
        // Move itself to 0x800:0
 
35
        // Don't modify dx
 
36
 
 
37
        cld
 
38
        movw    %cs, %ax
 
39
        movw    %ax, %ds
 
40
        movw    $0x800, %ax
 
41
        movw    %ax, %es
 
42
        xorw    %si, %si
 
43
        movw    %si, %di
 
44
        movw    $0x80, %cx
 
45
 
 
46
        rep
 
47
        movsl
 
48
 
 
49
        ljmp    $0, $(jump_start-start+0x8000)
 
50
 
 
51
jump_start:
 
52
        // Move data from 0x2040:0 to 0x820:0
 
53
 
 
54
        movw    $0x2040, %ax
 
55
        movw    %ax, %ds
 
56
        movw    $0x820, %ax
 
57
        movw    %ax, %es
 
58
        xorl    %eax, %eax
 
59
        movb    %dh, %al
 
60
        movl    %eax, GRUB_KERNEL_MACHINE_INSTALL_DOS_PART
 
61
        movl    GRUB_KERNEL_MACHINE_COMPRESSED_SIZE, %eax
 
62
        addl    $GRUB_KERNEL_MACHINE_RAW_SIZE, %eax
 
63
        xorl    %ecx, %ecx
 
64
 
 
65
1:
 
66
        xorw    %si, %si
 
67
        movw    %si, %di
 
68
 
 
69
        movw    $0x8000, %cx
 
70
        cmpl    %ecx, %eax
 
71
        jae     2f
 
72
        movw    %ax, %cx
 
73
2:
 
74
 
 
75
        pushw   %cx
 
76
        addw    $3, %cx
 
77
        shrw    $2, %cx
 
78
 
 
79
        rep
 
80
        movsl
 
81
 
 
82
        popw    %cx
 
83
 
 
84
        movw    %ds, %si
 
85
        addw    $0x800, %si
 
86
        movw    %si, %ds
 
87
 
 
88
        movw    %es, %si
 
89
        addw    $0x800, %si
 
90
        movw    %si, %es
 
91
 
 
92
        subl    %ecx, %eax
 
93
        jnz     1b
 
94
 
 
95
        ljmp    $0, $(0x8000 + 0x200)
 
96
 
 
97
        . = _start + 0x200 - 2
 
98
 
 
99
        .word 0xAA55