1 | /* |
---|
2 | * This file is subject to the terms and conditions of the GNU General |
---|
3 | * Public License. See the file "COPYING" in the main directory of |
---|
4 | * this archive for more details. |
---|
5 | * |
---|
6 | * Copyright (C) 2005 by Christian Limpach |
---|
7 | * |
---|
8 | */ |
---|
9 | |
---|
10 | #include <err.h> |
---|
11 | #include <stdlib.h> |
---|
12 | #include <stdint.h> |
---|
13 | #include <stdio.h> |
---|
14 | |
---|
15 | #include <xenctrl.h> |
---|
16 | #include <xenguest.h> |
---|
17 | |
---|
18 | int |
---|
19 | main(int argc, char **argv) |
---|
20 | { |
---|
21 | unsigned int xc_fd, io_fd, domid, store_evtchn, console_evtchn; |
---|
22 | unsigned int hvm, pae, apic; |
---|
23 | int ret; |
---|
24 | unsigned long store_mfn, console_mfn; |
---|
25 | |
---|
26 | if ( argc != 8 ) |
---|
27 | errx(1, "usage: %s iofd domid store_evtchn " |
---|
28 | "console_evtchn hvm pae apic", argv[0]); |
---|
29 | |
---|
30 | xc_fd = xc_interface_open(); |
---|
31 | if ( xc_fd < 0 ) |
---|
32 | errx(1, "failed to open control interface"); |
---|
33 | |
---|
34 | io_fd = atoi(argv[1]); |
---|
35 | domid = atoi(argv[2]); |
---|
36 | store_evtchn = atoi(argv[3]); |
---|
37 | console_evtchn = atoi(argv[4]); |
---|
38 | hvm = atoi(argv[5]); |
---|
39 | pae = atoi(argv[6]); |
---|
40 | apic = atoi(argv[7]); |
---|
41 | |
---|
42 | ret = xc_domain_restore(xc_fd, io_fd, domid, store_evtchn, &store_mfn, |
---|
43 | console_evtchn, &console_mfn, hvm, pae); |
---|
44 | |
---|
45 | if ( ret == 0 ) |
---|
46 | { |
---|
47 | printf("store-mfn %li\n", store_mfn); |
---|
48 | if ( !hvm ) |
---|
49 | printf("console-mfn %li\n", console_mfn); |
---|
50 | fflush(stdout); |
---|
51 | } |
---|
52 | |
---|
53 | xc_interface_close(xc_fd); |
---|
54 | |
---|
55 | return ret; |
---|
56 | } |
---|