setjmp.S 2.4 KB

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