ia64/xen-unstable

view tools/libxc/ia64/xc_ia64_stubs.c @ 10692:306d7857928c

[IA64] Save & restore.

xc_ia64_linux_save.c and xc_ia64_linux_restore.c added.
vcpu context has more registers and states (eg: tr registers).
Per cpu irqs are deallocated when cpu is switched off.
#if/#endif added in reboot.c for ia64.

Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
author awilliam@xenbuild.aw
date Tue Jul 11 12:51:18 2006 -0600 (2006-07-11)
parents dab0a5650e6d
children 86d26e6ec89b
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 dom0_op_t op;
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 op.cmd = DOM0_GETMEMLIST;
49 op.u.getmemlist.domain = (domid_t)domid;
50 op.u.getmemlist.max_pfns = max_pfns;
51 op.u.getmemlist.num_pfns = 0;
52 set_xen_guest_handle(op.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_dom0_op(xc_handle, &op);
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 = op.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 dom0_op_t op;
93 op.cmd = DOM0_GETDOMAININFO;
94 op.u.getdomaininfo.domain = (domid_t)domid;
95 return (do_dom0_op(xc_handle, &op) < 0) ? -1 : op.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 */