crt1.S 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. ;
  2. ; Port of uClibc for TMS320C6000 DSP architecture
  3. ;
  4. ; Copyright (C) 2010 Texas Instruments Incorporated
  5. ; Mark Salter <msalter@redhat.com>
  6. ;
  7. ; This program is free software; you can redistribute it and/or modify it
  8. ; under the terms of the GNU Library General Public License as published by
  9. ; the Free Software Foundation; either version 2 of the License, or (at your
  10. ; option) any later version.
  11. ;
  12. ; This program is distributed in the hope that it will be useful, but WITHOUT
  13. ; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. ; FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
  15. ; for more details.
  16. ;
  17. ; You should have received a copy of the GNU Library General Public License
  18. ; along with this program; if not, see <http://www.gnu.org/licenses/>.
  19. ;
  20. .text
  21. ;; On entry, the dynamic linker
  22. ;;
  23. ;; 0(sp) pad0
  24. ;; 4(sp) pad1
  25. ;; 8(sp) argc
  26. ;; 12(sp) argv[0]
  27. ;; ...
  28. ;; (4*(argc+3))(sp) NULL
  29. ;; (4*(argc+4))(sp) envp[0]
  30. ;; ...
  31. ;; NULL
  32. ;; Register values are unspecified, except:
  33. ;;
  34. ;; A4 --> pointer to rtld fini rountine
  35. ;; B14 --> pointer to application DSBT table
  36. .global _start
  37. _start:
  38. .global _c_int00
  39. _c_int00:
  40. ;; Things to do:
  41. ;;
  42. ;; * call __uClibc_main(
  43. ;; int (*main)(int, char **, char **), A4
  44. ;; int argc, B4
  45. ;; char **argv, A6
  46. ;; void (*app_init)(void), B6
  47. ;; void (*app_fini)(void), A8
  48. ;; void (*rtld_fini)(void), B8
  49. ;; void *stack_end) A10
  50. MV .D2X A4,B8 ; rtld_fini
  51. LDW .D2T1 *+B14($GOT(main)), A4
  52. LDW .D2T2 *+B14($GOT(_init)), B6
  53. B .S2 __uClibc_main
  54. || LDW .D2T1 *+B14($GOT(_fini)), A8
  55. LDW .D2T2 *+B15(8),B4 ; argc
  56. ADDAW .D1X B15,3,A6 ; **argv
  57. MV .D1X B15,A10 ; stack_end
  58. || ZERO .L1 A15 ; clear FP
  59. NOP 2