crt0.S 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2007 Semihalf
  4. *
  5. * Written by: Rafal Jaworowski <raj@semihalf.com>
  6. */
  7. #if defined(CONFIG_PPC)
  8. .text
  9. .globl _start
  10. _start:
  11. lis %r11, search_hint@ha
  12. addi %r11, %r11, search_hint@l
  13. stw %r1, 0(%r11)
  14. b main
  15. .globl syscall
  16. syscall:
  17. lis %r11, syscall_ptr@ha
  18. addi %r11, %r11, syscall_ptr@l
  19. lwz %r11, 0(%r11)
  20. mtctr %r11
  21. bctr
  22. #elif defined(CONFIG_ARM)
  23. .text
  24. .globl _start
  25. _start:
  26. ldr ip, =search_hint
  27. str sp, [ip]
  28. b main
  29. .globl syscall
  30. syscall:
  31. ldr ip, =syscall_ptr
  32. ldr pc, [ip]
  33. #elif defined(CONFIG_MIPS)
  34. #include <asm/asm.h>
  35. .text
  36. .globl __start
  37. .ent __start
  38. __start:
  39. PTR_S $sp, search_hint
  40. b main
  41. .end __start
  42. .globl syscall
  43. .ent syscall
  44. syscall:
  45. PTR_S $ra, return_addr
  46. PTR_L $t9, syscall_ptr
  47. jalr $t9
  48. nop
  49. PTR_L $ra, return_addr
  50. jr $ra
  51. nop
  52. .end syscall
  53. return_addr:
  54. .align 8
  55. .long 0
  56. #else
  57. #error No support for this arch!
  58. #endif
  59. .globl syscall_ptr
  60. syscall_ptr:
  61. .align 8
  62. .long 0
  63. .globl search_hint
  64. search_hint:
  65. .long 0