direct-io.hg

view tools/libxc/xc_resume.c @ 13525:9f27746eff43

[LIBXC] Refactor xc_domain_resume() into its own source file.

The idea is that this file is where we will have two implementations
of 'suspend cancellation': one which the guest is aware of (and is
faster) and the other which does more work to avoid requiring guest
modifications.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Fri Jan 19 18:32:28 2007 +0000 (2007-01-19)
parents
children c3e19108f3ed
line source
1 #include "xc_private.h"
3 /*
4 * Resume execution of a domain after suspend shutdown.
5 * This can happen in one of two ways:
6 * 1. Resume with special return code.
7 * 2. Reset guest environment so it believes it is resumed in a new
8 * domain context.
9 * (2) should be used only for guests which cannot handle the special
10 * new return code. (1) is always safe (but slower).
11 *
12 * XXX Only (2) is implemented below. We need to use (1) by default!
13 */
14 int xc_domain_resume(int xc_handle, uint32_t domid)
15 {
16 vcpu_guest_context_t ctxt;
17 DECLARE_DOMCTL;
18 int rc;
20 /*
21 * Set hypercall return code to indicate that suspend is cancelled
22 * (rather than resuming in a new domain context).
23 */
24 #if defined(__i386__) || defined(__x86_64__)
25 if ( (rc = xc_vcpu_getcontext(xc_handle, domid, 0, &ctxt)) != 0 )
26 return rc;
27 ctxt.user_regs.eax = 1;
28 if ( (rc = xc_vcpu_setcontext(xc_handle, domid, 0, &ctxt)) != 0 )
29 return rc;
30 #endif
32 domctl.cmd = XEN_DOMCTL_resumedomain;
33 domctl.domain = domid;
34 return do_domctl(xc_handle, &domctl);
35 }