Various fixes to some source files to compile as a stubdomain.
(Most of these changes were originally written by Samuel for an older
version of qemu-remote. Patch to exec-all.h dropped in this checkin
by iwj.)
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#include "vl.h"
+#include "qemu-common.h"
+#include "audio/sys-queue.h"
#include "block_int.h"
#include <assert.h>
#include <xenbus.h>
#ifdef CONFIG_STUBDOM
#include <xen/io/blkif.h>
-#define SCSI_DMA_BUF_SIZE (BLKIF_MAX_SEGMENTS_PER_REQUEST * TARGET_PAGE_SIZE)
+#define SCSI_DMA_BUF_SIZE ((BLKIF_MAX_SEGMENTS_PER_REQUEST - 1) * PAGE_SIZE)
#else
#define SCSI_DMA_BUF_SIZE 131072
#endif
#include "pci.h"
#include "vga_int.h"
#include <sys/mman.h>
+#include "sysemu.h"
+#include "qemu-xen.h"
+#include "exec-all.h"
//#define DEBUG_VGA
//#define DEBUG_VGA_MEM
#ifdef CONFIG_STUBDOM
if (logdirty_bitmap != NULL)
xc_hvm_modified_memory(xc_handle, domid, _addr >> TARGET_PAGE_BITS,
- (_addr + _len + TARGET_PAGE_SIZE - 1) >> TARGET_PAGE_BITS
- - _addr >> TARGET_PAGE_BITS);
+ ((_addr + _len + TARGET_PAGE_SIZE - 1) >> TARGET_PAGE_BITS)
+ - (_addr >> TARGET_PAGE_BITS));
#endif
mapcache_unlock();
#include "qemu-char.h"
#include "block.h"
#include "audio/audio.h"
+#include "qemu-xen.h"
#include <unistd.h>
#include <stdlib.h>
#include <mmsystem.h>
#define getopt_long_only getopt_long
#define memalign(align, size) malloc(size)
+#define NO_UNIX_SOCKETS 1
#endif
#include "qemu_socket.h"
}
int parse_host_port(struct sockaddr_in *saddr, const char *str);
-#ifndef _WIN32
+#ifndef NO_UNIX_SOCKETS
static int parse_unix_path(struct sockaddr_un *uaddr, const char *str);
#endif
int parse_host_src_port(struct sockaddr_in *haddr,
CharDriverState *chr = opaque;
TCPCharDriver *s = chr->opaque;
struct sockaddr_in saddr;
-#ifndef _WIN32
+#ifndef NO_UNIX_SOCKETS
struct sockaddr_un uaddr;
#endif
struct sockaddr *addr;
int fd;
for(;;) {
-#ifndef _WIN32
+#ifndef NO_UNIX_SOCKETS
if (s->is_unix) {
len = sizeof(uaddr);
addr = (struct sockaddr *)&uaddr;
int do_nodelay = 0;
const char *ptr;
struct sockaddr_in saddr;
-#ifndef _WIN32
+#ifndef NO_UNIX_SOCKETS
struct sockaddr_un uaddr;
#endif
struct sockaddr *addr;
socklen_t addrlen;
-#ifndef _WIN32
+#ifndef NO_UNIX_SOCKETS
if (is_unix) {
addr = (struct sockaddr *)&uaddr;
addrlen = sizeof(uaddr);
if (!s)
goto fail;
-#ifndef _WIN32
+#ifndef NO_UNIX_SOCKETS
if (is_unix)
fd = socket(PF_UNIX, SOCK_STREAM, 0);
else
if (is_listen) {
/* allow fast reuse */
-#ifndef _WIN32
+#ifndef NO_UNIX_SOCKETS
if (is_unix) {
char path[109];
strncpy(path, uaddr.sun_path, 108);
fcntl(fd, F_SETFL, O_NONBLOCK);
return fd;
}
-#else
+#elif defined(__linux__)
static int tap_open(char *ifname, int ifname_size)
{
struct ifreq ifr;
bdrv_init();
xc_handle = xc_interface_open();
+#ifdef CONFIG_STUBDOM
+ {
+ char *domid_s, *msg;
+ if ((msg = xenbus_read(XBT_NIL, "domid", &domid_s)))
+ fprintf(stderr,"Can not read our own domid: %s\n", msg);
+ else
+ xenstore_parse_domain_config(atoi(domid_s));
+ }
+#else
xenstore_parse_domain_config(domid);
+#endif /* CONFIG_STUBDOM */
/* we always create the cdrom drive, even if no disk is there */
/* terminal init */
memset(&display_state, 0, sizeof(display_state));
+#ifdef CONFIG_STUBDOM
+ if (xenfb_pv_display_init(ds) == 0) {
+ } else
+#endif
if (nographic) {
if (curses) {
fprintf(stderr, "fatal: -nographic can't be used with -curses\n");
struct qemu_alarm_timer;
static int unix_start_timer(struct qemu_alarm_timer *t) { return 0; }
static void unix_stop_timer(struct qemu_alarm_timer *t) { }
+
+#ifdef CONFIG_STUBDOM
+#include <netfront.h>
+static int tap_open(char *ifname, int ifname_size)
+{
+ char nodename[64];
+ static int num = 1; // 0 is for our own TCP/IP networking
+ snprintf(nodename, sizeof(nodename), "device/vif/%d", num++);
+ return netfront_tap_open(nodename);
+}
+
+#undef DEFAULT_NETWORK_SCRIPT
+#define DEFAULT_NETWORK_SCRIPT ""
+#undef DEFAULT_NETWORK_DOWN_SCRIPT
+#define DEFAULT_NETWORK_DOWN_SCRIPT ""
+#endif
+
#include <semaphore.h>
#include <sched.h>
#include <fbfront.h>
+#include <hw/hw.h>
+#include <hw/pc.h>
+#include <console.h>
#include <hw/xenfb.h>
-#include "vl.h"
-
typedef struct XenFBState {
struct semaphore kbd_sem;
struct kbdfront_dev *kbd_dev;
if (ds->shared_buf) {
offset = pixels - xs->vga_vram;
ds->data = pixels;
+ fbfront_resize(fb_dev, ds->width, ds->height, ds->linesize, ds->depth, offset);
} else {
ds->data = xs->nonshared_vram;
fbfront_resize(fb_dev, w, h, linesize, ds->depth, VGA_RAM_SIZE);
continue;
if (bdrv_open2(bs, buf, 0 /* snapshot */, &bdrv_vbd) == 0) {
pstrcpy(bs->filename, sizeof(bs->filename), params);
- continue;
- }
+ } else
#endif
if (params[0]) {