xensetup.S 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Support routines for Xen
  3. *
  4. * Copyright (C) 2005 Dan Magenheimer <dan.magenheimer@hp.com>
  5. */
  6. #include <asm/processor.h>
  7. #include <asm/asmmacro.h>
  8. #include <asm/pgtable.h>
  9. #include <asm/system.h>
  10. #include <asm/paravirt.h>
  11. #include <asm/xen/privop.h>
  12. #include <linux/elfnote.h>
  13. #include <linux/init.h>
  14. #include <xen/interface/elfnote.h>
  15. .section .data.read_mostly
  16. .align 8
  17. .global xen_domain_type
  18. xen_domain_type:
  19. data4 XEN_NATIVE_ASM
  20. .previous
  21. __INIT
  22. ENTRY(startup_xen)
  23. // Calculate load offset.
  24. // The constant, LOAD_OFFSET, can't be used because the boot
  25. // loader doesn't always load to the LMA specified by the vmlinux.lds.
  26. mov r9=ip // must be the first instruction to make sure
  27. // that r9 = the physical address of startup_xen.
  28. // Usually r9 = startup_xen - LOAD_OFFSET
  29. movl r8=startup_xen
  30. ;;
  31. sub r9=r9,r8 // Usually r9 = -LOAD_OFFSET.
  32. mov r10=PARAVIRT_HYPERVISOR_TYPE_XEN
  33. movl r11=_start
  34. ;;
  35. add r11=r11,r9
  36. movl r8=hypervisor_type
  37. ;;
  38. add r8=r8,r9
  39. mov b0=r11
  40. ;;
  41. st8 [r8]=r10
  42. br.cond.sptk.many b0
  43. ;;
  44. END(startup_xen)
  45. ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz "linux")
  46. ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz "2.6")
  47. ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz "xen-3.0")
  48. ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, data8.ua startup_xen - LOAD_OFFSET)
  49. #define isBP p3 // are we the Bootstrap Processor?
  50. .text
  51. GLOBAL_ENTRY(xen_setup_hook)
  52. mov r8=XEN_PV_DOMAIN_ASM
  53. (isBP) movl r9=xen_domain_type;;
  54. (isBP) st4 [r9]=r8
  55. movl r10=xen_ivt;;
  56. mov cr.iva=r10
  57. /* Set xsi base. */
  58. #define FW_HYPERCALL_SET_SHARED_INFO_VA 0x600
  59. (isBP) mov r2=FW_HYPERCALL_SET_SHARED_INFO_VA
  60. (isBP) movl r28=XSI_BASE;;
  61. (isBP) break 0x1000;;
  62. /* setup pv_ops */
  63. (isBP) mov r4=rp
  64. ;;
  65. (isBP) br.call.sptk.many rp=xen_setup_pv_ops
  66. ;;
  67. (isBP) mov rp=r4
  68. ;;
  69. br.ret.sptk.many rp
  70. ;;
  71. END(xen_setup_hook)