]> git.proxmox.com Git - grub2.git/blame - include/grub/kernel.h
Add noreturn attributes and remove unreachable code.
[grub2.git] / include / grub / kernel.h
CommitLineData
6a161fa9 1/*
4b13b216 2 * GRUB -- GRand Unified Bootloader
0d5d5653 3 * Copyright (C) 2002,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
6a161fa9 4 *
5a79f472 5 * GRUB is free software: you can redistribute it and/or modify
6a161fa9 6 * it under the terms of the GNU General Public License as published by
5a79f472 7 * the Free Software Foundation, either version 3 of the License, or
6a161fa9 8 * (at your option) any later version.
9 *
5a79f472 10 * GRUB is distributed in the hope that it will be useful,
6a161fa9 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
5a79f472 16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
6a161fa9 17 */
18
4b13b216 19#ifndef GRUB_KERNEL_HEADER
20#define GRUB_KERNEL_HEADER 1
6a161fa9 21
4b13b216 22#include <grub/types.h>
55a581dc 23#include <grub/symbol.h>
6a161fa9 24
6b9b6276 25enum
26{
27 OBJ_TYPE_ELF,
28 OBJ_TYPE_MEMDISK,
a97501d2
VS
29 OBJ_TYPE_CONFIG,
30 OBJ_TYPE_PREFIX
6b9b6276 31};
32
6a161fa9 33/* The module header. */
4b13b216 34struct grub_module_header
6a161fa9 35{
3bd0a12a 36 /* The type of object. */
8bec9a28 37 grub_uint32_t type;
3bd0a12a 38 /* The size of object (including this header). */
6b9b6276 39 grub_uint32_t size;
6a161fa9 40};
41
0b412211 42/* "gmim" (GRUB Module Info Magic). */
43#define GRUB_MODULE_MAGIC 0x676d696d
6a161fa9 44
0253aeb7
VS
45struct grub_module_info32
46{
47 /* Magic number so we know we have modules present. */
48 grub_uint32_t magic;
49 /* The offset of the modules. */
50 grub_uint32_t offset;
51 /* The size of all modules plus this header. */
52 grub_uint32_t size;
53};
54
55struct grub_module_info64
0b412211 56{
57 /* Magic number so we know we have modules present. */
58 grub_uint32_t magic;
20011694 59 grub_uint32_t padding;
0b412211 60 /* The offset of the modules. */
0253aeb7 61 grub_uint64_t offset;
0b412211 62 /* The size of all modules plus this header. */
0253aeb7 63 grub_uint64_t size;
0b412211 64};
6a161fa9 65
0253aeb7
VS
66#if GRUB_TARGET_SIZEOF_VOID_P == 8
67#define grub_module_info grub_module_info64
68#else
69#define grub_module_info grub_module_info32
70#endif
71
39705fad
VS
72extern grub_addr_t EXPORT_VAR (grub_modbase);
73
74#define FOR_MODULES(var) for (\
75 var = grub_modbase ? (struct grub_module_header *) \
76 (grub_modbase + (((struct grub_module_info *) grub_modbase)->offset)) : 0;\
77 var && (grub_addr_t) var \
78 < (grub_modbase + (((struct grub_module_info *) grub_modbase)->size)); \
79 var = (struct grub_module_header *) \
80 ((char *) var + ((struct grub_module_header *) var)->size))
3bd0a12a 81
a49217cf
VS
82grub_addr_t grub_modules_get_end (void);
83
6a161fa9 84/* The start point of the C code. */
02a2bf83 85void grub_main (void) __attribute__ ((noreturn));
6a161fa9 86
87/* The machine-specific initialization. This must initialize memory. */
4b13b216 88void grub_machine_init (void);
6a161fa9 89
e6b92c8a 90/* The machine-specific finalization. */
0d5d5653 91void EXPORT_FUNC(grub_machine_fini) (void);
e6b92c8a 92
2965c7cc 93/* The machine-specific prefix initialization. */
574618a2
VS
94void
95grub_machine_get_bootlocation (char **device, char **path);
2965c7cc 96
6a161fa9 97/* Register all the exported symbols. This is automatically generated. */
4b13b216 98void grub_register_exported_symbols (void);
6a161fa9 99
228ccedb
VS
100extern void (*EXPORT_VAR(grub_net_poll_cards_idle)) (void);
101
4b13b216 102#endif /* ! GRUB_KERNEL_HEADER */