head.S 2.7 KB

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