debuggers.hg

view xen/arch/ia64/hypercall.c @ 4619:5b9e241131fb

bitkeeper revision 1.1329 (42661815u5WPq8d5f4_axi2xWheybA)

Merge firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-unstable.bk
into firebug.cl.cam.ac.uk:/local/scratch/kaf24/xeno-unstable-ia64.bk
author kaf24@firebug.cl.cam.ac.uk
date Wed Apr 20 08:51:33 2005 +0000 (2005-04-20)
parents 445b12a7221a 58efb3448933
children ba75d06d25c5 79b7835ac75d
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 void fooefi(void) {}
24 int
25 ia64_hypercall (struct pt_regs *regs)
26 {
27 struct exec_domain *ed = (struct domain *) current;
28 struct ia64_sal_retval x;
29 unsigned long *tv, *tc;
31 switch (regs->r2) {
32 case FW_HYPERCALL_PAL_CALL:
33 //printf("*** PAL hypercall: index=%d\n",regs->r28);
34 //FIXME: This should call a C routine
35 x = pal_emulator_static(regs->r28);
36 regs->r8 = x.status; regs->r9 = x.v0;
37 regs->r10 = x.v1; regs->r11 = x.v2;
38 break;
39 case FW_HYPERCALL_SAL_CALL:
40 x = sal_emulator(vcpu_get_gr(ed,32),vcpu_get_gr(ed,33),
41 vcpu_get_gr(ed,34),vcpu_get_gr(ed,35),
42 vcpu_get_gr(ed,36),vcpu_get_gr(ed,37),
43 vcpu_get_gr(ed,38),vcpu_get_gr(ed,39));
44 regs->r8 = x.status; regs->r9 = x.v0;
45 regs->r10 = x.v1; regs->r11 = x.v2;
46 break;
47 case FW_HYPERCALL_EFI_RESET_SYSTEM:
48 printf("efi.reset_system called ");
49 if (current->domain == dom0) {
50 printf("(by dom0)\n ");
51 (*efi.reset_system)(EFI_RESET_WARM,0,0,NULL);
52 }
53 #ifdef DOMU_AUTO_RESTART
54 else {
55 reconstruct_domU(current);
56 return 0; // don't increment ip!
57 }
58 #else
59 printf("(not supported for non-0 domain)\n");
60 regs->r8 = EFI_UNSUPPORTED;
61 #endif
62 break;
63 case FW_HYPERCALL_EFI_GET_TIME:
64 fooefi();
65 tv = vcpu_get_gr(ed,32);
66 tc = vcpu_get_gr(ed,33);
67 //printf("efi_get_time(%p,%p) called...",tv,tc);
68 tv = __va(translate_domain_mpaddr(tv));
69 if (tc) tc = __va(translate_domain_mpaddr(tc));
70 regs->r8 = (*efi.get_time)(tv,tc);
71 //printf("and returns %lx\n",regs->r8);
72 break;
73 case FW_HYPERCALL_EFI_SET_TIME:
74 case FW_HYPERCALL_EFI_GET_WAKEUP_TIME:
75 case FW_HYPERCALL_EFI_SET_WAKEUP_TIME:
76 // FIXME: need fixes in efi.h from 2.6.9
77 case FW_HYPERCALL_EFI_SET_VIRTUAL_ADDRESS_MAP:
78 // FIXME: WARNING!! IF THIS EVER GETS IMPLEMENTED
79 // SOME OF THE OTHER EFI EMULATIONS WILL CHANGE AS
80 // POINTER ARGUMENTS WILL BE VIRTUAL!!
81 case FW_HYPERCALL_EFI_GET_VARIABLE:
82 // FIXME: need fixes in efi.h from 2.6.9
83 case FW_HYPERCALL_EFI_GET_NEXT_VARIABLE:
84 case FW_HYPERCALL_EFI_SET_VARIABLE:
85 case FW_HYPERCALL_EFI_GET_NEXT_HIGH_MONO_COUNT:
86 // FIXME: need fixes in efi.h from 2.6.9
87 regs->r8 = EFI_UNSUPPORTED;
88 break;
89 case 0xffff: // test dummy hypercall
90 regs->r8 = dump_privop_counts_to_user(
91 vcpu_get_gr(ed,32),
92 vcpu_get_gr(ed,33));
93 break;
94 case 0xfffe: // test dummy hypercall
95 regs->r8 = zero_privop_counts_to_user(
96 vcpu_get_gr(ed,32),
97 vcpu_get_gr(ed,33));
98 break;
99 case 0xfffd: // test dummy hypercall
100 regs->r8 = launch_domainU(
101 vcpu_get_gr(ed,32));
102 break;
103 case 0xfffc: // test dummy hypercall
104 regs->r8 = domU_staging_write_32(
105 vcpu_get_gr(ed,32),
106 vcpu_get_gr(ed,33),
107 vcpu_get_gr(ed,34),
108 vcpu_get_gr(ed,35),
109 vcpu_get_gr(ed,36));
110 break;
111 case 0xfffb: // test dummy hypercall
112 regs->r8 = domU_staging_read_8(vcpu_get_gr(ed,32));
113 break;
114 }
115 return 1;
116 }