On 06/09/16 08:13, Mark Cave-Ayland wrote:
On 06/09/16 01:40, Programmingkid wrote:
On Sep 5, 2016, at 6:01 PM, Mark Cave-Ayland wrote:
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
Mark Cave-Ayland (24): 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 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 +++++ 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 | 47 ++++++++--------------- libopenbios/xcoff_load.c | 8 ++-- 28 files changed, 417 insertions(+), 402 deletions(-)
-- 1.7.10.4
-- OpenBIOS http://openbios.org/ Mailinglist: http://lists.openbios.org/mailman/listinfo Free your System - May the Forth be with you
That is an impressive amount of work done. Would you have a repo that someone could clone in order to test out your patches?
I've pushed it here: https://github.com/mcayland/openbios/tree/context
Note that PPC mostly just worked as the bootloaders are considerably less complex than the SPARC variants which rely rather heavily on the PROM for boot.
And I've just re-pushed the updated v2 to github too.
ATB,
Mark.