arm_64 exception vector and el2 stack

Michael Grunditz michael.grunditz at gmail.com
Wed Jan 4 01:05:22 CET 2023


On Tue, 3 Jan 2023 at 17:20, Michael Grunditz
<michael.grunditz at gmail.com> wrote:
>
> > I figured that. It is just that I was unsure about el2_stack because
> > of , set before mmu.
> and apparently I ignored the sctlr settings :-)

OK so here is what I have now..

The code for EL switch with comments:

asm volatile("mov x0, sp      \n"  ** current phys sp
                     "msr sp_el1, x0  \n" ** set el1 sp
                     "adr x0, 1f      \n" *point out return point
                     "msr elr_el2, x0 \n" * set it
                     "mov sp, %0      \n" *** set virtual sp el2
                     "eret            \n" *** exception return
                     "1: \n" ** return point
                     "ldr x0,=0xfeb50000\n" ** uart address
                     "mov x1,#'m'      \n"** write to it
                     "str x1,[x0]     ": : "r"(stack_el2): "x0","x1");

Before this I added:
Genode::addr_t const oldvbar = Cpu::Vbar_el2::read();
        Cpu::Vbar_el1::write(oldvbar);

... and it is from uboot. I hope el1 will get it with that last statement.

I get nothing on uart.. and no exception catched. The whole point of
writing to uart with asm is to test if it is the exit to c++ that
fails.

Running out of ideas.

/Michael



More information about the users mailing list