head-netwinder.S
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:1k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  *  linux/arch/arm/boot/compressed/head-netwinder.S
  3.  *
  4.  *  Copyright (C) 2000 Russell King
  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. #define K(a,b,c) ((a) << 24 | (b) << 12 | (c))
  11. .section ".start", #alloc, #execinstr
  12. /*
  13.  * check to see if we are running from the correct address.
  14.  * If not, we move ourselves in a two stage process.  Firstly,
  15.  * we copy the start of the kernel (which includes this code)
  16.  * to 0x8000, and then jump to this code to continue with the
  17.  * rest (since this code will get overwritten).
  18.  */
  19. adr r2, 1f
  20. ldmdb r2, {r9, r10}
  21. and r3, r2, #0xc000
  22. teq r3, #0x8000 @ correctly located?
  23. beq 2f @ skip this code
  24. bic r3, r2, #0xc000
  25. orr r3, r3, #0x8000
  26. mov r0, r3 @ new address if '1'
  27. mov r4, #64 @ number of bytes to copy
  28. sub r5, r10, r9 @ total number of bytes to copy
  29. b 1f
  30. .word _start
  31. .word __bss_start
  32. 1:
  33. .rept 4
  34. ldmia r2!, {r6, r9, r10, r11}
  35. stmia r3!, {r6, r9, r10, r11}
  36. .endr
  37. subs r4, r4, #64
  38. bcs 1b
  39. movs r4, r5 @ remaining length
  40. mov r5, #0 @ no more to copy
  41. movne pc, r0 @ jump back to 1 (in the newly copied
  42. @ code)
  43. mov r7, #5 @ only here to fix NeTTroms which dont
  44. mov r8, #2 << 24 @ scheduled for removal in 2.5.xx
  45. orr r8, r8, #5 << 12
  46. 2: