Upgraded GRUB2 to 2.00 release.
[AROS.git] / arch / all-pc / boot / grub2-aros / include / grub / elfload.h
blobaae95f5645f7a37a5efa32697036a8548a606d14
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007 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 #ifndef GRUB_ELFLOAD_HEADER
20 #define GRUB_ELFLOAD_HEADER 1
22 #include <grub/err.h>
23 #include <grub/elf.h>
24 #include <grub/file.h>
25 #include <grub/symbol.h>
26 #include <grub/types.h>
28 struct grub_elf_file
30 grub_file_t file;
31 union {
32 Elf64_Ehdr ehdr64;
33 Elf32_Ehdr ehdr32;
34 } ehdr;
35 void *phdrs;
37 typedef struct grub_elf_file *grub_elf_t;
39 typedef grub_err_t (*grub_elf32_load_hook_t)
40 (Elf32_Phdr *phdr, grub_addr_t *addr, int *load);
41 typedef grub_err_t (*grub_elf64_load_hook_t)
42 (Elf64_Phdr *phdr, grub_addr_t *addr, int *load);
44 grub_elf_t grub_elf_open (const char *);
45 grub_elf_t grub_elf_file (grub_file_t file, const char *filename);
46 grub_err_t grub_elf_close (grub_elf_t);
48 int grub_elf_is_elf32 (grub_elf_t);
49 grub_size_t grub_elf32_size (grub_elf_t,
50 const char *filename,
51 Elf32_Addr *, grub_uint32_t *);
52 grub_err_t grub_elf32_load (grub_elf_t, const char *filename,
53 grub_elf32_load_hook_t, grub_addr_t *,
54 grub_size_t *);
56 int grub_elf_is_elf64 (grub_elf_t);
57 grub_size_t grub_elf64_size (grub_elf_t,
58 const char *filename,
59 Elf64_Addr *, grub_uint64_t *);
60 grub_err_t grub_elf64_load (grub_elf_t, const char *filename,
61 grub_elf64_load_hook_t, grub_addr_t *,
62 grub_size_t *);
63 grub_err_t
64 grub_elf32_phdr_iterate (grub_elf_t elf,
65 const char *filename,
66 int NESTED_FUNC_ATTR (*hook) (grub_elf_t, Elf32_Phdr *, void *),
67 void *hook_arg);
68 grub_err_t
69 grub_elf64_phdr_iterate (grub_elf_t elf,
70 const char *filename,
71 int NESTED_FUNC_ATTR (*hook) (grub_elf_t, Elf64_Phdr *, void *),
72 void *hook_arg);
74 #endif /* ! GRUB_ELFLOAD_HEADER */