head.S 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Startup glue code to uncompress the kernel
  3. *
  4. * (C) 2017 Helge Deller <[email protected]>
  5. */
  6. #include <linux/init.h>
  7. #include <linux/linkage.h>
  8. #include <asm/asm-offsets.h>
  9. #include <asm/page.h>
  10. #include <asm/psw.h>
  11. #include <asm/pdc.h>
  12. #include <asm/assembly.h>
  13. #include "sizes.h"
  14. #define BOOTADDR(x) (x)
  15. #ifndef CONFIG_64BIT
  16. .import $global$ /* forward declaration */
  17. #endif /*!CONFIG_64BIT*/
  18. __HEAD
  19. ENTRY(startup)
  20. .level PA_ASM_LEVEL
  21. #define PSW_W_SM 0x200
  22. #define PSW_W_BIT 36
  23. ;! nuke the W bit, saving original value
  24. .level 2.0
  25. rsm PSW_W_SM, %r1
  26. .level 1.1
  27. extrw,u %r1, PSW_W_BIT-32, 1, %r1
  28. copy %r1, %arg0
  29. /* Make sure sr4-sr7 are set to zero for the kernel address space */
  30. mtsp %r0,%sr4
  31. mtsp %r0,%sr5
  32. mtsp %r0,%sr6
  33. mtsp %r0,%sr7
  34. /* Clear BSS */
  35. .import _bss,data
  36. .import _ebss,data
  37. load32 BOOTADDR(_bss),%r3
  38. load32 BOOTADDR(_ebss),%r4
  39. ldo FRAME_SIZE(%r4),%sp /* stack at end of bss */
  40. $bss_loop:
  41. cmpb,<<,n %r3,%r4,$bss_loop
  42. stw,ma %r0,4(%r3)
  43. /* Initialize the global data pointer */
  44. loadgp
  45. /* arg0..arg4 were set by palo. */
  46. copy %arg1, %r6 /* command line */
  47. copy %arg2, %r7 /* rd-start */
  48. copy %arg3, %r8 /* rd-end */
  49. load32 BOOTADDR(decompress_kernel),%r3
  50. #ifdef CONFIG_64BIT
  51. .level PA_ASM_LEVEL
  52. ssm PSW_W_SM, %r0 /* set W-bit */
  53. depdi 0, 31, 32, %r3
  54. #endif
  55. load32 BOOTADDR(startup_continue), %r2
  56. bv,n 0(%r3)
  57. startup_continue:
  58. #ifdef CONFIG_64BIT
  59. .level PA_ASM_LEVEL
  60. rsm PSW_W_SM, %r0 /* clear W-bit */
  61. #endif
  62. load32 KERNEL_BINARY_TEXT_START, %arg0 /* free mem */
  63. copy %r6, %arg1 /* command line */
  64. copy %r7, %arg2 /* rd-start */
  65. copy %r8, %arg3 /* rd-end */
  66. bv,n 0(%ret0)
  67. END(startup)