blob: 4139ef3d419309f2065839bced00308217f7570c [file] [log] [blame]
Aaron Durbin4e6ad1b2014-03-10 09:53:34 -05001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2014 Google Inc
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program 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 this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19#ifndef RMODULE_DEFS_H
20#define RMODULE_DEFS_H
21
22#include <stdint.h>
23#include <stddef.h>
24
25#define RMODULE_MAGIC 0xf8fe
26#define RMODULE_VERSION_1 1
27
Aaron Durbin4e6ad1b2014-03-10 09:53:34 -050028/* All fields with '_offset' in the name are byte offsets into the flat blob.
29 * The linker and the linker script takes are of assigning the values. */
30struct rmodule_header {
31 uint16_t magic;
32 uint8_t version;
33 uint8_t type;
34 /* The payload represents the program's loadable code and data. */
35 uint32_t payload_begin_offset;
36 uint32_t payload_end_offset;
37 /* Begin and of relocation information about the program module. */
38 uint32_t relocations_begin_offset;
39 uint32_t relocations_end_offset;
40 /* The starting address of the linked program. This address is vital
41 * for determining relocation offsets as the relocation info and other
42 * symbols (bss, entry point) need this value as a basis to calculate
43 * the offsets.
44 */
45 uint32_t module_link_start_address;
46 /* The module_program_size is the size of memory used while running
47 * the program. The program is assumed to consume a contiguous amount
48 * of memory. */
49 uint32_t module_program_size;
50 /* This is program's execution entry point. */
51 uint32_t module_entry_point;
52 /* Optional parameter structure that can be used to pass data into
53 * the module. */
54 uint32_t parameters_begin;
55 uint32_t parameters_end;
56 /* BSS section information so the loader can clear the bss. */
57 uint32_t bss_begin;
58 uint32_t bss_end;
59 /* Add some room for growth. */
60 uint32_t padding[4];
61} __attribute__ ((packed));
62
63#endif /* RMODULE_DEFS_H */