head.S 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * arch/score/kernel/head.S
  3. *
  4. * Score Processor version.
  5. *
  6. * Copyright (C) 2009 Sunplus Core Technology Co., Ltd.
  7. * Chen Liqin <liqin.chen@sunplusct.com>
  8. * Lennox Wu <lennox.wu@sunplusct.com>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, see the file COPYING, or write
  22. * to the Free Software Foundation, Inc.,
  23. * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  24. */
  25. #include <linux/init.h>
  26. #include <linux/linkage.h>
  27. #include <asm/asm-offsets.h>
  28. .extern start_kernel
  29. .global init_thread_union
  30. .global kernelsp
  31. __INIT
  32. ENTRY(_stext)
  33. la r30, __bss_start /* initialize BSS segment. */
  34. la r31, _end
  35. xor r8, r8, r8
  36. 1: cmp.c r31, r30
  37. beq 2f
  38. sw r8, [r30] /* clean memory. */
  39. addi r30, 4
  40. b 1b
  41. 2: la r28, init_thread_union /* set kernel stack. */
  42. mv r0, r28
  43. addi r0, KERNEL_STACK_SIZE - 32
  44. la r30, kernelsp
  45. sw r0, [r30]
  46. subi r0, 4*4
  47. xor r30, r30, r30
  48. ori r30, 0x02 /* enable MMU. */
  49. mtcr r30, cr4
  50. nop
  51. nop
  52. nop
  53. nop
  54. nop
  55. nop
  56. nop
  57. /* there is no parameter */
  58. xor r4, r4, r4
  59. xor r5, r5, r5
  60. xor r6, r6, r6
  61. xor r7, r7, r7
  62. la r30, start_kernel /* jump to init_arch */
  63. br r30