setjmp.S 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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, write to the Free
  26. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  27. 02111-1307 USA. */
  28. #include <libc-symbols.h>
  29. .text
  30. .globl C_SYMBOL_NAME(setjmp)
  31. .align 4
  32. C_SYMBOL_NAME(setjmp):
  33. #ifdef __PIC__
  34. brid 1f
  35. #else
  36. braid C_SYMBOL_NAME(__sigsetjmp)
  37. #endif
  38. addi r6, r0, 1 /* Save the signal mask. */
  39. .globl C_SYMBOL_NAME(_setjmp)
  40. C_SYMBOL_NAME(_setjmp):
  41. and r6, r0, r0 /* Don't save the signal mask. */
  42. .globl C_SYMBOL_NAME(__sigsetjmp)
  43. C_SYMBOL_NAME(__sigsetjmp):
  44. 1:
  45. /* Save registers relative to r5 (arg0)*/
  46. swi r1, r5, 0 /* stack pointer */
  47. swi r15, r5, 4 /* link register */
  48. swi r2, r5, 8 /* SDA and SDA2 ptrs */
  49. swi r13, r5, 12
  50. swi r18, r5, 16 /* assembler temp */
  51. swi r19, r5, 20 /* now call-preserved regs */
  52. swi r20, r5, 24
  53. swi r21, r5, 28
  54. swi r22, r5, 32
  55. swi r23, r5, 36
  56. swi r24, r5, 40
  57. swi r25, r5, 44
  58. swi r26, r5, 48
  59. swi r27, r5, 52
  60. swi r28, r5, 56
  61. swi r29, r5, 60
  62. swi r30, r5, 64
  63. swi r31, r5, 68
  64. /* Make a tail call to __sigjmp_save; it takes the same args. */
  65. #ifdef __PIC__
  66. mfs r12,rpc
  67. addik r12,r12,_GLOBAL_OFFSET_TABLE_+8
  68. lwi r12,r12,__sigjmp_save@GOT
  69. brad r12
  70. nop
  71. #else
  72. braid C_SYMBOL_NAME(__sigjmp_save)
  73. nop
  74. #endif