ia64/xen-unstable

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