setjmp.S 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * GRUB -- GRand Unified Bootloader
  3. * Copyright (C) 2003,2007,2009 Free Software Foundation, Inc.
  4. *
  5. * GRUB is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * GRUB 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
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #include <grub/symbol.h>
  19. #include <grub/dl.h>
  20. #include <grub/mips/asm.h>
  21. .file "setjmp.S"
  22. GRUB_MOD_LICENSE "GPLv3+"
  23. .text
  24. /*
  25. * int grub_setjmp (grub_jmp_buf env)
  26. */
  27. FUNCTION(grub_setjmp)
  28. GRUB_ASM_REG_S $s0, 0($a0)
  29. GRUB_ASM_REG_S $s1, 8($a0)
  30. GRUB_ASM_REG_S $s2, 16($a0)
  31. GRUB_ASM_REG_S $s3, 24($a0)
  32. GRUB_ASM_REG_S $s4, 32($a0)
  33. GRUB_ASM_REG_S $s5, 40($a0)
  34. GRUB_ASM_REG_S $s6, 48($a0)
  35. GRUB_ASM_REG_S $s7, 56($a0)
  36. GRUB_ASM_REG_S $s8, 64($a0)
  37. GRUB_ASM_REG_S $gp, 72($a0)
  38. GRUB_ASM_REG_S $sp, 80($a0)
  39. GRUB_ASM_REG_S $ra, 88($a0)
  40. move $v0, $zero
  41. move $v1, $zero
  42. jr $ra
  43. nop
  44. /*
  45. * int grub_longjmp (grub_jmp_buf env, int val)
  46. */
  47. FUNCTION(grub_longjmp)
  48. GRUB_ASM_REG_L $s0, 0($a0)
  49. GRUB_ASM_REG_L $s1, 8($a0)
  50. GRUB_ASM_REG_L $s2, 16($a0)
  51. GRUB_ASM_REG_L $s3, 24($a0)
  52. GRUB_ASM_REG_L $s4, 32($a0)
  53. GRUB_ASM_REG_L $s5, 40($a0)
  54. GRUB_ASM_REG_L $s6, 48($a0)
  55. GRUB_ASM_REG_L $s7, 56($a0)
  56. GRUB_ASM_REG_L $s8, 64($a0)
  57. GRUB_ASM_REG_L $gp, 72($a0)
  58. GRUB_ASM_REG_L $sp, 80($a0)
  59. GRUB_ASM_REG_L $ra, 88($a0)
  60. move $v0, $a1
  61. bne $v0, $zero, 1f
  62. addiu $v0, $v0, 1
  63. 1:
  64. move $v1, $zero
  65. jr $ra
  66. nop