--- /dev/null
+/*
+ * This file is part of the Palacios Virtual Machine Monitor developed
+ * by the V3VEE Project with funding from the United States National
+ * Science Foundation and the Department of Energy.
+ *
+ * The V3VEE Project is a joint project between Northwestern University
+ * and the University of New Mexico. You can find out more at
+ * http://www.v3vee.org
+ *
+ * Copyright (c) 2008, Jack Lange <jarusl@cs.northwestern.edu>
+ * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org>
+ * All rights reserved.
+ *
+ * Author: Jack Lange <jarusl@cs.northwestern.edu>
+ *
+ * This is free software. You are permitted to use,
+ * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
+ */
+
+#ifndef __DEVICES_SERIAL_H__
+#define __DEVICES_SERIAL_H__
+
+#ifdef __V3VEE__
+
+/* Really need to find clean way to allow a backend stream device to be attachable
+ to different kinds of frontend devices that can act as a stream */
+
+struct v3_stream_ops {
+ int (*read)(char *buf, uint_t len, void *private_data);
+ int (*write)(char *buf, uint_t len, void *private_data);
+};
+
+
+int v3_stream_register_serial(struct vm_device * serial_dev, struct v3_stream_ops * ops, void * private_data);
+
+#endif // ! __V3VEE__
+
+
+#endif
--- /dev/null
+/*
+ * This file is part of the Palacios Virtual Machine Monitor developed
+ * by the V3VEE Project with funding from the United States National
+ * Science Foundation and the Department of Energy.
+ *
+ * The V3VEE Project is a joint project between Northwestern University
+ * and the University of New Mexico. You can find out more at
+ * http://www.v3vee.org
+ *
+ * Copyright (c) 2010, Peter Dinda (pdinda@northwestern.edu>
+ * Copyright (c) 2010, The V3VEE Project <http://www.v3vee.org>
+ * All rights reserved.
+ *
+ * Author: Peter Dinda <pdinda@northwestern.edu>
+ *
+ * This is free software. You are permitted to use,
+ * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
+ */
+
+
+#ifndef __VMM_STREAM_H__
+#define __VMM_STREAM_H__
+
+#include <palacios/vmm.h>
+
+
+#ifdef __V3VEE__
+
+#define V3_StreamOpen(path, mode) \
+ ({ \
+ extern struct v3_stream_hooks *stream_hooks; \
+ ((stream_hooks) && (stream_hooks)->stream_open) ? \
+ (stream_hooks)->stream_open((path), (mode)) : NULL; \
+ })
+
+#define V3_StreamRead(stream, b, l) \
+ ({ \
+ extern struct v3_stream_hooks *stream_hooks; \
+ ((stream_hooks) && (stream_hooks)->stream_read) ? \
+ (stream_hooks)->stream_read((stream), (b), (l)) : -1; \
+ })
+
+#define V3_StreamWrite(stream, b, l) \
+ ({ \
+ extern struct v3_stream_hooks *stream_hooks; \
+ ((stream_hooks) && (stream_hooks)->stream_write) ? \
+ (stream_hooks)->stream_write((stream), (b), (l)) : -1; \
+ })
+
+
+#define V3_StreamClose(stream) \
+ ({ \
+ extern struct v3_stream_hooks *stream_hooks; \
+ ((stream_hooks) && (stream_hooks)->stream_close) ? \
+ (stream_hooks)->stream_close((stream), (mode)) : NULL; \
+ })
+
+
+#endif
+
+#define STREAM_OPEN_MODE_READ (1 << 0)
+#define STREAM_OPEN_MODE_WRITE (1 << 1)
+
+struct v3_stream_hooks {
+ void *(*stream_open)(const char *path, int mode);
+ int (*stream_read)(void *stream, char *buf, int len);
+ int (*stream_write)(void *stream, char *buf, int len);
+ int (*stream_close)(void *stream);
+
+};
+
+
+extern void V3_Init_Stream(struct v3_stream_hooks * hooks);
+
+#endif
help
Include virtual serial port
+config STREAM
+ bool "Stream device"
+ default n
+ help
+ Stream Device
+
endmenu
obj-$(CONFIG_PASSTHROUGH_PCI) += pci_passthrough.o
obj-$(CONFIG_SYMMOD) += lnx_virtio_symmod.o
-
+obj-$(CONFIG_STREAM) += stream.o
#include <palacios/vmm_host_events.h>
#include <palacios/vm_guest.h>
+#include <devices/serial.h>
+
#ifndef CONFIG_DEBUG_SERIAL
#undef PrintDebug
struct serial_buffer tx_buffer;
struct serial_buffer rx_buffer;
uint_t irq_number;
+
+ struct v3_stream_ops *stream_ops;
+ void *backend_data;
+
};
struct serial_port com2;
struct serial_port com3;
struct serial_port com4;
+
+
};
com_port->dll.data = *val;
} else {
queue_data(&(com_port->tx_buffer), *val, com_port, dev);
+ if (com_port->stream_ops) {
+ uint8_t c;
+ dequeue_data(&(com_port->tx_buffer), &c, com_port, dev);
+ com_port->stream_ops->write(&c,1,com_port->backend_data);
+ }
}
return 0;
}
+int v3_stream_register_serial(struct vm_device * serial_dev, struct v3_stream_ops * ops, void * private_data)
+{
+ struct serial_state *state = (struct serial_state *)(serial_dev->private_data);
+
+ state->com1.stream_ops = ops;
+ state->com1.backend_data = private_data;
+ /* bind to other ports here */
+
+ return 0;
+}
+
device_register("SERIAL", serial_init)
obj-$(CONFIG_SOCKET) += vmm_socket.o
obj-$(CONFIG_VNET) += vmm_vnet.o
obj-$(CONFIG_FILE) += vmm_file.o
-obj-$(CONFIG_CONSOLE) += vmm_console.o
+obj-$(CONFIG_CONSOLE) += vmm_console.o vmm_stream.o
obj-$(CONFIG_SYMBIOTIC) += vmm_symbiotic.o vmm_symspy.o
// Finally launch the BSP on core 0
sprintf(tname,"core%u",0);
-#if CONFIG_LINUX
- if (vm->num_cores==1) {
- start_core(&(vm->cores[0]));
- return -1;
- } else {
- if (!os_hooks->start_thread_on_cpu(0,start_core,&(vm->cores[0]),tname)) {
- PrintError("Thread launch failed\n");
- return -1;
- }
- }
-#else
if (!os_hooks->start_thread_on_cpu(0,start_core,&(vm->cores[0]),tname)) {
PrintError("Thread launch failed\n");
return -1;
}
-#endif
return 0;
--- /dev/null
+/*
+ * This file is part of the Palacios Virtual Machine Monitor developed
+ * by the V3VEE Project with funding from the United States National
+ * Science Foundation and the Department of Energy.
+ *
+ * The V3VEE Project is a joint project between Northwestern University
+ * and the University of New Mexico. You can find out more at
+ * http://www.v3vee.org
+ *
+ * Copyright (c) 2010, Lei Xia <lxia@northwestern.edu>
+ * Copyright (c) 2010, The V3VEE Project <http://www.v3vee.org>
+ * All rights reserved.
+ *
+ * Author: Lei Xia <lxia@northwestern.edu>
+ *
+ * This is free software. You are permitted to use,
+ * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
+ */
+
+
+#include <palacios/vmm_stream.h>
+#include <palacios/vmm.h>
+#include <palacios/vmm_debug.h>
+#include <palacios/vmm_types.h>
+
+
+struct v3_stream_hooks * stream_hooks = 0;
+
+void V3_Init_Stream(struct v3_stream_hooks * hooks) {
+ stream_hooks = hooks;
+ PrintDebug("V3 stream inited\n");
+
+ return;
+}