setjmp.S 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
  3. * Copright (c) 2017 Lemote Co.
  4. * Author: Heiher <[email protected]>
  5. *
  6. * This program and the accompanying materials are licensed and made
  7. available
  8. * under the terms and conditions of the BSD License which accompanies
  9. this
  10. * distribution. The full text of the license may be found at
  11. * http://opensource.org/licenses/bsd-license.php.
  12. *
  13. * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
  14. BASIS,
  15. * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR
  16. * IMPLIED.
  17. */
  18. .text
  19. .p2align 3
  20. .globl setjmp
  21. .type setjmp, @function
  22. setjmp:
  23. sd $ra, 0x00($a0)
  24. sd $sp, 0x08($a0)
  25. sd $fp, 0x10($a0)
  26. sd $gp, 0x18($a0)
  27. sd $s0, 0x20($a0)
  28. sd $s1, 0x28($a0)
  29. sd $s2, 0x30($a0)
  30. sd $s3, 0x38($a0)
  31. sd $s4, 0x40($a0)
  32. sd $s5, 0x48($a0)
  33. sd $s6, 0x50($a0)
  34. sd $s7, 0x58($a0)
  35. #ifdef __mips_hard_float
  36. mfc0 $v0, $12
  37. ext $v0, $v0, 29, 1
  38. beqz $v0, 1f
  39. s.d $f24, 0x60($a0)
  40. s.d $f25, 0x68($a0)
  41. s.d $f26, 0x70($a0)
  42. s.d $f27, 0x78($a0)
  43. s.d $f28, 0x80($a0)
  44. s.d $f29, 0x88($a0)
  45. s.d $f30, 0x90($a0)
  46. s.d $f31, 0x98($a0)
  47. 1:
  48. #endif
  49. move $v0, $zero
  50. jr $ra
  51. .globl longjmp
  52. .type longjmp, @function
  53. longjmp:
  54. ld $ra, 0x00($a0)
  55. ld $sp, 0x08($a0)
  56. ld $fp, 0x10($a0)
  57. ld $gp, 0x18($a0)
  58. ld $s0, 0x20($a0)
  59. ld $s1, 0x28($a0)
  60. ld $s2, 0x30($a0)
  61. ld $s3, 0x38($a0)
  62. ld $s4, 0x40($a0)
  63. ld $s5, 0x48($a0)
  64. ld $s6, 0x50($a0)
  65. ld $s7, 0x58($a0)
  66. #ifdef __mips_hard_float
  67. mfc0 $v0, $12
  68. ext $v0, $v0, 29, 1
  69. beqz $v0, 1f
  70. l.d $f24, 0x60($a0)
  71. l.d $f25, 0x68($a0)
  72. l.d $f26, 0x70($a0)
  73. l.d $f27, 0x78($a0)
  74. l.d $f28, 0x80($a0)
  75. l.d $f29, 0x88($a0)
  76. l.d $f30, 0x90($a0)
  77. l.d $f31, 0x98($a0)
  78. 1:
  79. #endif
  80. li $v0, 1
  81. movn $v0, $a1, $a1
  82. jr $ra
  83. #if defined(__ELF__) && defined(__linux__)
  84. .section .note.GNU-stack,"",%progbits
  85. #endif