[OpenBIOS] [PATCHv2 14/25] elf: set boot notes in elf_load() if supplied
Mark Cave-Ayland
mark.cave-ayland at ilande.co.uk
Thu Sep 8 09:00:53 CEST 2016
Since the parameter is now already available to arch_init_program(), there is
no need to supply it separately to start_elf().
Remove the second parameter and fix up the callers, including standardising
the prototype of start_elf() across all architectures.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
arch/amd64/context.c | 5 +----
arch/ppc/qemu/context.c | 4 ++--
arch/ppc/qemu/init.c | 4 ++--
arch/sparc32/boot.c | 25 +++++++++++--------------
arch/sparc32/boot.h | 2 +-
arch/sparc32/context.c | 2 +-
arch/sparc64/boot.c | 2 +-
arch/sparc64/boot.h | 2 +-
arch/sparc64/context.c | 5 +----
arch/x86/boot.c | 12 +++++-------
arch/x86/boot.h | 2 +-
arch/x86/context.c | 5 +----
libopenbios/elf_load.c | 2 ++
13 files changed, 30 insertions(+), 42 deletions(-)
diff --git a/arch/amd64/context.c b/arch/amd64/context.c
index 4e792c7..8837cbb 100644
--- a/arch/amd64/context.c
+++ b/arch/amd64/context.c
@@ -147,13 +147,10 @@ struct context *switch_to(struct context *ctx)
}
/* Start ELF image */
-uint32_t start_elf(uint32_t entry_point, uint32_t param)
+unsigned int start_elf(unsigned long entry_point)
{
struct context *ctx = client_ctx;
- PUSH(param);
- feval("load-state >ls.param !");
-
arch_init_program();
ctx = switch_to(ctx);
diff --git a/arch/ppc/qemu/context.c b/arch/ppc/qemu/context.c
index f956488..6fbec17 100644
--- a/arch/ppc/qemu/context.c
+++ b/arch/ppc/qemu/context.c
@@ -32,7 +32,7 @@
static void start_main(void); /* forward decl. */
void __exit_context(void); /* assembly routine */
-unsigned int start_elf(unsigned long entry_point, unsigned long param);
+unsigned int start_elf(unsigned long entry_point);
void entry(void);
void of_client_callback(void);
@@ -157,7 +157,7 @@ struct context *switch_to(struct context *ctx)
}
/* Start ELF Boot image */
-unsigned int start_elf(unsigned long entry_point, unsigned long param)
+unsigned int start_elf(unsigned long entry_point)
{
struct context *ctx = client_ctx;
diff --git a/arch/ppc/qemu/init.c b/arch/ppc/qemu/init.c
index f6bbce2..a401a9c 100644
--- a/arch/ppc/qemu/init.c
+++ b/arch/ppc/qemu/init.c
@@ -596,7 +596,7 @@ id_cpu(void)
}
static void go(void);
-unsigned int start_elf(unsigned long entry_point, unsigned long param);
+unsigned int start_elf(unsigned long entry_point);
static void
go(void)
@@ -611,7 +611,7 @@ go(void)
feval("load-state >ls.entry @");
addr = POP();
- start_elf((unsigned long)addr, 0);
+ start_elf((unsigned long)addr);
}
static void kvm_of_init(void)
diff --git a/arch/sparc32/boot.c b/arch/sparc32/boot.c
index c7b58a8..d65913a 100644
--- a/arch/sparc32/boot.c
+++ b/arch/sparc32/boot.c
@@ -209,35 +209,27 @@ void go(void)
switch (type) {
case 0x0:
/* Start ELF boot image */
- image_retval = start_elf((unsigned long)address,
- (unsigned long)romvec);
-
+ image_retval = start_elf((unsigned long)address);
break;
case 0x1:
/* Start ELF image */
- image_retval = start_elf((unsigned long)address,
- (unsigned long)romvec);
-
+ image_retval = start_elf((unsigned long)address);
break;
case 0x5:
/* Start a.out image */
- image_retval = start_elf((unsigned long)address,
- (unsigned long)romvec);
-
+ image_retval = start_elf((unsigned long)address);
break;
case 0x10:
/* Start Fcode image */
- image_retval = start_elf((unsigned long)&init_fcode_context,
- (unsigned long)romvec);
+ image_retval = start_elf((unsigned long)&init_fcode_context);
break;
case 0x11:
/* Start Forth image */
- image_retval = start_elf((unsigned long)&init_forth_context,
- (unsigned long)romvec);
+ image_retval = start_elf((unsigned long)&init_forth_context);
break;
}
@@ -250,6 +242,11 @@ void boot(void)
/* Boot preloaded kernel */
if (kernel_size) {
printk("[sparc] Kernel already loaded\n");
- start_elf(kernel_image, (unsigned long)romvec);
+
+ PUSH(kernel_image);
+ feval("load-state >ls.entry !");
+
+ arch_init_program();
+ start_elf(kernel_image);
}
}
diff --git a/arch/sparc32/boot.h b/arch/sparc32/boot.h
index 9bfc07e..6aabba3 100644
--- a/arch/sparc32/boot.h
+++ b/arch/sparc32/boot.h
@@ -11,7 +11,7 @@ int linux_load(struct sys_info *info, const char *file, const char *cmdline);
// context.c
extern struct context * volatile __context;
-unsigned int start_elf(unsigned long entry_point, unsigned long param);
+unsigned int start_elf(unsigned long entry_point);
// boot.c
extern const char *bootpath;
diff --git a/arch/sparc32/context.c b/arch/sparc32/context.c
index 0a5b370..44abc74 100644
--- a/arch/sparc32/context.c
+++ b/arch/sparc32/context.c
@@ -129,7 +129,7 @@ struct context *switch_to(struct context *ctx)
}
/* Start ELF Boot image */
-unsigned int start_elf(unsigned long entry_point, unsigned long param)
+unsigned int start_elf(unsigned long entry_point)
{
struct context *ctx = client_ctx;
diff --git a/arch/sparc64/boot.c b/arch/sparc64/boot.c
index c2e3dc1..08d7f51 100644
--- a/arch/sparc64/boot.c
+++ b/arch/sparc64/boot.c
@@ -36,7 +36,7 @@ void go(void)
switch (type) {
case 0x0:
/* Start ELF boot image */
- image_retval = start_elf(address, (uint64_t)&elf_boot_notes);
+ image_retval = start_elf(address);
break;
case 0x1:
diff --git a/arch/sparc64/boot.h b/arch/sparc64/boot.h
index 3ab05e0..aa9894e 100644
--- a/arch/sparc64/boot.h
+++ b/arch/sparc64/boot.h
@@ -11,7 +11,7 @@ int linux_load(struct sys_info *info, const char *file, const char *cmdline);
// context.c
extern struct context * volatile __context;
-uint64_t start_elf(uint64_t entry_point, uint64_t param);
+unsigned int start_elf(unsigned long entry_point);
uint64_t start_client_image(uint64_t entry_point, uint64_t cif_handler);
// boot.c
diff --git a/arch/sparc64/context.c b/arch/sparc64/context.c
index 3177e8c..f07f1ef 100644
--- a/arch/sparc64/context.c
+++ b/arch/sparc64/context.c
@@ -138,13 +138,10 @@ struct context *switch_to(struct context *ctx)
}
/* Start ELF Boot image */
-uint64_t start_elf(uint64_t entry_point, uint64_t param)
+unsigned int start_elf(unsigned long entry_point)
{
struct context *ctx = client_ctx;
- PUSH(param);
- feval("load-state >ls.param !");
-
arch_init_program();
ctx = switch_to(ctx);
diff --git a/arch/x86/boot.c b/arch/x86/boot.c
index 1eae76c..688b24e 100644
--- a/arch/x86/boot.c
+++ b/arch/x86/boot.c
@@ -31,29 +31,27 @@ void go(void)
switch (type) {
case 0x0:
/* Start ELF boot image */
- image_retval = start_elf(address, (uint32_t)&elf_boot_notes);
+ image_retval = start_elf(address);
break;
case 0x1:
/* Start ELF image */
- image_retval = start_elf(address, (uint32_t)NULL);
+ image_retval = start_elf(address);
break;
case 0x5:
/* Start a.out image */
- image_retval = start_elf(address, (uint32_t)NULL);
+ image_retval = start_elf(address);
break;
case 0x10:
/* Start Fcode image */
- image_retval = start_elf((unsigned long)&init_fcode_context,
- (uint32_t)NULL);
+ image_retval = start_elf((unsigned long)&init_fcode_context);
break;
case 0x11:
/* Start Forth image */
- image_retval = start_elf((unsigned long)&init_forth_context,
- (uint32_t)NULL);
+ image_retval = start_elf((unsigned long)&init_forth_context);
break;
}
diff --git a/arch/x86/boot.h b/arch/x86/boot.h
index 749c608..fff6719 100644
--- a/arch/x86/boot.h
+++ b/arch/x86/boot.h
@@ -11,7 +11,7 @@ int linux_load(struct sys_info *info, const char *file, const char *cmdline);
/* context.c */
extern struct context *__context;
-unsigned int start_elf(unsigned long entry_point, unsigned long param);
+unsigned int start_elf(unsigned long entry_point);
/* boot.c */
extern void boot(void);
diff --git a/arch/x86/context.c b/arch/x86/context.c
index 6d57bfa..17d4f0e 100644
--- a/arch/x86/context.c
+++ b/arch/x86/context.c
@@ -153,13 +153,10 @@ struct context *switch_to(struct context *ctx)
}
/* Start ELF Boot image */
-unsigned int start_elf(unsigned long entry_point, unsigned long param)
+unsigned int start_elf(unsigned long entry_point)
{
struct context *ctx = client_ctx;
- PUSH(param);
- feval("load-state >ls.param !");
-
arch_init_program();
ctx = switch_to(ctx);
diff --git a/libopenbios/elf_load.c b/libopenbios/elf_load.c
index b0b19ee..aa81e4c 100644
--- a/libopenbios/elf_load.c
+++ b/libopenbios/elf_load.c
@@ -442,6 +442,8 @@ elf_load(struct sys_info *info, ihandle_t dev, const char *cmdline, void **boot_
if (boot_notes) {
*boot_notes = (void *)virt_to_phys(build_boot_notes(info, cmdline));
feval("elf-boot load-state >ls.file-type !");
+ PUSH((ucell)*boot_notes);
+ feval("elf-boot load-state >ls.param !");
} else {
feval("elf load-state >ls.file-type !");
}
--
1.7.10.4
More information about the OpenBIOS
mailing list