summaryrefslogtreecommitdiff
path: root/src/lib/rmodule.c
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2014-03-10 09:53:34 -0500
committerAaron Durbin <adurbin@google.com>2014-03-11 19:42:15 +0100
commit4e6ad1bcaf63b746236d56dec39ff8ac3348c7be (patch)
treeb9c585473a7192aa73a229da5c00a8393dece46d /src/lib/rmodule.c
parent62a3f6f6656012c6c0bc4f95f8773fc9c1811cd5 (diff)
downloadcoreboot-4e6ad1bcaf63b746236d56dec39ff8ac3348c7be.tar.xz
rmodule: allow rmodule header structure to be used by userland
In order for userland to create rmodules the common code should be shareable. Therefore, convert the short u<width> name types to the posix uint<width>_t types. Additionally, move the definition of the header structure to a new rmodule-defs.h header file so that userland can include that without pulling in the coreboot state. Change-Id: I54acd3bfd8c207b9efd50a3b6d89efd5fcbfc1d9 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/5363 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/lib/rmodule.c')
-rw-r--r--src/lib/rmodule.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/rmodule.c b/src/lib/rmodule.c
index a3e2184633..2cb70b8f33 100644
--- a/src/lib/rmodule.c
+++ b/src/lib/rmodule.c
@@ -34,8 +34,8 @@
* locations.
*/
typedef struct {
- u32 r_offset;
- u32 r_info;
+ uint32_t r_offset;
+ uint32_t r_info;
} Elf32_Rel;
#define R_386_RELATIVE 8
@@ -71,7 +71,7 @@ static inline int rmodule_is_loaded(const struct rmodule *module)
/* Calculate a loaded program address based on the blob address. */
static inline void *rmodule_load_addr(const struct rmodule *module,
- u32 blob_addr)
+ uint32_t blob_addr)
{
char *loc = module->location;
return &loc[blob_addr - module->header->module_link_start_address];
@@ -176,7 +176,7 @@ static void rmodule_copy_payload(const struct rmodule *module)
memcpy(module->location, module->payload, module->payload_size);
}
-static inline u32 *rmodule_adjustment_location(const struct rmodule *module,
+static inline uint32_t *rmodule_adjustment_location(const struct rmodule *module,
const void *reloc)
{
int reloc_offset;
@@ -193,11 +193,11 @@ static int rmodule_relocate(const struct rmodule *module)
{
int num_relocations;
const void *reloc;
- u32 adjustment;
+ uint32_t adjustment;
/* Each relocation needs to be adjusted relative to the beginning of
* the loaded program. */
- adjustment = (u32)rmodule_load_addr(module, 0);
+ adjustment = (uint32_t)rmodule_load_addr(module, 0);
reloc = module->relocations;
num_relocations = rmodule_number_relocations(module);
@@ -206,7 +206,7 @@ static int rmodule_relocate(const struct rmodule *module)
num_relocations, adjustment);
while (num_relocations > 0) {
- u32 *adjust_loc;
+ uint32_t *adjust_loc;
if (!rmodule_reloc_valid(reloc))
return -1;