setjmp.S 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * GRUB -- GRand Unified Bootloader
  3. * Copyright (C) 2005,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. .file "setjmp.S"
  21. GRUB_MOD_LICENSE "GPLv3+"
  22. .text
  23. /*
  24. * int grub_setjmp (grub_jmp_buf env)
  25. */
  26. FUNCTION(grub_setjmp)
  27. stx %o7, [%o0 + 0x00]
  28. stx %sp, [%o0 + 0x08]
  29. stx %fp, [%o0 + 0x10]
  30. retl
  31. clr %o0
  32. /*
  33. * int grub_longjmp (grub_jmp_buf env, int val)
  34. */
  35. FUNCTION(grub_longjmp)
  36. ldx [%o0 + 0x10], %g1
  37. movrz %o1, 1, %o1
  38. save %sp, -64, %sp
  39. flushw
  40. restore
  41. ldx [%o0 + 0x00], %o7
  42. ldx [%o0 + 0x08], %fp
  43. sub %fp, 192, %sp
  44. stx %g1, [%sp + 2047 + (14 * 8)]
  45. retl
  46. restore %o1, 0, %o0