The current implementation of load/init-program has some fairly big hacks in order to work around the fact that we don't have per-architecture CPU contexts. An example of this is chained bootloaders used for SPARC64 which use Forth to alter the saved CPU context so that control is returned to a different address by directly executing init-program before return.
With all architectures now able to save/restore CPU contexts, these hacks can now be removed and init-program changed to be a single per-architecture implementation along with some associated tidy-ups.
I've given this a fairly thorough testing across all my OpenBIOS test images and as far as I can tell doesn't cause any regressions.
Requires the previously posted SPARC32 and SPARC64 context patches to be applied first.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
v2: - Fix missing patch for XCOFF loader conversion - Switch aout_init_program() to use memmove() - Fix minor typo in aout_init_program() comment
Mark Cave-Ayland (25): libopenbios: rename saved-program-state to load-state libopenbios: introduce arch_init_program() in preparation for per-arch implementations all: create client program context once at startup client.fs: add load-state param variable amd64: introduce arch_init_program() implementation ppc: introduce arch_init_program() implementation SPARC32: introduce arch_init_program() implementation SPARC64: introduce arch_init_program() implementation x86: introduce arch_init_program() implementation libopenbios: add context wrappers for Fcode/Forth payloads SPARC32: move Forth/FCode over to use new context wrappers SPARC64: move Forth/FCode over to use new context wrappers x86: move Forth/FCode over to use new context wrappers elf: set boot notes in elf_load() if supplied SPARC64: remove start_client_image() libopenbios: move prototypes for start_elf() and __context into libopenbios libopenbios: move go() function into libopenbios aout: implement load/init-program as per IEEE-1275 specification bootcode: implement load/init-program as per IEEE-1275 specification elf: implement load/init-program as per IEEE-1275 specification fcode: implement load/init-program as per IEEE-1275 specification forth: implement load/init-program as per IEEE-1275 specification xcoff: implement load/init-program as per IEEE-1275 specification libopenbios: remove conditional logic from go() libopenbios: remove address parameter from start_elf()
arch/amd64/context.c | 51 ++++++++++++---- arch/ppc/qemu/context.c | 67 ++++++++++++++------- arch/ppc/qemu/init.c | 14 +---- arch/sparc32/boot.c | 71 +++------------------- arch/sparc32/boot.h | 6 +- arch/sparc32/context.c | 39 +++++++++--- arch/sparc32/openbios.c | 2 +- arch/sparc64/boot.c | 54 +---------------- arch/sparc64/boot.h | 6 -- arch/sparc64/context.c | 68 ++++++++++++--------- arch/sparc64/openbios.c | 1 - arch/unix/boot.c | 13 ++++ arch/x86/boot.c | 53 +---------------- arch/x86/boot.h | 6 +- arch/x86/context.c | 52 ++++++++++++---- arch/x86/openbios.c | 1 - forth/debugging/client.fs | 30 +++++----- include/libopenbios/bootcode_load.h | 2 + include/libopenbios/initprogram.h | 9 +++ include/libopenbios/xcoff_load.h | 2 +- libopenbios/aout_load.c | 48 +++++++-------- libopenbios/bootcode_load.c | 33 +++++++++-- libopenbios/elf_load.c | 28 ++++----- libopenbios/fcode_load.c | 32 ++++------ libopenbios/forth_load.c | 30 +++++----- libopenbios/init.c | 3 + libopenbios/initprogram.c | 45 ++++++++++++++ libopenbios/load.c | 58 +++++++++--------- libopenbios/xcoff_load.c | 111 +++++++++++++++++++++++++++++++---- 29 files changed, 526 insertions(+), 409 deletions(-)