__longjmp.S 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* longjmp for or1k
  2. Based on:
  3. longjmp for PowerPC.
  4. Copyright (C) 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
  5. This file is part of the GNU C Library.
  6. The GNU C Library is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU Lesser General Public
  8. License as published by the Free Software Foundation; either
  9. version 2.1 of the License, or (at your option) any later version.
  10. The GNU C Library 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 GNU
  13. Lesser General Public License for more details.
  14. You should have received a copy of the GNU Lesser General Public
  15. License along with the GNU C Library; if not, write to the Free
  16. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  17. 02111-1307 USA. */
  18. #include <jmpbuf-offsets.h>
  19. #ifdef __UCLIBC_HAS_FLOATS__
  20. #define FP(x...) x
  21. #else
  22. #define FP(x...)
  23. #endif
  24. .globl __longjmp;
  25. .type __longjmp,@function;
  26. .align 2;
  27. __longjmp:
  28. # l.lwz r11,(JB_SR*4)(r3)
  29. # l.mtspr r0,r11,SPR_SR
  30. l.lwz r1,((JB_GPRS+0)*4)(r3)
  31. l.lwz r2,((JB_GPRS+1)*4)(r3)
  32. /* pass through "value" to r11, then restore r4, for what it's worth" */
  33. #if 1
  34. /* if r4 is 0, something wrong, so set it to 1 */
  35. l.sfeqi r4, 0x0
  36. l.bnf 1f /* r4 != 0, longjmp value sensible */
  37. l.nop
  38. l.ori r4, r0, 0x1 /* make nonzero */
  39. 1:
  40. #endif
  41. l.addi r11, r4, 0
  42. l.lwz r4,((JB_GPRS+3)*4)(r3)
  43. l.lwz r5,((JB_GPRS+4)*4)(r3)
  44. l.lwz r6,((JB_GPRS+5)*4)(r3)
  45. l.lwz r7,((JB_GPRS+6)*4)(r3)
  46. l.lwz r8,((JB_GPRS+7)*4)(r3)
  47. l.lwz r9,((JB_GPRS+8)*4)(r3)
  48. l.lwz r10,((JB_GPRS+9)*4)(r3)
  49. l.lwz r12,((JB_GPRS+11)*4)(r3)
  50. l.lwz r13,((JB_GPRS+12)*4)(r3)
  51. l.lwz r14,((JB_GPRS+13)*4)(r3)
  52. l.lwz r15,((JB_GPRS+14)*4)(r3)
  53. l.lwz r16,((JB_GPRS+15)*4)(r3)
  54. l.lwz r17,((JB_GPRS+16)*4)(r3)
  55. l.lwz r18,((JB_GPRS+17)*4)(r3)
  56. l.lwz r19,((JB_GPRS+18)*4)(r3)
  57. l.lwz r20,((JB_GPRS+19)*4)(r3)
  58. l.lwz r21,((JB_GPRS+20)*4)(r3)
  59. l.lwz r22,((JB_GPRS+21)*4)(r3)
  60. l.lwz r23,((JB_GPRS+22)*4)(r3)
  61. l.lwz r24,((JB_GPRS+23)*4)(r3)
  62. l.lwz r25,((JB_GPRS+24)*4)(r3)
  63. l.lwz r26,((JB_GPRS+25)*4)(r3)
  64. l.lwz r27,((JB_GPRS+26)*4)(r3)
  65. l.lwz r28,((JB_GPRS+27)*4)(r3)
  66. l.lwz r29,((JB_GPRS+28)*4)(r3)
  67. l.lwz r30,((JB_GPRS+29)*4)(r3)
  68. l.lwz r31,((JB_GPRS+30)*4)(r3)
  69. l.jr r9
  70. l.nop
  71. .size __longjmp,.-__longjmp
  72. libc_hidden_def(__longjmp)