Merge branch 'hvm' of 10.141.1.101:/var/lib/qubes/git/marmarek/core into hvm
This commit is contained in:
commit
c19a63b175
@ -55,7 +55,7 @@ python -O -m compileall qvm-core qmemman
|
|||||||
make -C restore
|
make -C restore
|
||||||
make -C aux-tools
|
make -C aux-tools
|
||||||
make -C ../qubes_rpc
|
make -C ../qubes_rpc
|
||||||
make -C ../vchan
|
make -C ../vchan -f Makefile.linux
|
||||||
make -C ../u2mfn
|
make -C ../u2mfn
|
||||||
make -C ../qrexec
|
make -C ../qrexec
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ The Qubes core files for installation inside a Qubes VM.
|
|||||||
|
|
||||||
%build
|
%build
|
||||||
make -C u2mfn
|
make -C u2mfn
|
||||||
make -C vchan
|
make -C vchan -f Makefile.linux
|
||||||
make -C misc
|
make -C misc
|
||||||
make -C qubes_rpc
|
make -C qubes_rpc
|
||||||
make -C qrexec
|
make -C qrexec
|
||||||
|
59
vchan/init.c
59
vchan/init.c
@ -62,7 +62,7 @@ static int fill_ctrl(struct libvchan *ctrl, struct vchan_interface *ring, int ri
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WINNT
|
#ifdef QREXEC_RING_V2
|
||||||
static int ring_init(struct libvchan *ctrl)
|
static int ring_init(struct libvchan *ctrl)
|
||||||
{
|
{
|
||||||
struct gntmem_handle* h;
|
struct gntmem_handle* h;
|
||||||
@ -127,11 +127,6 @@ static int server_interface_init(struct libvchan *ctrl, int devno)
|
|||||||
struct xs_handle *xs;
|
struct xs_handle *xs;
|
||||||
char buf[64];
|
char buf[64];
|
||||||
char ref[16];
|
char ref[16];
|
||||||
/* XXX temp hack begin */
|
|
||||||
char *domid_s;
|
|
||||||
int domid = 0;
|
|
||||||
unsigned int len;
|
|
||||||
/* XXX temp hack end */
|
|
||||||
#ifdef XENCTRL_HAS_XC_INTERFACE
|
#ifdef XENCTRL_HAS_XC_INTERFACE
|
||||||
xc_evtchn *evfd;
|
xc_evtchn *evfd;
|
||||||
#else
|
#else
|
||||||
@ -163,37 +158,24 @@ static int server_interface_init(struct libvchan *ctrl, int devno)
|
|||||||
ctrl->evport = port;
|
ctrl->evport = port;
|
||||||
ctrl->devno = devno;
|
ctrl->devno = devno;
|
||||||
|
|
||||||
// stubdom debug HACK XXX
|
#ifdef QREXEC_RING_V2
|
||||||
domid_s = xs_read(xs, 0, "domid", &len);
|
|
||||||
if (domid_s)
|
|
||||||
domid = atoi(domid_s);
|
|
||||||
|
|
||||||
snprintf(buf, sizeof buf, "device/vchan/%d/version", devno);
|
snprintf(buf, sizeof buf, "device/vchan/%d/version", devno);
|
||||||
if (!xs_write(xs, 0, buf, "2", strlen("2")))
|
if (!xs_write(xs, 0, buf, "2", strlen("2")))
|
||||||
goto fail2;
|
goto fail2;
|
||||||
|
#endif
|
||||||
|
|
||||||
snprintf(ref, sizeof ref, "%d", ctrl->ring_ref);
|
snprintf(ref, sizeof ref, "%d", ctrl->ring_ref);
|
||||||
snprintf(buf, sizeof buf, "device/vchan/%d/ring-ref", devno);
|
snprintf(buf, sizeof buf, "device/vchan/%d/ring-ref", devno);
|
||||||
if (!xs_write(xs, 0, buf, ref, strlen(ref)))
|
if (!xs_write(xs, 0, buf, ref, strlen(ref)))
|
||||||
#ifdef CONFIG_STUBDOM
|
|
||||||
// TEMP HACK XXX FIXME goto fail2;
|
|
||||||
fprintf(stderr, "xenstore-write /local/domain/%d/%s %s\n", domid, buf, ref);
|
|
||||||
#else
|
|
||||||
goto fail2;
|
goto fail2;
|
||||||
#endif
|
|
||||||
snprintf(ref, sizeof ref, "%d", ctrl->evport);
|
snprintf(ref, sizeof ref, "%d", ctrl->evport);
|
||||||
snprintf(buf, sizeof buf, "device/vchan/%d/event-channel", devno);
|
snprintf(buf, sizeof buf, "device/vchan/%d/event-channel", devno);
|
||||||
if (!xs_write(xs, 0, buf, ref, strlen(ref)))
|
if (!xs_write(xs, 0, buf, ref, strlen(ref)))
|
||||||
#ifdef CONFIG_STUBDOM
|
|
||||||
// TEMP HACK XXX FIXME goto fail2;
|
|
||||||
fprintf(stderr, "xenstore-write /local/domain/%d/%s %s\n", domid, buf, ref);
|
|
||||||
#else
|
|
||||||
goto fail2;
|
goto fail2;
|
||||||
#endif
|
// do not block in stubdom and windows - libvchan_server_handle_connected will be
|
||||||
// do not block in stubdom - libvchan_server_handle_connected will be
|
// called on first input
|
||||||
// called on first input
|
#ifndef ASYNC_INIT
|
||||||
#ifndef CONFIG_STUBDOM
|
// wait for the peer to arrive
|
||||||
// wait for the peer to arrive
|
|
||||||
if (xc_evtchn_pending(evfd) == -1)
|
if (xc_evtchn_pending(evfd) == -1)
|
||||||
goto fail2;
|
goto fail2;
|
||||||
xc_evtchn_unmask(ctrl->evfd, ctrl->evport);
|
xc_evtchn_unmask(ctrl->evfd, ctrl->evport);
|
||||||
@ -204,15 +186,7 @@ static int server_interface_init(struct libvchan *ctrl, int devno)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
fail2:
|
fail2:
|
||||||
if (ret)
|
if (ret)
|
||||||
#ifdef XENCTRL_HAS_XC_INTERFACE
|
|
||||||
xc_evtchn_close(evfd);
|
xc_evtchn_close(evfd);
|
||||||
#else
|
|
||||||
#ifdef WINNT
|
|
||||||
xc_evtchn_close(evfd);
|
|
||||||
#else
|
|
||||||
close(evfd);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
fail:
|
fail:
|
||||||
xs_daemon_close(xs);
|
xs_daemon_close(xs);
|
||||||
return ret;
|
return ret;
|
||||||
@ -263,8 +237,6 @@ int libvchan_server_handle_connected(struct libvchan *ctrl)
|
|||||||
struct xs_handle *xs;
|
struct xs_handle *xs;
|
||||||
char buf[64];
|
char buf[64];
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
int libvchan_fd;
|
|
||||||
// fd_set rfds;
|
|
||||||
|
|
||||||
#ifdef WINNT
|
#ifdef WINNT
|
||||||
xs = xs_domain_open();
|
xs = xs_domain_open();
|
||||||
@ -288,11 +260,7 @@ int libvchan_server_handle_connected(struct libvchan *ctrl)
|
|||||||
#if 0
|
#if 0
|
||||||
fail2:
|
fail2:
|
||||||
if (ret)
|
if (ret)
|
||||||
#ifdef XENCTRL_HAS_XC_INTERFACE
|
|
||||||
xc_evtchn_close(ctrl->evfd);
|
xc_evtchn_close(ctrl->evfd);
|
||||||
#else
|
|
||||||
close(ctrl->evfd);
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
xs_daemon_close(xs);
|
xs_daemon_close(xs);
|
||||||
return ret;
|
return ret;
|
||||||
@ -312,10 +280,11 @@ static int client_interface_init(struct libvchan *ctrl, int domain, int devno)
|
|||||||
struct xs_handle *xs;
|
struct xs_handle *xs;
|
||||||
#ifdef XENCTRL_HAS_XC_INTERFACE
|
#ifdef XENCTRL_HAS_XC_INTERFACE
|
||||||
xc_interface *xcfd;
|
xc_interface *xcfd;
|
||||||
|
xc_gnttab *xcg;
|
||||||
#else
|
#else
|
||||||
int xcfd;
|
int xcfd;
|
||||||
#endif
|
|
||||||
int xcg;
|
int xcg;
|
||||||
|
#endif
|
||||||
char buf[64];
|
char buf[64];
|
||||||
char *ref;
|
char *ref;
|
||||||
int version;
|
int version;
|
||||||
@ -377,14 +346,10 @@ static int client_interface_init(struct libvchan *ctrl, int domain, int devno)
|
|||||||
ctrl->ring = (struct vchan_interface *)
|
ctrl->ring = (struct vchan_interface *)
|
||||||
xc_map_foreign_range(xcfd, domain, 4096,
|
xc_map_foreign_range(xcfd, domain, 4096,
|
||||||
PROT_READ | PROT_WRITE, ctrl->ring_ref);
|
PROT_READ | PROT_WRITE, ctrl->ring_ref);
|
||||||
#ifdef XENCTRL_HAS_XC_INTERFACE
|
|
||||||
xc_interface_close(xcfd);
|
xc_interface_close(xcfd);
|
||||||
#else
|
|
||||||
close(xcfd);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
xcg = xc_gnttab_open();
|
xcg = xc_gnttab_open(NULL, 0);
|
||||||
if (xcg < 0)
|
if (xcg < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
ctrl->ring = (struct vchan_interface *)
|
ctrl->ring = (struct vchan_interface *)
|
||||||
@ -410,11 +375,7 @@ static int client_interface_init(struct libvchan *ctrl, int domain, int devno)
|
|||||||
ctrl->evport =
|
ctrl->evport =
|
||||||
xc_evtchn_bind_interdomain(evfd, domain, remote_port);
|
xc_evtchn_bind_interdomain(evfd, domain, remote_port);
|
||||||
if (ctrl->evport < 0 || xc_evtchn_notify(evfd, ctrl->evport))
|
if (ctrl->evport < 0 || xc_evtchn_notify(evfd, ctrl->evport))
|
||||||
#ifdef XENCTRL_HAS_XC_INTERFACE
|
|
||||||
xc_evtchn_close(evfd);
|
xc_evtchn_close(evfd);
|
||||||
#else
|
|
||||||
close(evfd);
|
|
||||||
#endif
|
|
||||||
else
|
else
|
||||||
ret = 0;
|
ret = 0;
|
||||||
fail:
|
fail:
|
||||||
|
@ -28,11 +28,19 @@
|
|||||||
#include <xs.h>
|
#include <xs.h>
|
||||||
typedef HANDLE EVTCHN;
|
typedef HANDLE EVTCHN;
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
#else
|
#else /* WINNT */
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
typedef int EVTCHN;
|
typedef int EVTCHN;
|
||||||
#endif
|
#endif /* WINNT */
|
||||||
|
|
||||||
|
/* config vchan features */
|
||||||
|
#ifdef WINNT
|
||||||
|
#define QREXEC_RING_V2
|
||||||
|
#define ASYNC_INIT
|
||||||
|
#endif /* WINNT */
|
||||||
|
#ifdef CONFIG_STUBDOM
|
||||||
|
#define ASYNC_INIT
|
||||||
|
#endif /* CONFIG_STUBDOM */
|
||||||
|
|
||||||
#include <xenctrl.h>
|
#include <xenctrl.h>
|
||||||
typedef uint32_t VCHAN_RING_IDX;
|
typedef uint32_t VCHAN_RING_IDX;
|
||||||
|
@ -9,8 +9,6 @@ USE_MSVCRT=1
|
|||||||
|
|
||||||
DLLDEF=libvchan.def
|
DLLDEF=libvchan.def
|
||||||
|
|
||||||
C_DEFINES = $(C_DEFINES) /DCONFIG_STUBDOM
|
|
||||||
|
|
||||||
INCLUDES=$(INCLUDES); \
|
INCLUDES=$(INCLUDES); \
|
||||||
..\win\include;\
|
..\win\include;\
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user