source: grub-pc/trunk/fuentes/debian/grub-extras/ntldr-img/g2hdr.S @ 22

Last change on this file since 22 was 22, checked in by mabarracus, 4 years ago

updated version and apply net.ifnames=0 into debian/rules

File size: 1.8 KB
Line 
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
30start:
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
51jump_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, (GRUB_DECOMPRESSOR_I386_PC_BOOT_DEVICE + 2)
60        movl    GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE, %eax
61        addl    $GRUB_DECOMPRESSOR_I386_PC_MAX_DECOMPRESSOR_SIZE, %eax
62        xorl    %ecx, %ecx
63
641:
65        xorw    %si, %si
66        movw    %si, %di
67
68        movw    $0x8000, %cx
69        cmpl    %ecx, %eax
70        jae     2f
71        movw    %ax, %cx
722:
73
74        pushw   %cx
75        addw    $3, %cx
76        shrw    $2, %cx
77
78        rep
79        movsl
80
81        popw    %cx
82
83        movw    %ds, %si
84        addw    $0x800, %si
85        movw    %si, %ds
86
87        movw    %es, %si
88        addw    $0x800, %si
89        movw    %si, %es
90
91        subl    %ecx, %eax
92        jnz     1b
93
94        ljmp    $0, $(0x8000 + 0x200)
95
96        . = _start + 0x200 - 2
97
98        .word 0xAA55
Note: See TracBrowser for help on using the repository browser.