2
* GRUB -- GRand Unified Bootloader
3
* Copyright (C) 2009,2010 Free Software Foundation, Inc.
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.
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.
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/>.
19
/* The code segment of the protected mode. */
20
#define CODE_SEGMENT 0x10
22
/* The data segment of the protected mode. */
23
#define DATA_SEGMENT 0x18
25
#include "relocator_common.S"
27
.p2align 4 /* force 16-byte alignment */
29
VARIABLE(grub_relocator32_start)
34
/* Update other registers. */
35
movl $DATA_SEGMENT, %eax
46
movl $GRUB_MEMORY_CPU_AMD64_MSR, %ecx
48
andl $(~GRUB_MEMORY_CPU_AMD64_MSR_ON), %eax
54
andl $(~GRUB_MEMORY_CPU_CR4_PAE_ON), %eax
63
VARIABLE(grub_relocator32_esp)
70
VARIABLE(grub_relocator32_ebp)
77
VARIABLE(grub_relocator32_esi)
84
VARIABLE(grub_relocator32_edi)
91
VARIABLE(grub_relocator32_eax)
96
VARIABLE(grub_relocator32_ebx)
101
VARIABLE(grub_relocator32_ecx)
104
/* mov imm32, %edx */
106
VARIABLE(grub_relocator32_edx)
109
/* Cleared direction flag is of no problem with any current
110
payload and makes this implementation easier. */
114
VARIABLE(grub_relocator32_eip)
118
/* GDT. Copied from loader/i386/linux.c. */
122
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
125
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
128
.byte 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x9A, 0xCF, 0x00
131
.byte 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x92, 0xCF, 0x00
134
VARIABLE(grub_relocator32_end)