qemu, coreboot, multiboot: Change linking address to 0x9000.
[grub.git] / include / grub / offsets.h
1 /*
2  *  GRUB  --  GRand Unified Bootloader
3  *  Copyright (C) 2002,2003,2007,2008  Free Software Foundation, Inc.
4  *
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.
9  *
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.
14  *
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/>.
17  */
18
19 #ifndef OFFSETS_HEADER
20 #define OFFSETS_HEADER  1
21
22 /* The offset of GRUB_COMPRESSED_SIZE.  */
23 #define GRUB_DECOMPRESSOR_I386_PC_COMPRESSED_SIZE       0x08
24
25 /* The offset of GRUB_COMPRESSED_SIZE.  */
26 #define GRUB_DECOMPRESSOR_I386_PC_UNCOMPRESSED_SIZE     0x0c
27
28 /* Offset of reed_solomon_redundancy.  */
29 #define GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY     0x10
30
31 /* Offset of field holding no reed solomon length.  */
32 #define GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_LENGTH      0x14
33
34 #define GRUB_DECOMPRESSOR_I386_PC_BOOT_DEVICE           0x18
35
36 #define GRUB_DECOMPRESSOR_I386_PC_MAX_DECOMPRESSOR_SIZE (0x9000-0x8200)
37
38 /* The segment where the kernel is loaded.  */
39 #define GRUB_BOOT_I386_PC_KERNEL_SEG    0x800
40
41 #define GRUB_KERNEL_I386_PC_LINK_ADDR  0x9000
42
43 /* The upper memory area (starting at 640 kiB).  */
44 #define GRUB_MEMORY_I386_PC_UPPER               0xa0000
45 #define GRUB_MEMORY_I386_QEMU_UPPER             GRUB_MEMORY_I386_PC_UPPER
46
47 /* The offset of GRUB_CORE_ENTRY_ADDR.  */
48 #define GRUB_BOOT_I386_QEMU_CORE_ENTRY_ADDR     0x4
49
50 /* The offset of GRUB_CORE_ENTRY_ADDR.  */
51 #define GRUB_KERNEL_I386_QEMU_CORE_ENTRY_ADDR   0x8
52
53 #define GRUB_KERNEL_I386_QEMU_LINK_ADDR         0x9000
54
55 /* The offset of GRUB_TOTAL_MODULE_SIZE.  */
56 #define GRUB_KERNEL_SPARC64_IEEE1275_TOTAL_MODULE_SIZE  0x8
57 #define GRUB_KERNEL_ARM_STACK_SIZE 0x40000
58
59 #define GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE    12
60
61 #define GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS        0x4400
62 #define GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR 0x4400
63
64 #define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ALIGN 4
65 #define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ADDR 0x200000
66
67 #define GRUB_KERNEL_MIPS_LOONGSON_LINK_ADDR         0x80200000
68
69 #define GRUB_KERNEL_MIPS_LOONGSON_LINK_ALIGN  32
70
71 #define GRUB_DECOMPRESSOR_MIPS_LOONGSON_COMPRESSED_SIZE          0x8
72 #define GRUB_DECOMPRESSOR_MIPS_LOONGSON_UNCOMPRESSED_SIZE        0xc
73 #define GRUB_DECOMPRESSOR_MIPS_LOONGSON_UNCOMPRESSED_ADDR        0x10
74
75 #define GRUB_KERNEL_MIPS_LOONGSON_TOTAL_MODULE_SIZE     0x08
76
77 #define GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ADDR         0x80200000
78 #define GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ALIGN  32
79 #define GRUB_DECOMPRESSOR_MIPS_QEMU_MIPS_COMPRESSED_SIZE          0x8
80 #define GRUB_DECOMPRESSOR_MIPS_QEMU_MIPS_UNCOMPRESSED_SIZE        0xc
81 #define GRUB_DECOMPRESSOR_MIPS_QEMU_MIPS_UNCOMPRESSED_ADDR        0x10
82 #define GRUB_KERNEL_MIPS_QEMU_MIPS_TOTAL_MODULE_SIZE    0x08
83
84 #define GRUB_KERNEL_MIPS_ARC_LINK_ADDR         0x88200000
85 #define GRUB_KERNEL_MIPSEL_ARC_LINK_ADDR         0x80700000
86 #define GRUB_KERNEL_MIPS_ARC_LINK_ALIGN  32
87
88 #define GRUB_DECOMPRESSOR_MIPS_ARC_COMPRESSED_SIZE          0x8
89 #define GRUB_DECOMPRESSOR_MIPS_ARC_UNCOMPRESSED_SIZE        0xc
90 #define GRUB_DECOMPRESSOR_MIPS_ARC_UNCOMPRESSED_ADDR        0x10
91
92 #define GRUB_KERNEL_MIPS_ARC_TOTAL_MODULE_SIZE  0x08
93
94 #define GRUB_KERNEL_I386_COREBOOT_LINK_ADDR     0x9000
95 #define GRUB_KERNEL_I386_COREBOOT_MODULES_ADDR  0x100000
96
97 #define GRUB_KERNEL_I386_IEEE1275_LINK_ADDR     0x10000
98
99 #define GRUB_KERNEL_I386_IEEE1275_MOD_ALIGN     0x1000
100 #define GRUB_KERNEL_I386_COREBOOT_MOD_ALIGN     0x1
101 #define GRUB_KERNEL_I386_MULTIBOOT_MOD_ALIGN    GRUB_KERNEL_I386_COREBOOT_MOD_ALIGN
102
103 #define GRUB_KERNEL_X86_64_XEN_MOD_ALIGN        0x8
104 #define GRUB_KERNEL_I386_XEN_MOD_ALIGN  0x8
105
106 /* Non-zero value is only needed for PowerMacs.  */
107 #define GRUB_KERNEL_X86_64_XEN_MOD_GAP 0x0
108 #define GRUB_KERNEL_I386_XEN_MOD_GAP 0x0
109 #define GRUB_KERNEL_I386_IEEE1275_MOD_GAP 0x0
110 #define GRUB_KERNEL_I386_COREBOOT_MOD_GAP 0x0
111 #define GRUB_KERNEL_SPARC64_IEEE1275_MOD_GAP 0x0
112 #define GRUB_KERNEL_ARM_UBOOT_MOD_GAP 0x0
113
114 #define GRUB_KERNEL_POWERPC_IEEE1275_MOD_ALIGN 0x1000
115 #define GRUB_KERNEL_SPARC64_IEEE1275_LOG_MOD_ALIGN 3
116 #define GRUB_KERNEL_SPARC64_IEEE1275_MOD_ALIGN (1 << GRUB_KERNEL_SPARC64_IEEE1275_LOG_MOD_ALIGN)
117
118 #define GRUB_KERNEL_MIPS_LOONGSON_MOD_ALIGN 0x1
119 #define GRUB_KERNEL_MIPS_ARC_MOD_ALIGN 0x1
120 #define GRUB_KERNEL_MIPS_QEMU_MIPS_MOD_ALIGN 0x1
121
122 #define GRUB_KERNEL_ARM_UBOOT_MOD_ALIGN         0x8
123 #define GRUB_KERNEL_ARM_UBOOT_TOTAL_MODULE_SIZE 0x4
124
125 #define GRUB_KERNEL_ARM_COREBOOT_MOD_ALIGN      0x8
126 #define GRUB_KERNEL_ARM_COREBOOT_TOTAL_MODULE_SIZE      0x4
127
128 #define GRUB_KERNEL_ARM_STACK_SIZE 0x40000
129 #define GRUB_KERNEL_ARM_COREBOOT_MOD_GAP (GRUB_KERNEL_ARM_STACK_SIZE + 1024)
130
131 /* Minimal gap between _end and the start of the modules.  It's a hack
132    for PowerMac to prevent "CLAIM failed" error.  The real fix is to
133    rewrite grub-mkimage to generate valid ELF files.  */
134 #define GRUB_KERNEL_POWERPC_IEEE1275_MOD_GAP 0x8000
135
136 #ifdef GRUB_MACHINE
137 #define GRUB_OFFSETS_CONCAT_(a,b,c) a ## b ## c
138 #define GRUB_OFFSETS_CONCAT(a,b,c) GRUB_OFFSETS_CONCAT_(a,b,c)
139 #define GRUB_KERNEL_MACHINE_MOD_ALIGN GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _MOD_ALIGN)
140 #define GRUB_KERNEL_MACHINE_MOD_GAP GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _MOD_GAP)
141 #define GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _TOTAL_MODULE_SIZE)
142
143 #define GRUB_BOOT_MACHINE_KERNEL_SEG GRUB_OFFSETS_CONCAT (GRUB_BOOT_, GRUB_MACHINE, _KERNEL_SEG)
144 #define GRUB_MEMORY_MACHINE_UPPER GRUB_OFFSETS_CONCAT (GRUB_MEMORY_, GRUB_MACHINE, _UPPER)
145 #if defined (GRUB_MACHINE_ARC) && defined (GRUB_CPU_MIPSEL)
146 #define GRUB_MACHINE_LINK_ADDR GRUB_KERNEL_MIPSEL_ARC_LINK_ADDR
147 #else
148 #define GRUB_MACHINE_LINK_ADDR GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _LINK_ADDR)
149 #endif
150
151 #define GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_DECOMPRESSOR_, GRUB_MACHINE, _COMPRESSED_SIZE)
152 #define GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_DECOMPRESSOR_, GRUB_MACHINE, _UNCOMPRESSED_SIZE)
153 #define GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_ADDR GRUB_OFFSETS_CONCAT (GRUB_DECOMPRESSOR_, GRUB_MACHINE, _UNCOMPRESSED_ADDR)
154 #endif
155
156 #ifndef ASM_FILE
157 struct grub_pc_bios_boot_blocklist
158 {
159   grub_uint64_t start;
160   grub_uint16_t len;
161   grub_uint16_t segment;
162 } GRUB_PACKED;
163 #endif
164
165 #endif