xensetup.S 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. GLOBAL_ENTRY(xen_setup_hook)
  51. mov r8=XEN_PV_DOMAIN_ASM
  52. (isBP) movl r9=xen_domain_type;;
  53. (isBP) st4 [r9]=r8
  54. movl r10=xen_ivt;;
  55. mov cr.iva=r10
  56. /* Set xsi base. */
  57. #define FW_HYPERCALL_SET_SHARED_INFO_VA 0x600
  58. (isBP) mov r2=FW_HYPERCALL_SET_SHARED_INFO_VA
  59. (isBP) movl r28=XSI_BASE;;
  60. (isBP) break 0x1000;;
  61. /* setup pv_ops */
  62. (isBP) mov r4=rp
  63. ;;
  64. (isBP) br.call.sptk.many rp=xen_setup_pv_ops
  65. ;;
  66. (isBP) mov rp=r4
  67. ;;
  68. br.ret.sptk.many rp
  69. ;;
  70. END(xen_setup_hook)