head_rom.S 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #include <linux/init.h>
  2. #include <asm/thread_info.h>
  3. #if defined(CONFIG_CPU_H8300H)
  4. .h8300h
  5. #define SYSCR 0xfee012
  6. #define IRAMTOP 0xffff20
  7. #define NR_INT 64
  8. #endif
  9. #if defined(CONFIG_CPU_H8S)
  10. .h8300s
  11. #define INTCR 0xffff31
  12. #define IRAMTOP 0xffc000
  13. #define NR_INT 128
  14. #endif
  15. __HEAD
  16. .global _start
  17. _start:
  18. mov.l #IRAMTOP,sp
  19. #if !defined(CONFIG_H8300H_SIM) && \
  20. !defined(CONFIG_H8S_SIM)
  21. jsr @lowlevel_init
  22. /* copy .data */
  23. mov.l #_begin_data,er5
  24. mov.l #_sdata,er6
  25. mov.l #_edata,er4
  26. sub.l er6,er4
  27. shlr.l er4
  28. shlr.l er4
  29. 1:
  30. mov.l @er5+,er0
  31. mov.l er0,@er6
  32. adds #4,er6
  33. dec.l #1,er4
  34. bne 1b
  35. /* .bss clear */
  36. mov.l #_sbss,er5
  37. mov.l #_ebss,er4
  38. sub.l er5,er4
  39. shlr er4
  40. shlr er4
  41. sub.l er0,er0
  42. 1:
  43. mov.l er0,@er5
  44. adds #4,er5
  45. dec.l #1,er4
  46. bne 1b
  47. #else
  48. /* get cmdline from gdb */
  49. jsr @0xcc
  50. ;; er0 - argc
  51. ;; er1 - argv
  52. mov.l #command_line,er3
  53. adds #4,er1
  54. dec.l #1,er0
  55. beq 4f
  56. 1:
  57. mov.l @er1+,er2
  58. 2:
  59. mov.b @er2+,r4l
  60. beq 3f
  61. mov.b r4l,@er3
  62. adds #1,er3
  63. bra 2b
  64. 3:
  65. mov.b #' ',r4l
  66. mov.b r4l,@er3
  67. adds #1,er3
  68. dec.l #1,er0
  69. bne 1b
  70. subs #1,er3
  71. mov.b #0,r4l
  72. mov.b r4l,@er3
  73. 4:
  74. #endif
  75. sub.l er0,er0
  76. jsr @h8300_fdt_init
  77. /* linux kernel start */
  78. #if defined(CONFIG_CPU_H8300H)
  79. ldc #0xd0,ccr /* running kernel */
  80. mov.l #SYSCR,er0
  81. bclr #3,@er0
  82. #endif
  83. #if defined(CONFIG_CPU_H8S)
  84. ldc #0x07,exr
  85. bclr #4,@INTCR:8
  86. bset #5,@INTCR:8 /* Interrupt mode 2 */
  87. ldc #0x90,ccr /* running kernel */
  88. #endif
  89. mov.l #init_thread_union,sp
  90. add.l #0x2000,sp
  91. jsr @start_kernel
  92. 1:
  93. bra 1b
  94. #if defined(CONFIG_ROMKERNEL)
  95. /* interrupt vector */
  96. .section .vectors,"ax"
  97. .long _start
  98. .long _start
  99. vector = 2
  100. .rept NR_INT - 2
  101. .long _interrupt_redirect_table+vector*4
  102. vector = vector + 1
  103. .endr
  104. #endif
  105. .end