Use ntohll where appropriate.
also clean out a local copy of ntohl in yabel. Change-Id: Iffe85a53c9ea25abeb3ac663870eb7eb4874a704 Signed-off-by: Stefan Reinauer <reinauer@google.com> Reviewed-on: http://review.coreboot.org/288 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
This commit is contained in:
parent
9ea33e9318
commit
02e75b2b67
|
@ -349,11 +349,12 @@ static int build_self_segment_list(
|
||||||
segment->type == PAYLOAD_SEGMENT_CODE ? "code" : "data",
|
segment->type == PAYLOAD_SEGMENT_CODE ? "code" : "data",
|
||||||
ntohl(segment->compression));
|
ntohl(segment->compression));
|
||||||
new = malloc(sizeof(*new));
|
new = malloc(sizeof(*new));
|
||||||
new->s_dstaddr = ntohl((u32) segment->load_addr);
|
new->s_dstaddr = ntohll(segment->load_addr);
|
||||||
new->s_memsz = ntohl(segment->mem_len);
|
new->s_memsz = ntohl(segment->mem_len);
|
||||||
new->compression = ntohl(segment->compression);
|
new->compression = ntohl(segment->compression);
|
||||||
|
|
||||||
new->s_srcaddr = (u32) ((unsigned char *) first_segment) + ntohl(segment->offset);
|
new->s_srcaddr = (u32) ((unsigned char *)first_segment)
|
||||||
|
+ ntohl(segment->offset);
|
||||||
new->s_filesz = ntohl(segment->len);
|
new->s_filesz = ntohl(segment->len);
|
||||||
printk(BIOS_DEBUG, " New segment dstaddr 0x%lx memsize 0x%lx srcaddr 0x%lx filesize 0x%lx\n",
|
printk(BIOS_DEBUG, " New segment dstaddr 0x%lx memsize 0x%lx srcaddr 0x%lx filesize 0x%lx\n",
|
||||||
new->s_dstaddr, new->s_memsz, new->s_srcaddr, new->s_filesz);
|
new->s_dstaddr, new->s_memsz, new->s_srcaddr, new->s_filesz);
|
||||||
|
@ -366,17 +367,18 @@ static int build_self_segment_list(
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAYLOAD_SEGMENT_BSS:
|
case PAYLOAD_SEGMENT_BSS:
|
||||||
printk(BIOS_DEBUG, " BSS 0x%p (%d byte)\n", (void *) ntohl((u32) segment->load_addr),
|
printk(BIOS_DEBUG, " BSS 0x%p (%d byte)\n", (void *)
|
||||||
ntohl(segment->mem_len));
|
(intptr_t)ntohll(segment->load_addr),
|
||||||
|
ntohl(segment->mem_len));
|
||||||
new = malloc(sizeof(*new));
|
new = malloc(sizeof(*new));
|
||||||
new->s_filesz = 0;
|
new->s_filesz = 0;
|
||||||
new->s_dstaddr = ntohl((u32) segment->load_addr);
|
new->s_dstaddr = ntohll(segment->load_addr);
|
||||||
new->s_memsz = ntohl(segment->mem_len);
|
new->s_memsz = ntohl(segment->mem_len);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAYLOAD_SEGMENT_ENTRY:
|
case PAYLOAD_SEGMENT_ENTRY:
|
||||||
printk(BIOS_DEBUG, " Entry Point 0x%p\n", (void *) ntohl((u32) segment->load_addr));
|
printk(BIOS_DEBUG, " Entry Point 0x%p\n", (void *) ntohl((u32) segment->load_addr));
|
||||||
*entry = ntohl((u32) segment->load_addr);
|
*entry = ntohll(segment->load_addr);
|
||||||
/* Per definition, a payload always has the entry point
|
/* Per definition, a payload always has the entry point
|
||||||
* as last segment. Thus, we use the occurence of the
|
* as last segment. Thus, we use the occurence of the
|
||||||
* entry point as break condition for the loop.
|
* entry point as break condition for the loop.
|
||||||
|
@ -396,7 +398,7 @@ static int build_self_segment_list(
|
||||||
|
|
||||||
// FIXME: Explain what this is
|
// FIXME: Explain what this is
|
||||||
for(ptr = head->next; ptr != head; ptr = ptr->next) {
|
for(ptr = head->next; ptr != head; ptr = ptr->next) {
|
||||||
if (new->s_srcaddr < ntohl((u32) segment->load_addr))
|
if (new->s_srcaddr < ntohll(segment->load_addr))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <arch/byteorder.h>
|
#include <arch/byteorder.h>
|
||||||
#define ntohl(x) be32_to_cpu(x)
|
|
||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,7 @@ void * cbfs_load_stage(const char *name)
|
||||||
printk(BIOS_DEBUG, "Stage: done loading.\n");
|
printk(BIOS_DEBUG, "Stage: done loading.\n");
|
||||||
|
|
||||||
entry = stage->entry;
|
entry = stage->entry;
|
||||||
// entry = ntohl((u32) stage->entry);
|
// entry = ntohll(stage->entry);
|
||||||
|
|
||||||
return (void *) entry;
|
return (void *) entry;
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ int cbfs_execute_stage(const char *name)
|
||||||
|
|
||||||
/* FIXME: This isn't right */
|
/* FIXME: This isn't right */
|
||||||
printk(BIOS_INFO, "CBFS: run @ %p\n", (void *) ntohl((u32) stage->entry));
|
printk(BIOS_INFO, "CBFS: run @ %p\n", (void *) ntohl((u32) stage->entry));
|
||||||
return run_address((void *) ntohl((u32) stage->entry));
|
return run_address((void *) (intptr_t)ntohll(stage->entry));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue