ia64/xen-unstable

view tools/libxc/ia64/xc_ia64_stubs.c @ 11296:86d26e6ec89b

Replace dom0_ops hypercall with three new hypercalls:
1. platform_op -- used by dom0 kernel to perform actions on the
hardware platform (e.g., MTRR access, microcode update, platform
quirks, ...)
2. domctl -- used by management tools to control a specified domain
3. sysctl -- used by management tools for system-wide actions

Benefits include more sensible factoring of actions to
hypercalls. Also allows tool compatibility to be tracked separately
from the dom0 kernel. The assumption is that it will be easier to
replace libxenctrl, libxenguest and Xen as a matched set if the
dom0 kernel does not need to be replaced too (e.g., because that
would require vendor revalidation).

From here on we hope to maintain dom0 kernel compatibility. This
promise is not extended to tool compatibility beyond the existing
guarantee that compatibility will not be broken within a three-level
stable release [3.0.2, 3.0.3, etc.].

Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Fri Aug 25 18:39:10 2006 +0100 (2006-08-25)
parents 306d7857928c
children d741e86a8766
line source
1 #include "xg_private.h"
2 #include "xenguest.h"
3 #include "xc_private.h"
4 #include "xc_elf.h"
5 #include <stdlib.h>
6 #include <zlib.h>
7 #include "xen/arch-ia64.h"
8 #include <xen/hvm/ioreq.h>
10 /* this is a very ugly way of getting FPSR_DEFAULT. struct ia64_fpreg is
11 * mysteriously declared in two places: /usr/include/asm/fpu.h and
12 * /usr/include/bits/sigcontext.h. The former also defines FPSR_DEFAULT,
13 * the latter doesn't but is included (indirectly) by xg_private.h */
14 #define __ASSEMBLY__
15 #include <asm/fpu.h>
16 #undef __IA64_UL
17 #define __IA64_UL(x) ((unsigned long)(x))
18 #undef __ASSEMBLY__
20 unsigned long
21 xc_ia64_fpsr_default(void)
22 {
23 return FPSR_DEFAULT;
24 }
26 /*
27 VMM uses put_user to copy pfn_list to guest buffer, this maybe fail,
28 VMM doesn't handle this now.
29 This method will touch guest buffer to make sure the buffer's mapping
30 is tracked by VMM,
31 */
32 int
33 xc_ia64_get_pfn_list(int xc_handle, uint32_t domid, xen_pfn_t *pfn_buf,
34 unsigned int start_page, unsigned int nr_pages)
35 {
36 struct xen_domctl domctl;
37 int num_pfns,ret;
38 unsigned int __start_page, __nr_pages;
39 unsigned long max_pfns;
40 xen_pfn_t *__pfn_buf;
42 __start_page = start_page;
43 __nr_pages = nr_pages;
44 __pfn_buf = pfn_buf;
46 while (__nr_pages) {
47 max_pfns = ((unsigned long)__start_page << 32) | __nr_pages;
48 domctl.cmd = XEN_DOMCTL_getmemlist;
49 domctl.domain = (domid_t)domid;
50 domctl.u.getmemlist.max_pfns = max_pfns;
51 domctl.u.getmemlist.num_pfns = 0;
52 set_xen_guest_handle(domctl.u.getmemlist.buffer, __pfn_buf);
54 if ((max_pfns != -1UL)
55 && mlock(__pfn_buf, __nr_pages * sizeof(xen_pfn_t)) != 0) {
56 PERROR("Could not lock pfn list buffer");
57 return -1;
58 }
60 ret = do_domctl(xc_handle, &domctl);
62 if (max_pfns != -1UL)
63 (void)munlock(__pfn_buf, __nr_pages * sizeof(xen_pfn_t));
65 if (max_pfns == -1UL)
66 return 0;
68 num_pfns = domctl.u.getmemlist.num_pfns;
69 __start_page += num_pfns;
70 __nr_pages -= num_pfns;
71 __pfn_buf += num_pfns;
73 if (ret < 0)
74 // dummy write to make sure this tlb mapping is tracked by VMM
75 *__pfn_buf = 0;
76 else
77 return nr_pages;
78 }
79 return nr_pages;
80 }
82 int
83 xc_get_pfn_list(int xc_handle, uint32_t domid, xen_pfn_t *pfn_buf,
84 unsigned long max_pfns)
85 {
86 return xc_ia64_get_pfn_list (xc_handle, domid, pfn_buf, 0, max_pfns);
87 }
89 long
90 xc_get_max_pages(int xc_handle, uint32_t domid)
91 {
92 struct xen_domctl domctl;
93 domctl.cmd = XEN_DOMCTL_getdomaininfo;
94 domctl.domain = (domid_t)domid;
95 return (do_domctl(xc_handle, &domctl) < 0) ? -1 : domctl.u.getdomaininfo.max_pages;
96 }
98 /*
99 * Local variables:
100 * mode: C
101 * c-set-style: "BSD"
102 * c-basic-offset: 4
103 * tab-width: 4
104 * indent-tabs-mode: nil
105 * End:
106 */