blob: 0922c811fdbc9816f59ef661705d1a06d0a1da13 [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.
Aaron Durbin4e6ad1b2014-03-10 09:53:34 -050014 */
15#ifndef RMODULE_DEFS_H
16#define RMODULE_DEFS_H
17
18#include <stdint.h>
19#include <stddef.h>
20
21#define RMODULE_MAGIC 0xf8fe
22#define RMODULE_VERSION_1 1
23
Aaron Durbin4e6ad1b2014-03-10 09:53:34 -050024/* All fields with '_offset' in the name are byte offsets into the flat blob.
25 * The linker and the linker script takes are of assigning the values. */
26struct rmodule_header {
27 uint16_t magic;
28 uint8_t version;
29 uint8_t type;
30 /* The payload represents the program's loadable code and data. */
31 uint32_t payload_begin_offset;
32 uint32_t payload_end_offset;
33 /* Begin and of relocation information about the program module. */
34 uint32_t relocations_begin_offset;
35 uint32_t relocations_end_offset;
36 /* The starting address of the linked program. This address is vital
37 * for determining relocation offsets as the relocation info and other
38 * symbols (bss, entry point) need this value as a basis to calculate
39 * the offsets.
40 */
41 uint32_t module_link_start_address;
42 /* The module_program_size is the size of memory used while running
43 * the program. The program is assumed to consume a contiguous amount
44 * of memory. */
45 uint32_t module_program_size;
46 /* This is program's execution entry point. */
47 uint32_t module_entry_point;
48 /* Optional parameter structure that can be used to pass data into
49 * the module. */
50 uint32_t parameters_begin;
51 uint32_t parameters_end;
52 /* BSS section information so the loader can clear the bss. */
53 uint32_t bss_begin;
54 uint32_t bss_end;
55 /* Add some room for growth. */
56 uint32_t padding[4];
57} __attribute__ ((packed));
58
59#endif /* RMODULE_DEFS_H */