setjmp.S 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* libunwind - a platform-independent unwind library
  2. Copyright (C) 2003-2004 Hewlett-Packard Co
  3. Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
  4. This file is part of libunwind.
  5. Permission is hereby granted, free of charge, to any person obtaining
  6. a copy of this software and associated documentation files (the
  7. "Software"), to deal in the Software without restriction, including
  8. without limitation the rights to use, copy, modify, merge, publish,
  9. distribute, sublicense, and/or sell copies of the Software, and to
  10. permit persons to whom the Software is furnished to do so, subject to
  11. the following conditions:
  12. The above copyright notice and this permission notice shall be
  13. included in all copies or substantial portions of the Software.
  14. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  15. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  16. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  17. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  18. LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  19. OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  20. WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  21. #include "jmpbuf.h"
  22. .align 32
  23. .global _setjmp
  24. .proc _setjmp
  25. _setjmp:
  26. mov r2 = ar.bsp
  27. st8 [r32] = r12 // jmp_buf[JB_SP] = sp
  28. mov r3 = rp
  29. adds r16 = JB_RP*8, r32
  30. adds r17 = JB_BSP*8, r32
  31. mov r8 = 0
  32. ;;
  33. st8 [r16] = r3 // jmp_buf[JB_RP] = rp
  34. st8 [r17] = r2 // jmp_buf[JB_BSP] = bsp
  35. br.ret.sptk.many rp
  36. .endp _setjmp
  37. #ifdef __linux__
  38. /* We do not need executable stack. */
  39. .section .note.GNU-stack,"",@progbits
  40. #endif