head.S 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * linux/arch/arm26/kernel/head.S
  3. *
  4. * Copyright (C) 1994-2000 Russell King
  5. * Copyright (C) 2003 Ian Molton
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. *
  11. * 26-bit kernel startup code
  12. */
  13. #include <linux/linkage.h>
  14. #include <asm/mach-types.h>
  15. .globl swapper_pg_dir
  16. .equ swapper_pg_dir, 0x0207d000
  17. /*
  18. * Entry point.
  19. */
  20. .section ".init.text",#alloc,#execinstr
  21. ENTRY(stext)
  22. __entry:
  23. cmp pc, #0x02000000
  24. ldrlt pc, LC0 @ if 0x01800000, call at 0x02080000
  25. teq r0, #0 @ Check for old calling method
  26. blne oldparams @ Move page if old
  27. adr r0, LC0
  28. ldmib r0, {r2-r5, sp} @ Setup stack (and fetch other values)
  29. mov r0, #0 @ Clear BSS
  30. 1: cmp r2, r3
  31. strcc r0, [r2], #4
  32. bcc 1b
  33. bl detect_proc_type
  34. str r0, [r4]
  35. bl detect_arch_type
  36. str r0, [r5]
  37. #ifdef CONFIG_XIP_KERNEL
  38. ldr r3, ETEXT @ data section copy
  39. ldr r4, SDATA
  40. ldr r5, EDATA
  41. 1:
  42. ldr r6, [r3], #4
  43. str r6, [r4], #4
  44. cmp r4, r5
  45. blt 1b
  46. #endif
  47. mov fp, #0
  48. b start_kernel
  49. LC0: .word _stext
  50. .word __bss_start @ r2
  51. .word _end @ r3
  52. .word processor_id @ r4
  53. .word __machine_arch_type @ r5
  54. .word init_thread_union+8192 @ sp
  55. #ifdef CONFIG_XIP_KERNEL
  56. ETEXT: .word _endtext
  57. SDATA: .word _sdata
  58. EDATA: .word __bss_start
  59. #endif
  60. arm2_id: .long 0x41560200 @ ARM2 and 250 dont have a CPUID
  61. arm250_id: .long 0x41560250 @ So we create some after probing for them
  62. .align
  63. oldparams: mov r4, #0x02000000
  64. add r3, r4, #0x00080000
  65. add r4, r4, #0x0007c000
  66. 1: ldmia r0!, {r5 - r12}
  67. stmia r4!, {r5 - r12}
  68. cmp r4, r3
  69. blt 1b
  70. mov pc, lr
  71. /*
  72. * We need some way to automatically detect the difference between
  73. * these two machines. Unfortunately, it is not possible to detect
  74. * the presence of the SuperIO chip, because that will hang the old
  75. * Archimedes machines solid.
  76. */
  77. /* DAG: Outdated, these have been combined !!!!!!! */
  78. detect_arch_type:
  79. #if defined(CONFIG_ARCH_ARC)
  80. mov r0, #MACH_TYPE_ARCHIMEDES
  81. #elif defined(CONFIG_ARCH_A5K)
  82. mov r0, #MACH_TYPE_A5K
  83. #endif
  84. mov pc, lr
  85. detect_proc_type:
  86. mov ip, lr
  87. mov r2, #0xea000000 @ Point undef instr to continuation
  88. adr r0, continue - 12
  89. orr r0, r2, r0, lsr #2
  90. mov r1, #0
  91. str r0, [r1, #4]
  92. ldr r0, arm2_id
  93. swp r2, r2, [r1] @ check for swp (ARM2 cant)
  94. ldr r0, arm250_id
  95. mrc 15, 0, r3, c0, c0 @ check for CP#15 (ARM250 cant)
  96. mov r0, r3
  97. continue: mov r2, #0xeb000000 @ Make undef vector loop
  98. sub r2, r2, #2
  99. str r2, [r1, #4]
  100. mov pc, ip