efi-rt-wrapper.S 960 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. #include <linux/linkage.h>
  9. ENTRY(__efi_rt_asm_wrapper)
  10. stp x29, x30, [sp, #-32]!
  11. mov x29, sp
  12. /*
  13. * Register x18 is designated as the 'platform' register by the AAPCS,
  14. * which means firmware running at the same exception level as the OS
  15. * (such as UEFI) should never touch it.
  16. */
  17. stp x1, x18, [sp, #16]
  18. /*
  19. * We are lucky enough that no EFI runtime services take more than
  20. * 5 arguments, so all are passed in registers rather than via the
  21. * stack.
  22. */
  23. mov x8, x0
  24. mov x0, x2
  25. mov x1, x3
  26. mov x2, x4
  27. mov x3, x5
  28. mov x4, x6
  29. blr x8
  30. ldp x1, x2, [sp, #16]
  31. cmp x2, x18
  32. ldp x29, x30, [sp], #32
  33. b.ne 0f
  34. ret
  35. 0: b efi_handle_corrupted_x18 // tail call
  36. ENDPROC(__efi_rt_asm_wrapper)