1/* 2 * Copyright (C) 2018 Linaro Ltd <ard.biesheuvel@linaro.org> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License version 2 as 6 * published by the Free Software Foundation. 7 */ 8 9#include <linux/linkage.h> 10 11ENTRY(__efi_rt_asm_wrapper) 12 stp x29, x30, [sp, #-32]! 13 mov x29, sp 14 15 /* 16 * Register x18 is designated as the 'platform' register by the AAPCS, 17 * which means firmware running at the same exception level as the OS 18 * (such as UEFI) should never touch it. 19 */ 20 stp x1, x18, [sp, #16] 21 22 /* 23 * We are lucky enough that no EFI runtime services take more than 24 * 5 arguments, so all are passed in registers rather than via the 25 * stack. 26 */ 27 mov x8, x0 28 mov x0, x2 29 mov x1, x3 30 mov x2, x4 31 mov x3, x5 32 mov x4, x6 33 blr x8 34 35 ldp x1, x2, [sp, #16] 36 cmp x2, x18 37 ldp x29, x30, [sp], #32 38 b.ne 0f 39 ret 400: b efi_handle_corrupted_x18 // tail call 41ENDPROC(__efi_rt_asm_wrapper) 42