1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 #ifndef RMODULE_DEFS_H 3 #define RMODULE_DEFS_H 4 5 #include <stdint.h> 6 #include <stddef.h> 7 8 #define RMODULE_MAGIC 0xf8fe 9 #define RMODULE_VERSION_1 1 10 11 /* All fields with '_offset' in the name are byte offsets into the flat blob. 12 * The linker and the linker script takes are of assigning the values. */ 13 struct rmodule_header { 14 uint16_t magic; 15 uint8_t version; 16 uint8_t type; 17 /* The payload represents the program's loadable code and data. */ 18 uint32_t payload_begin_offset; 19 uint32_t payload_end_offset; 20 /* Begin and of relocation information about the program module. */ 21 uint32_t relocations_begin_offset; 22 uint32_t relocations_end_offset; 23 /* The starting address of the linked program. This address is vital 24 * for determining relocation offsets as the relocation info and other 25 * symbols (bss, entry point) need this value as a basis to calculate 26 * the offsets. 27 */ 28 uint32_t module_link_start_address; 29 /* The module_program_size is the size of memory used while running 30 * the program. The program is assumed to consume a contiguous amount 31 * of memory. */ 32 uint32_t module_program_size; 33 /* This is program's execution entry point. */ 34 uint32_t module_entry_point; 35 /* Optional parameter structure that can be used to pass data into 36 * the module. */ 37 uint32_t parameters_begin; 38 uint32_t parameters_end; 39 /* BSS section information so the loader can clear the bss. */ 40 uint32_t bss_begin; 41 uint32_t bss_end; 42 /* Add some room for growth. */ 43 uint32_t padding[4]; 44 } __packed; 45 46 #endif /* RMODULE_DEFS_H */ 47