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
24 #include <grub/file.h>
25 #include <grub/symbol.h>
26 #include <grub/types.h>
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
,
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
*,
56 int grub_elf_is_elf64 (grub_elf_t
);
57 grub_size_t
grub_elf64_size (grub_elf_t
,
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
*,
64 grub_elf32_phdr_iterate (grub_elf_t elf
,
66 int NESTED_FUNC_ATTR (*hook
) (grub_elf_t
, Elf32_Phdr
*, void *),
69 grub_elf64_phdr_iterate (grub_elf_t elf
,
71 int NESTED_FUNC_ATTR (*hook
) (grub_elf_t
, Elf64_Phdr
*, void *),
74 #endif /* ! GRUB_ELFLOAD_HEADER */