VMCS_LINK_PTR_HIGH = 0x00002801,
VMCS_GUEST_DBG_CTL = 0x00002802,
VMCS_GUEST_DBG_CTL_HIGH = 0x00002803,
- VMCS_GUEST_EFER = 0x00002805,
+ VMCS_GUEST_EFER = 0x00002806,
VMCS_GUEST_EFER_HIGH = 0x00002807,
VMCS_GUEST_PERF_GLOBAL_CTRL = 0x00002808,
VMCS_GUEST_PERF_GLOBAL_CTRL_HIGH = 0x00002809,
reload_val = 0xffff;
}
- // TODO: Check this....
- // Is this correct???
- if (reload_val == 0) {
- reload_val = 1;
- }
-
oscillations -= ch->counter;
ch->counter = 0;
channel_cycles = 1;
reload_val -= reload_val % 2;
}
+ // TODO: Check this....
+ // Is this correct???
+ if (reload_val == 0) {
+ reload_val = 1;
+ }
+
channel_cycles += oscillations / reload_val;
oscillations = oscillations % reload_val;
#include <palacios/vmm_host_events.h>
#include <palacios/vmm_lock.h>
#include <palacios/vmm_string.h>
+#include <palacios/vm_guest.h>
#include <devices/console.h>
static int dma_read(struct guest_info * core, struct vm_device * dev, struct ide_channel * channel) {
struct ide_drive * drive = get_selected_drive(channel);
// This is at top level scope to do the EOT test at the end
- struct ide_dma_prd prd_entry;
+ struct ide_dma_prd prd_entry = {};
uint_t bytes_left = drive->transfer_length;
// Read in the data buffer....
static int dma_write(struct guest_info * core, struct vm_device * dev, struct ide_channel * channel) {
struct ide_drive * drive = get_selected_drive(channel);
// This is at top level scope to do the EOT test at the end
- struct ide_dma_prd prd_entry;
+ struct ide_dma_prd prd_entry = {};
uint_t bytes_left = drive->transfer_length;
if (com_port->stream_ops) {
uint8_t c;
dequeue_data(&(com_port->tx_buffer), &c, com_port, dev);
- com_port->stream_ops->stream_write(&c,1,com_port->backend_data);
+ com_port->stream_ops->write(&c,1,com_port->backend_data);
}
}
state->com1.stream_ops = ops;
state->com1.backend_data = private_data;
/* bind to other ports here */
+ return 0;
}
check_vmcs_read(VMCS_GUEST_RFLAGS, &(info->ctrl_regs.rflags));
if (((struct vmx_data *)info->vmm_data)->ia32e_avail) {
+#ifdef __V3_64BIT__
check_vmcs_read(VMCS_GUEST_EFER, &(info->ctrl_regs.efer));
+#else
+ uint32_t hi, lo;
+ check_vmcs_read(VMCS_GUEST_EFER, &hi);
+ check_vmcs_read(VMCS_GUEST_EFER_HIGH, &lo);
+ info->ctrl_regs.efer = ((uint64_t) hi << 32) | lo;
+#endif
}
error = v3_read_vmcs_segments(&(info->segments));
info->dbg_regs.dr7 = 0x400;
+#ifdef __V3_64BIT__
vmx_ret |= check_vmcs_write(VMCS_LINK_PTR, (addr_t)0xffffffffffffffffULL);
-
+#else
+ vmx_ret |= check_vmcs_write(VMCS_LINK_PTR, (addr_t)0xffffffffUL);
+ vmx_ret |= check_vmcs_write(VMCS_LINK_PTR_HIGH, (addr_t)0xffffffffUL);
+#endif
if (v3_update_vmcs_ctrl_fields(info)) {
PrintError("Could not write control fields!\n");
return memcmp(s + slen - sublen, sub, sublen);
}
+#ifdef __minix
+/* MINIX does not support memory-mapped files;
+ * fortunately we only need to read the file which means we can just
+ * use malloc and read to achieve a similar effect
+ */
+#define mmap mmap_hack
+#define munmap munmap_hack
+
+#include <assert.h>
+
+static void *mmap(void *start, size_t size, int prot, int flags, int fd,
+ off_t offset)
+{
+ void *map;
+ off_t position;
+ ssize_t sizeread;
+
+ /* verify that we can handle this request */
+ assert(start == NULL);
+ assert(prot == PROT_READ);
+ assert(flags == MAP_PRIVATE);
+
+ /* seek to offset, storing old file pointer */
+ if ((position = lseek(fd, 0, SEEK_CUR)) == -1 ||
+ lseek(fd, offset, SEEK_SET) != offset) {
+ perror("fixdep: lseek");
+ }
+
+ /* allocate memory for file buffer */
+ map = malloc(size);
+ if (map) {
+ /* read the file data */
+ sizeread = read(fd, map, size);
+ if (sizeread != size) {
+ /* read failed or file size not as expected,
+ * return mmap error code
+ */
+ free(map);
+ map = (void *) -1L;
+ }
+ } else {
+ /* malloc failed, return mmap error code */
+ map = (void *) -1L;
+ }
+
+ /* restore old file pointer */
+ if (lseek(fd, position, SEEK_SET) != position) {
+ perror("fixdep: lseek");
+ }
+
+ return map;
+}
+
+static int munmap(void *start, size_t length)
+{
+ free(start);
+ return 0;
+}
+#endif
+
void do_config_file(char *filename)
{
struct stat st;