crt1.S 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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, write to the Free Software Foundation,
  19. ; Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. ;
  21. .text
  22. ;; On entry, the dynamic linker
  23. ;;
  24. ;; 0(sp) pad0
  25. ;; 4(sp) pad1
  26. ;; 8(sp) argc
  27. ;; 12(sp) argv[0]
  28. ;; ...
  29. ;; (4*(argc+3))(sp) NULL
  30. ;; (4*(argc+4))(sp) envp[0]
  31. ;; ...
  32. ;; NULL
  33. ;; Register values are unspecified, except:
  34. ;;
  35. ;; A4 --> pointer to rtld fini rountine
  36. ;; B14 --> pointer to application DSBT table
  37. .global _start
  38. _start:
  39. .global _c_int00
  40. _c_int00:
  41. ;; Things to do:
  42. ;;
  43. ;; * call __uClibc_main(
  44. ;; int (*main)(int, char **, char **), A4
  45. ;; int argc, B4
  46. ;; char **argv, A6
  47. ;; void (*app_init)(void), B6
  48. ;; void (*app_fini)(void), A8
  49. ;; void (*rtld_fini)(void), B8
  50. ;; void *stack_end) A10
  51. MV .D2X A4,B8 ; rtld_fini
  52. LDW .D2T1 *+B14($GOT(main)), A4
  53. LDW .D2T2 *+B14($GOT(_init)), B6
  54. B .S2 __uClibc_main
  55. || LDW .D2T1 *+B14($GOT(_fini)), A8
  56. LDW .D2T2 *+B15(8),B4 ; argc
  57. ADDAW .D1X B15,3,A6 ; **argv
  58. MV .D1X B15,A10 ; stack_end
  59. || ZERO .L1 A15 ; clear FP
  60. NOP 2