setjmp.S 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * GRUB -- GRand Unified Bootloader
  3. * Copyright (C) 2013 Free Software Foundation, Inc.
  4. *
  5. * GRUB is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * GRUB is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #include <grub/symbol.h>
  19. #include <grub/dl.h>
  20. .file "setjmp.S"
  21. GRUB_MOD_LICENSE "GPLv3+"
  22. .syntax unified
  23. #if !defined (__thumb2__)
  24. .arm
  25. #else
  26. .thumb
  27. #endif
  28. .text
  29. /*
  30. * int grub_setjmp (grub_jmp_buf env)
  31. */
  32. FUNCTION(grub_setjmp)
  33. mov r12, sp
  34. stm r0, { r4-r12, lr }
  35. mov r0, #0
  36. bx lr
  37. /*
  38. * int grub_longjmp (grub_jmp_buf env, int val)
  39. */
  40. FUNCTION(grub_longjmp)
  41. ldm r0, { r4-r12, lr }
  42. mov sp, r12
  43. movs r0, r1
  44. it eq
  45. moveq r0, #1
  46. bx lr