UPSTREAM: x86: provide stage_exit() like arm

The arm architectures have a stage_exit() function
which takes a void * pointer as an entry point. Provide
the same API for x86. This can make the booting paths
less architecture-specific.

BUG=chrome-os-partner:30784
TEST=built for nyan.

Change-Id: I4ecfbf32f38f2e3817381b63e1f97e92654c5f97
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/5086
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
Reviewed-on: https://chromium-review.googlesource.com/209591
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
This commit is contained in:
Aaron Durbin 2014-01-30 15:48:29 -06:00 committed by chrome-internal-fetch
commit 3d69cce280
3 changed files with 10 additions and 20 deletions

View file

@ -24,4 +24,12 @@
void asmlinkage copy_and_run(void);
void jmp_to_elf_entry(void *entry, unsigned long buffer, unsigned long size);
static inline void stage_exit(void *entry)
{
__asm__ volatile (
"jmp *%%edi\n"
:: "D"(entry)
);
}
#endif

View file

@ -34,10 +34,7 @@ static void cbfs_and_run_core(const char *filename)
timestamp_add_now(TS_END_COPYRAM);
print_debug("Jumping to image.\n");
__asm__ volatile (
"jmp *%%edi\n"
:: "D"(dst)
);
stage_exit(dst);
}
void asmlinkage copy_and_run(void)

View file

@ -17,6 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <arch/stages.h>
#include <stdint.h>
#include <stddef.h>
#include <string.h>
@ -353,15 +354,7 @@ static void vboot_load_ramstage(struct vboot_handoff *vboot_handoff,
timestamp_add_now(TS_END_COPYRAM);
#if CONFIG_ARCH_X86
__asm__ volatile (
"movl $0, %%ebp\n"
"jmp *%%edi\n"
:: "D"(rmod_load.entry)
);
#elif CONFIG_ARCH_ARM
stage_exit(rmod_load.entry);
#endif
}
#else /* CONFIG_RELOCATABLE_RAMSTAGE */
static void vboot_load_ramstage(struct vboot_handoff *vboot_handoff,
@ -408,15 +401,7 @@ static void vboot_load_ramstage(struct vboot_handoff *vboot_handoff,
timestamp_add_now(TS_END_COPYRAM);
#if CONFIG_ARCH_X86
__asm__ volatile (
"movl $0, %%ebp\n"
"jmp *%%edi\n"
:: "D"(stage->entry)
);
#elif CONFIG_ARCH_ARM
stage_exit((void *)(uintptr_t)stage->entry);
#endif
}
#endif /* CONFIG_RELOCATABLE_RAMSTAGE */