j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
The default context used by init-program is allocated from the OpenBIOS heap which uses a different virt to phys mapping to avoid having to physically relocate the PROM on startup for PPC machines.
It seems that the OpenBSD bootloader isn't happy with this change introduced by the context rework, most likely because there is an assumption that the client stack is mapped 1:1 virt to phys.
Fix this by overriding the default context stack during init-program to a location just under the MMU hash table (SDR1) which was its previous hard-coded location in 1:1 virt to phys mapped memory, and allow OpenBSD to boot.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- arch/ppc/qemu/context.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/arch/ppc/qemu/context.c b/arch/ppc/qemu/context.c index 03ca173..06e0122 100644 --- a/arch/ppc/qemu/context.c +++ b/arch/ppc/qemu/context.c @@ -16,6 +16,7 @@ #include "libopenbios/ofmem.h" #include "libopenbios/initprogram.h" #include "libopenbios/sys_info.h" +#include "arch/ppc/processor.h"
#define MAIN_STACK_SIZE 16384 #define IMAGE_STACK_SIZE 4096*2 @@ -232,6 +233,14 @@ arch_init_program(void) ctx->regs[REG_R6] = 0; ctx->regs[REG_R7] = 0;
+ /* Override the stack in the default context: the OpenBSD bootloader + fails soon after setting up virt to phys mappings with the default + stack. My best guess is that this is because the malloc() heap + doesn't have a 1:1 virt to phys mapping. So for the moment we use + the original (pre-context) location just under the MMU hash table + (SDR1) which is mapped 1:1 and makes the bootloader happy. */ + ctx->sp = mfsdr1() - 32768 - 65536; + /* Set param */ feval("load-state >ls.param @"); param = POP();
On 17/08/18 10:35, Mark Cave-Ayland wrote:
The default context used by init-program is allocated from the OpenBIOS heap which uses a different virt to phys mapping to avoid having to physically relocate the PROM on startup for PPC machines.
It seems that the OpenBSD bootloader isn't happy with this change introduced by the context rework, most likely because there is an assumption that the client stack is mapped 1:1 virt to phys.
Fix this by overriding the default context stack during init-program to a location just under the MMU hash table (SDR1) which was its previous hard-coded location in 1:1 virt to phys mapped memory, and allow OpenBSD to boot.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
arch/ppc/qemu/context.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/arch/ppc/qemu/context.c b/arch/ppc/qemu/context.c index 03ca173..06e0122 100644 --- a/arch/ppc/qemu/context.c +++ b/arch/ppc/qemu/context.c @@ -16,6 +16,7 @@ #include "libopenbios/ofmem.h" #include "libopenbios/initprogram.h" #include "libopenbios/sys_info.h" +#include "arch/ppc/processor.h"
#define MAIN_STACK_SIZE 16384 #define IMAGE_STACK_SIZE 4096*2 @@ -232,6 +233,14 @@ arch_init_program(void) ctx->regs[REG_R6] = 0; ctx->regs[REG_R7] = 0;
- /* Override the stack in the default context: the OpenBSD bootloader
fails soon after setting up virt to phys mappings with the default
stack. My best guess is that this is because the malloc() heap
doesn't have a 1:1 virt to phys mapping. So for the moment we use
the original (pre-context) location just under the MMU hash table
(SDR1) which is mapped 1:1 and makes the bootloader happy. */
- ctx->sp = mfsdr1() - 32768 - 65536;
- /* Set param */ feval("load-state >ls.param @"); param = POP();
Applied to master.
ATB,
Mark.