ia64/xen-unstable

view xen/arch/ia64/hypercall.c @ 5454:9947f23ecc75

bitkeeper revision 1.1709.1.6 (42af188067osLjX0T63Zb45JU4Zd2w)

Enable dom_mem_ops on XEN/IA64

Signed-off-by Kevin Tian <Kevin.tian@intel.com>
author djm@kirby.fc.hp.com
date Tue Jun 14 17:48:48 2005 +0000 (2005-06-14)
parents dce7deb4c508
children fbb0e9caca09
line source
1 /*
2 * Hypercall implementations
3 *
4 * Copyright (C) 2005 Hewlett-Packard Co.
5 * Dan Magenheimer (dan.magenheimer@hp.com)
6 *
7 */
9 #include <xen/config.h>
10 #include <xen/sched.h>
12 #include <linux/efi.h> /* FOR EFI_UNIMPLEMENTED */
13 #include <asm/sal.h> /* FOR struct ia64_sal_retval */
15 #include <asm/vcpu.h>
16 #include <asm/dom_fw.h>
18 extern unsigned long translate_domain_mpaddr(unsigned long);
19 extern struct ia64_sal_retval pal_emulator_static(UINT64);
20 extern struct ia64_sal_retval sal_emulator(UINT64,UINT64,UINT64,UINT64,UINT64,UINT64,UINT64,UINT64);
22 int
23 ia64_hypercall (struct pt_regs *regs)
24 {
25 struct vcpu *v = (struct domain *) current;
26 struct ia64_sal_retval x;
27 unsigned long *tv, *tc;
29 switch (regs->r2) {
30 case FW_HYPERCALL_PAL_CALL:
31 //printf("*** PAL hypercall: index=%d\n",regs->r28);
32 //FIXME: This should call a C routine
33 #if 1
34 // This is very conservative, but avoids a possible
35 // (and deadly) freeze in paravirtualized domains due
36 // to a yet-to-be-found bug where pending_interruption
37 // is zero when it shouldn't be. Since PAL is called
38 // in the idle loop, this should resolve it
39 v->vcpu_info->arch.pending_interruption = 1;
40 #endif
41 x = pal_emulator_static(regs->r28);
42 if (regs->r28 == PAL_HALT_LIGHT) {
43 do_sched_op(SCHEDOP_yield);
44 //break;
45 }
46 regs->r8 = x.status; regs->r9 = x.v0;
47 regs->r10 = x.v1; regs->r11 = x.v2;
48 break;
49 case FW_HYPERCALL_SAL_CALL:
50 x = sal_emulator(vcpu_get_gr(v,32),vcpu_get_gr(v,33),
51 vcpu_get_gr(v,34),vcpu_get_gr(v,35),
52 vcpu_get_gr(v,36),vcpu_get_gr(v,37),
53 vcpu_get_gr(v,38),vcpu_get_gr(v,39));
54 regs->r8 = x.status; regs->r9 = x.v0;
55 regs->r10 = x.v1; regs->r11 = x.v2;
56 break;
57 case FW_HYPERCALL_EFI_RESET_SYSTEM:
58 printf("efi.reset_system called ");
59 if (current->domain == dom0) {
60 printf("(by dom0)\n ");
61 (*efi.reset_system)(EFI_RESET_WARM,0,0,NULL);
62 }
63 #ifdef DOMU_AUTO_RESTART
64 else {
65 reconstruct_domU(current);
66 return 0; // don't increment ip!
67 }
68 #else
69 printf("(not supported for non-0 domain)\n");
70 regs->r8 = EFI_UNSUPPORTED;
71 #endif
72 break;
73 case FW_HYPERCALL_EFI_GET_TIME:
74 tv = vcpu_get_gr(v,32);
75 tc = vcpu_get_gr(v,33);
76 //printf("efi_get_time(%p,%p) called...",tv,tc);
77 tv = __va(translate_domain_mpaddr(tv));
78 if (tc) tc = __va(translate_domain_mpaddr(tc));
79 regs->r8 = (*efi.get_time)(tv,tc);
80 //printf("and returns %lx\n",regs->r8);
81 break;
82 case FW_HYPERCALL_EFI_SET_TIME:
83 case FW_HYPERCALL_EFI_GET_WAKEUP_TIME:
84 case FW_HYPERCALL_EFI_SET_WAKEUP_TIME:
85 // FIXME: need fixes in efi.h from 2.6.9
86 case FW_HYPERCALL_EFI_SET_VIRTUAL_ADDRESS_MAP:
87 // FIXME: WARNING!! IF THIS EVER GETS IMPLEMENTED
88 // SOME OF THE OTHER EFI EMULATIONS WILL CHANGE AS
89 // POINTER ARGUMENTS WILL BE VIRTUAL!!
90 case FW_HYPERCALL_EFI_GET_VARIABLE:
91 // FIXME: need fixes in efi.h from 2.6.9
92 case FW_HYPERCALL_EFI_GET_NEXT_VARIABLE:
93 case FW_HYPERCALL_EFI_SET_VARIABLE:
94 case FW_HYPERCALL_EFI_GET_NEXT_HIGH_MONO_COUNT:
95 // FIXME: need fixes in efi.h from 2.6.9
96 regs->r8 = EFI_UNSUPPORTED;
97 break;
98 case 0xffff: // test dummy hypercall
99 regs->r8 = dump_privop_counts_to_user(
100 vcpu_get_gr(v,32),
101 vcpu_get_gr(v,33));
102 break;
103 case 0xfffe: // test dummy hypercall
104 regs->r8 = zero_privop_counts_to_user(
105 vcpu_get_gr(v,32),
106 vcpu_get_gr(v,33));
107 break;
108 case 0xfffd: // test dummy hypercall
109 regs->r8 = launch_domainU(
110 vcpu_get_gr(v,32));
111 break;
112 case 0xfffc: // test dummy hypercall
113 regs->r8 = domU_staging_write_32(
114 vcpu_get_gr(v,32),
115 vcpu_get_gr(v,33),
116 vcpu_get_gr(v,34),
117 vcpu_get_gr(v,35),
118 vcpu_get_gr(v,36));
119 break;
120 case 0xfffb: // test dummy hypercall
121 regs->r8 = domU_staging_read_8(vcpu_get_gr(v,32));
122 break;
124 case __HYPERVISOR_dom0_op:
125 regs->r8 = do_dom0_op(regs->r14);
126 break;
128 case __HYPERVISOR_dom_mem_op:
129 regs->r8 = do_dom_mem_op(regs->r14, regs->r15, regs->r16, regs->r17, regs->r18);
130 regs->r8 = regs->r16;
131 break;
133 case __HYPERVISOR_event_channel_op:
134 regs->r8 = do_event_channel_op(regs->r14);
135 break;
137 case __HYPERVISOR_console_io:
138 regs->r8 = do_console_io(regs->r14, regs->r15, regs->r16);
139 break;
141 default:
142 printf("unknown hypercall %x\n", regs->r2);
143 regs->r8 = (unsigned long)-1;
144 }
145 return 1;
146 }