diff options
Diffstat (limited to 'src/arch/x86')
-rw-r--r-- | src/arch/x86/include/arch/cbfs.h | 21 | ||||
-rw-r--r-- | src/arch/x86/lib/walkcbfs.S | 6 |
2 files changed, 21 insertions, 6 deletions
diff --git a/src/arch/x86/include/arch/cbfs.h b/src/arch/x86/include/arch/cbfs.h index 8a61d6e22d..964eb4edea 100644 --- a/src/arch/x86/include/arch/cbfs.h +++ b/src/arch/x86/include/arch/cbfs.h @@ -20,7 +20,9 @@ #ifndef __INCLUDE_ARCH_CBFS__ #define __INCLUDE_ARCH_CBFS__ -static void *walkcbfs(char *target) +#include <cbfs_core.h> + +static struct cbfs_file *walkcbfs_head(char *target) { void *entry; asm volatile ( @@ -30,6 +32,16 @@ static void *walkcbfs(char *target) return entry; } +static void *walkcbfs(char *target) +{ + struct cbfs_file *head = walkcbfs_head(target); + if ((u32)head != 0) + return CBFS_SUBHEADER(head); + + /* We should never reach this if 'target' exists */ + return (void *)0; +} + /* just enough to support findstage. copied because the original version doesn't easily pass through romcc */ struct cbfs_stage_restricted { unsigned long compression; @@ -38,7 +50,12 @@ struct cbfs_stage_restricted { static inline unsigned long findstage(char* target) { - return ((struct cbfs_stage_restricted *)walkcbfs(target))->entry; + struct cbfs_stage_restricted *stage = walkcbfs(target); + if ((u32)stage != 0) + return stage->entry; + + /* We should never reach this if 'target' exists */ + return 0; } static inline void call(unsigned long addr, unsigned long bist) diff --git a/src/arch/x86/lib/walkcbfs.S b/src/arch/x86/lib/walkcbfs.S index 2dc9617651..60eb8b53b0 100644 --- a/src/arch/x86/lib/walkcbfs.S +++ b/src/arch/x86/lib/walkcbfs.S @@ -18,7 +18,7 @@ /* * input %esi: filename * input %esp: return address (not pointer to return address!) - * output %eax: entry point + * output %eax: pointer to CBFS header * clobbers %ebx, %ecx, %edi */ walkcbfs_asm: @@ -59,9 +59,7 @@ walker: jnz tryharder /* we found it! */ - mov CBFS_FILE_OFFSET(%ebx), %eax - bswap %eax - add %ebx, %eax + mov %ebx, %eax jmp *%esp tryharder: |