setjmp.S 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * libc/sysdeps/linux/microblaze/setjmp.S -- `setjmp' for microblaze
  3. *
  4. * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
  5. * Copyright (C) 2001,2002 NEC Corporation
  6. * Copyright (C) 2001,2002 Miles Bader <miles@gnu.org>
  7. *
  8. * This file is subject to the terms and conditions of the GNU Lesser
  9. * General Public License. See the file COPYING.LIB in the main
  10. * directory of this archive for more details.
  11. *
  12. * Written by Miles Bader <miles@gnu.org>
  13. *
  14. * PIC code based on glibc 2.3.6 */
  15. /*
  16. The GNU C Library is free software; you can redistribute it and/or
  17. modify it under the terms of the GNU Lesser General Public
  18. License as published by the Free Software Foundation; either
  19. version 2.1 of the License, or (at your option) any later version.
  20. The GNU C Library is distributed in the hope that it will be useful,
  21. but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  23. Lesser General Public License for more details.
  24. You should have received a copy of the GNU Lesser General Public
  25. License along with the GNU C Library; if not, see
  26. <http://www.gnu.org/licenses/>. */
  27. #include <libc-symbols.h>
  28. .text
  29. .globl C_SYMBOL_NAME(setjmp)
  30. .align 4
  31. C_SYMBOL_NAME(setjmp):
  32. #ifdef __PIC__
  33. brid 1f
  34. #else
  35. braid C_SYMBOL_NAME(__sigsetjmp)
  36. #endif
  37. addi r6, r0, 1 /* Save the signal mask. */
  38. .globl C_SYMBOL_NAME(_setjmp)
  39. C_SYMBOL_NAME(_setjmp):
  40. and r6, r0, r0 /* Don't save the signal mask. */
  41. .globl C_SYMBOL_NAME(__sigsetjmp)
  42. C_SYMBOL_NAME(__sigsetjmp):
  43. 1:
  44. /* Save registers relative to r5 (arg0)*/
  45. swi r1, r5, 0 /* stack pointer */
  46. swi r15, r5, 4 /* link register */
  47. swi r2, r5, 8 /* SDA and SDA2 ptrs */
  48. swi r13, r5, 12
  49. swi r18, r5, 16 /* assembler temp */
  50. swi r19, r5, 20 /* now call-preserved regs */
  51. swi r20, r5, 24
  52. swi r21, r5, 28
  53. swi r22, r5, 32
  54. swi r23, r5, 36
  55. swi r24, r5, 40
  56. swi r25, r5, 44
  57. swi r26, r5, 48
  58. swi r27, r5, 52
  59. swi r28, r5, 56
  60. swi r29, r5, 60
  61. swi r30, r5, 64
  62. swi r31, r5, 68
  63. /* Make a tail call to __sigjmp_save; it takes the same args. */
  64. #ifdef __PIC__
  65. mfs r12,rpc
  66. addik r12,r12,_GLOBAL_OFFSET_TABLE_+8
  67. lwi r12,r12,__sigjmp_save@GOT
  68. brad r12
  69. nop
  70. #else
  71. braid C_SYMBOL_NAME(__sigjmp_save)
  72. nop
  73. #endif