]> git.proxmox.com Git - grub2.git/blame - include/grub/machoload.h
verifiers: File type for fine-grained signature-verification controlling
[grub2.git] / include / grub / machoload.h
CommitLineData
bbee0f2b 1/*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2009 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 GRUB_MACHOLOAD_HEADER
20#define GRUB_MACHOLOAD_HEADER 1
21
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>
27
28struct grub_macho_file
29{
30 grub_file_t file;
31 grub_ssize_t offset32;
32 grub_ssize_t end32;
33 int ncmds32;
34 grub_size_t cmdsize32;
35 grub_uint8_t *cmds32;
99ce1597
VS
36 grub_uint8_t *uncompressed32;
37 int compressed32;
38 grub_size_t compressed_size32;
39 grub_size_t uncompressed_size32;
bbee0f2b 40 grub_ssize_t offset64;
41 grub_ssize_t end64;
42 int ncmds64;
43 grub_size_t cmdsize64;
44 grub_uint8_t *cmds64;
99ce1597
VS
45 grub_uint8_t *uncompressed64;
46 int compressed64;
47 grub_size_t compressed_size64;
48 grub_size_t uncompressed_size64;
bbee0f2b 49};
50typedef struct grub_macho_file *grub_macho_t;
51
ca0a4f68
VS
52grub_macho_t grub_macho_open (const char *, enum grub_file_type type,
53 int is_64bit);
99ce1597
VS
54grub_macho_t grub_macho_file (grub_file_t file, const char *filename,
55 int is_64bit);
bbee0f2b 56grub_err_t grub_macho_close (grub_macho_t);
57
72db7c22 58grub_err_t grub_macho_size32 (grub_macho_t macho, grub_uint32_t *segments_start,
99ce1597
VS
59 grub_uint32_t *segments_end, int flags,
60 const char *filename);
61grub_uint32_t grub_macho_get_entry_point32 (grub_macho_t macho,
62 const char *filename);
72db7c22 63
72db7c22 64grub_err_t grub_macho_size64 (grub_macho_t macho, grub_uint64_t *segments_start,
99ce1597
VS
65 grub_uint64_t *segments_end, int flags,
66 const char *filename);
67grub_uint64_t grub_macho_get_entry_point64 (grub_macho_t macho,
68 const char *filename);
bbee0f2b 69
70/* Ignore BSS segments when loading. */
71#define GRUB_MACHO_NOBSS 0x1
9c4b5c13 72grub_err_t grub_macho_load32 (grub_macho_t macho, const char *filename,
83ddae23 73 char *offset, int flags, int *darwin_version);
9c4b5c13 74grub_err_t grub_macho_load64 (grub_macho_t macho, const char *filename,
83ddae23 75 char *offset, int flags, int *darwin_version);
bbee0f2b 76
b39f9d20 77/* Like filesize and file_read but take only 32-bit part
bbee0f2b 78 for current architecture. */
72db7c22 79grub_size_t grub_macho_filesize32 (grub_macho_t macho);
9c4b5c13
VS
80grub_err_t grub_macho_readfile32 (grub_macho_t macho, const char *filename,
81 void *dest);
72db7c22 82grub_size_t grub_macho_filesize64 (grub_macho_t macho);
9c4b5c13
VS
83grub_err_t grub_macho_readfile64 (grub_macho_t macho, const char *filename,
84 void *dest);
72db7c22 85
9c4b5c13
VS
86void grub_macho_parse32 (grub_macho_t macho, const char *filename);
87void grub_macho_parse64 (grub_macho_t macho, const char *filename);
bbee0f2b 88
89#endif /* ! GRUB_MACHOLOAD_HEADER */