trusty-fiq-arm.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (C) 2013 Google, Inc.
  3. *
  4. * This software is licensed under the terms of the GNU General Public
  5. * License version 2, as published by the Free Software Foundation, and
  6. * may be copied, distributed, and modified under those terms.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. */
  14. #include <asm/fiq_glue.h>
  15. #include <linux/platform_device.h>
  16. #include <linux/trusty/smcall.h>
  17. #include <linux/trusty/trusty.h>
  18. #include "trusty-fiq.h"
  19. #define _STRINGIFY(x) #x
  20. #define STRINGIFY(x) _STRINGIFY(x)
  21. static void __naked trusty_fiq_return(void)
  22. {
  23. asm volatile(
  24. ".arch_extension sec\n"
  25. "mov r12, r0\n"
  26. "ldr r0, =" STRINGIFY(SMC_FC_FIQ_EXIT) "\n"
  27. "smc #0");
  28. }
  29. int trusty_fiq_arch_probe(struct platform_device *pdev)
  30. {
  31. return fiq_glue_set_return_handler(trusty_fiq_return);
  32. }
  33. void trusty_fiq_arch_remove(struct platform_device *pdev)
  34. {
  35. fiq_glue_clear_return_handler(trusty_fiq_return);
  36. }