crt0.S 1.0 KB

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