head_ram.S 1008 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #include <linux/sys.h>
  2. #include <linux/init.h>
  3. #include <asm/unistd.h>
  4. #include <asm/setup.h>
  5. #include <asm/segment.h>
  6. #include <asm/linkage.h>
  7. #include <asm/asm-offsets.h>
  8. #include <asm/thread_info.h>
  9. #include <asm/errno.h>
  10. #if defined(CONFIG_CPU_H8300H)
  11. .h8300h
  12. #define SYSCR 0xfee012
  13. #define IRAMTOP 0xffff20
  14. #endif
  15. #if defined(CONFIG_CPU_H8S)
  16. .h8300s
  17. #define INTCR 0xffff31
  18. #define IRAMTOP 0xffc000
  19. #endif
  20. __HEAD
  21. .global _start
  22. _start:
  23. mov.l #IRAMTOP,sp
  24. /* .bss clear */
  25. mov.l #_sbss,er5
  26. mov.l #_ebss,er4
  27. sub.l er5,er4
  28. shlr er4
  29. shlr er4
  30. sub.l er2,er2
  31. 1:
  32. mov.l er2,@er5
  33. adds #4,er5
  34. dec.l #1,er4
  35. bne 1b
  36. jsr @h8300_fdt_init
  37. /* linux kernel start */
  38. #if defined(CONFIG_CPU_H8300H)
  39. ldc #0xd0,ccr /* running kernel */
  40. mov.l #SYSCR,er0
  41. bclr #3,@er0
  42. #endif
  43. #if defined(CONFIG_CPU_H8S)
  44. ldc #0x07,exr
  45. bclr #4,@INTCR:8
  46. bset #5,@INTCR:8 /* Interrupt mode 2 */
  47. ldc #0x90,ccr /* running kernel */
  48. #endif
  49. mov.l #init_thread_union,sp
  50. add.l #0x2000,sp
  51. jsr @start_kernel
  52. 1:
  53. bra 1b
  54. .end