crtn.S 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /* Copyright (C) 2001-2022 Free Software Foundation, Inc.
  2. Contributed by Hans-Peter Nilsson <hp@bitrange.com>
  3. This file is free software; you can redistribute it and/or modify it
  4. under the terms of the GNU General Public License as published by the
  5. Free Software Foundation; either version 3, or (at your option) any
  6. later version.
  7. This file is distributed in the hope that it will be useful, but
  8. WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. General Public License for more details.
  11. Under Section 7 of GPL version 3, you are granted additional
  12. permissions described in the GCC Runtime Library Exception, version
  13. 3.1, as published by the Free Software Foundation.
  14. You should have received a copy of the GNU General Public License and
  15. a copy of the GCC Runtime Library Exception along with this program;
  16. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  17. <http://www.gnu.org/licenses/>. */
  18. % This must be the last file on the link-line, allocating global registers
  19. % from the top.
  20. % Register $254 is the stack-pointer.
  21. sp GREG
  22. % Register $253 is frame-pointer. It's not supposed to be used in most
  23. % functions.
  24. fp GREG
  25. % $252 is the static chain register; nested functions receive the
  26. % context of the surrounding function through a pointer passed in this
  27. % register.
  28. static_chain GREG
  29. struct_value_reg GREG
  30. % These registers are used to pass state at an exceptional return (C++).
  31. eh_state_3 GREG
  32. eh_state_2 GREG
  33. eh_state_1 GREG
  34. eh_state_0 GREG
  35. #ifdef __MMIX_ABI_GNU__
  36. % Allocate global registers used by the GNU ABI.
  37. gnu_parm_reg_16 GREG
  38. gnu_parm_reg_15 GREG
  39. gnu_parm_reg_14 GREG
  40. gnu_parm_reg_13 GREG
  41. gnu_parm_reg_12 GREG
  42. gnu_parm_reg_11 GREG
  43. gnu_parm_reg_10 GREG
  44. gnu_parm_reg_9 GREG
  45. gnu_parm_reg_8 GREG
  46. gnu_parm_reg_7 GREG
  47. gnu_parm_reg_6 GREG
  48. gnu_parm_reg_5 GREG
  49. gnu_parm_reg_4 GREG
  50. gnu_parm_reg_3 GREG
  51. gnu_parm_reg_2 GREG
  52. gnu_parm_reg_1 GREG
  53. #endif /* __MMIX_ABI_GNU__ */
  54. % Provide last part of _init and _fini.
  55. % The return address is stored in the topmost stored register in the
  56. % register-stack. We ignore the current value in rJ. It is probably
  57. % garbage because each fragment of _init and _fini may have their own idea
  58. % of the current stack frame, if they're cut out from a "real" function
  59. % like in gcc/crtstuff.c.
  60. .section .init,"ax",@progbits
  61. GETA $255,0F
  62. PUT rJ,$255
  63. POP 0,0
  64. 0H PUT rJ,$0
  65. POP 0,0
  66. .section .fini,"ax",@progbits
  67. GETA $255,0F
  68. PUT rJ,$255
  69. POP 0,0
  70. 0H PUT rJ,$0
  71. POP 0,0