ia64/xen-unstable

view tools/libxc/ia64/xc_ia64_stubs.c @ 10691:dab0a5650e6d

[IA64] Creates tools/libxc/ia64 directory.

Split and move xc_ia64_stubs.c into ia64/xc_ia64_hvm_build.c and
ia64/xc_ia64_stubs.c
Creates ia64/Makefile.
Clean up (static in const) in xc_ia64_hvm_build.c

Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
[whitespace cleanups in new files]
Signed-off-by: Alex Williamson <alex.williamson@hp.com>
author awilliam@xenbuild.aw
date Tue Jul 11 11:29:25 2006 -0600 (2006-07-11)
parents
children 306d7857928c
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 int
27 xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
28 uint32_t max_factor, uint32_t flags /* XCFLAGS_xxx */,
29 int (*suspend)(int domid))
30 {
31 PERROR("xc_linux_save not implemented\n");
32 return -1;
33 }
35 int
36 xc_linux_restore(int xc_handle, int io_fd, uint32_t dom, unsigned long nr_pfns,
37 unsigned int store_evtchn, unsigned long *store_mfn,
38 unsigned int console_evtchn, unsigned long *console_mfn)
39 {
40 PERROR("xc_linux_restore not implemented\n");
41 return -1;
42 }
44 /*
45 VMM uses put_user to copy pfn_list to guest buffer, this maybe fail,
46 VMM doesn't handle this now.
47 This method will touch guest buffer to make sure the buffer's mapping
48 is tracked by VMM,
49 */
50 int
51 xc_ia64_get_pfn_list(int xc_handle, uint32_t domid, xen_pfn_t *pfn_buf,
52 unsigned int start_page, unsigned int nr_pages)
53 {
54 dom0_op_t op;
55 int num_pfns,ret;
56 unsigned int __start_page, __nr_pages;
57 unsigned long max_pfns;
58 xen_pfn_t *__pfn_buf;
60 __start_page = start_page;
61 __nr_pages = nr_pages;
62 __pfn_buf = pfn_buf;
64 while (__nr_pages) {
65 max_pfns = ((unsigned long)__start_page << 32) | __nr_pages;
66 op.cmd = DOM0_GETMEMLIST;
67 op.u.getmemlist.domain = (domid_t)domid;
68 op.u.getmemlist.max_pfns = max_pfns;
69 op.u.getmemlist.num_pfns = 0;
70 set_xen_guest_handle(op.u.getmemlist.buffer, __pfn_buf);
72 if ((max_pfns != -1UL)
73 && mlock(__pfn_buf, __nr_pages * sizeof(xen_pfn_t)) != 0) {
74 PERROR("Could not lock pfn list buffer");
75 return -1;
76 }
78 ret = do_dom0_op(xc_handle, &op);
80 if (max_pfns != -1UL)
81 (void)munlock(__pfn_buf, __nr_pages * sizeof(xen_pfn_t));
83 if (max_pfns == -1UL)
84 return 0;
86 num_pfns = op.u.getmemlist.num_pfns;
87 __start_page += num_pfns;
88 __nr_pages -= num_pfns;
89 __pfn_buf += num_pfns;
91 if (ret < 0)
92 // dummy write to make sure this tlb mapping is tracked by VMM
93 *__pfn_buf = 0;
94 else
95 return nr_pages;
96 }
97 return nr_pages;
98 }
100 int
101 xc_get_pfn_list(int xc_handle, uint32_t domid, xen_pfn_t *pfn_buf,
102 unsigned long max_pfns)
103 {
104 return xc_ia64_get_pfn_list (xc_handle, domid, pfn_buf, 0, max_pfns);
105 }
107 long
108 xc_get_max_pages(int xc_handle, uint32_t domid)
109 {
110 dom0_op_t op;
111 op.cmd = DOM0_GETDOMAININFO;
112 op.u.getdomaininfo.domain = (domid_t)domid;
113 return (do_dom0_op(xc_handle, &op) < 0) ? -1 : op.u.getdomaininfo.max_pages;
114 }
116 /*
117 * Local variables:
118 * mode: C
119 * c-set-style: "BSD"
120 * c-basic-offset: 4
121 * tab-width: 4
122 * indent-tabs-mode: nil
123 * End:
124 */