head.S 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Startup code for use with the u-boot bootloader.
  3. *
  4. * Copyright (C) 2004-2006 Atmel Corporation
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #include <asm/setup.h>
  11. /*
  12. * The kernel is loaded where we want it to be and all caches
  13. * have just been flushed. We get two parameters from u-boot:
  14. *
  15. * r12 contains a magic number (ATAG_MAGIC)
  16. * r11 points to a tag table providing information about
  17. * the system.
  18. */
  19. .section .init.text,"ax"
  20. .global _start
  21. _start:
  22. /* Check if the boot loader actually provided a tag table */
  23. lddpc r0, magic_number
  24. cp.w r12, r0
  25. brne no_tag_table
  26. /* Initialize .bss */
  27. lddpc r2, bss_start_addr
  28. lddpc r3, end_addr
  29. mov r0, 0
  30. mov r1, 0
  31. 1: st.d r2++, r0
  32. cp r2, r3
  33. brlo 1b
  34. /*
  35. * Save the tag table address for later use. This must be done
  36. * _after_ .bss has been initialized...
  37. */
  38. lddpc r0, tag_table_addr
  39. st.w r0[0], r11
  40. /* Jump to loader-independent setup code */
  41. rjmp kernel_entry
  42. .align 2
  43. magic_number:
  44. .long ATAG_MAGIC
  45. tag_table_addr:
  46. .long bootloader_tags
  47. bss_start_addr:
  48. .long __bss_start
  49. end_addr:
  50. .long _end
  51. no_tag_table:
  52. sub r12, pc, (. - 2f)
  53. bral panic
  54. 2: .asciz "Boot loader didn't provide correct magic number\n"