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