|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH RFC 14/14] xen: tools: Added xen-subpage tool.
> +#include <errno.h>
> +#include <inttypes.h>
> +#include <stdlib.h>
> +#include <stdarg.h>
> +#include <stdbool.h>
> +#include <string.h>
> +#include <time.h>
> +#include <signal.h>
> +#include <unistd.h>
> +#include <sys/mman.h>
> +#include <poll.h>
> +
> +#include <xenctrl.h>
> +
> +#define DPRINTF(a, b...) fprintf(stderr, a, ## b)
> +#define ERROR(a, b...) fprintf(stderr, a "\n", ## b)
> +#define PERROR(a, b...) fprintf(stderr, a ": %s\n", ## b, strerror(errno))
> +
> +void usage(char* progname)
> +{
> + fprintf(stderr, "Usage: %s [-m] <domain_id> get|set [gfn] [bit_map]",
> progname);
> +
> + fprintf(stderr,
> + "\n"
> + "set - set gfn bitmap.\n"
> + "\n"
> + "-m requires this program to run\n");
> +}
> +
> +int main(int argc, char *argv[])
> +{
> + domid_t domain_id;
> + xc_interface *xch;
> + xen_pfn_t gfn = 0;
> + uint32_t access = 0;
> + int required = 0;
> + int rc = 0;
> +
> + char* progname = argv[0];
> + argv++;
> + argc--;
> +
> + if ( argc == 5 && argv[0][0] == '-' )
> + {
> + if ( !strcmp(argv[0], "-m") )
> + required = 1;
> + else
> + {
> + usage(progname);
> + return -1;
> + }
> + argv++;
> + argc--;
> + }
> +
> + if ( argc != 4 )
> + {
> + usage(progname);
> + return -1;
> + }
> +
> + domain_id = atoi(argv[0]);
> + argv++;
> + argc--;
> +
> + if ( !strcmp(argv[0], "set") )
> + {
> + gfn = strtoul(argv[1], 0, 0);
> + access = strtoul(argv[2], 0, 0);
> + DPRINTF("set subpage gfn:0x%lx -- map:0x%x\n", gfn, access);
> + xch = xc_interface_open(NULL, NULL, 0);
> + if ( !xch )
> + {
> + ERROR("get interface error\n");
> + return -1;
> + }
> + xc_mem_set_subpage(xch, domain_id, gfn, access);
> + xc_interface_close(xch);
> + }
> + else
> + {
> + usage(argv[0]);
> + return -1;
> + }
> +
> + return rc;
> +}
As far as I understand, this example just calls the new hypercall and exits.
Should there be another vm_event-subscribed application that will be
affected by the changes? If so, doesn't this rather belong in the
xen-access.c test?
Also, no explanation is given in comments in the source code or the
displayed help for useful values of the access parameter, and what it
stands for.
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |