.section .text.entry, "ax" .global _guest_start .type _guest_start, %function _guest_start: ldr x0, =__guest_stack_top mov sp, x0 ldr x0, =__guest_bss_start ldr x1, =__guest_bss_end 1: cmp x0, x1 b.hs 2f str xzr, [x0], #8 b 1b 2: ldr x0, =guest_vectors msr vbar_el1, x0 isb bl guest_main 3: hvc #3 wfe b 3b .global guest_hvc_call .type guest_hvc_call, %function guest_hvc_call: hvc #0 ret .section .text.vectors, "ax" .align 11 guest_vectors: b guest_exception .org guest_vectors + 0x080 b guest_exception .org guest_vectors + 0x100 b guest_exception .org guest_vectors + 0x180 b guest_exception .org guest_vectors + 0x200 b guest_exception .org guest_vectors + 0x280 b guest_exception .org guest_vectors + 0x300 b guest_exception .org guest_vectors + 0x380 b guest_exception .org guest_vectors + 0x400 b guest_exception .org guest_vectors + 0x480 b guest_exception .org guest_vectors + 0x500 b guest_exception .org guest_vectors + 0x580 b guest_exception .org guest_vectors + 0x600 b guest_exception .org guest_vectors + 0x680 b guest_exception .org guest_vectors + 0x700 b guest_exception .org guest_vectors + 0x780 b guest_exception guest_exception: mrs x4, esr_el1 mrs x5, elr_el1 mrs x6, far_el1 mov x0, #5 mov x1, x4 mov x2, x5 mov x3, x6 hvc #0 mov x0, #4 ldr x1, =guest_exception_msg mov x2, #(guest_exception_msg_end - guest_exception_msg) hvc #0 add x5, x5, #4 msr elr_el1, x5 isb eret .section .rodata guest_exception_msg: .ascii "guest exception vector" guest_exception_msg_end: .section .bss.stack, "aw", %nobits .align 12 __guest_stack: .skip 0x10000 __guest_stack_top: