endif
endif
+ifeq ($(DEBUG_XED),1)
+DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_XED=1
+else
+ifeq ($(DEBUG_XED),0)
+DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_XED=0
+endif
+endif
+
+ifeq ($(DEBUG_HALT),1)
+DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_HALT=1
+else
+ifeq ($(DEBUG_HALT),0)
+DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_HALT=0
+endif
+endif
+
# ----------------------------------------------------------------------
# Targets -
endif
ifeq ($(TRACE_RAMDISK),1)
-DEBUG_SECTIONS := $(DEBUG_SECTIONS -DTRACE_RAMDISK
+DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DTRACE_RAMDISK
else
ifeq ($(TRACE_RAMDSK),0)
DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UTRACE_RAMDISK
endif
endif
+ifeq ($(DEBUG_XED),1)
+DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DDEBUG_XED
+else
+ifeq ($(DEBUG_XED),0)
+DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UDEBUG_XED
+endif
+endif
+
+ifeq ($(DEBUG_HALT),1)
+DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DDEBUG_HALT
+else
+ifeq ($(DEBUG_HALT),0)
+DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UDEBUG_HALT
+endif
+endif
#DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DTEST_NE2K
# Flags used for all C source files
#GENERAL_OPTS := -O -Wall $(EXTRA_C_OPTS) $(VMM_FLAGS) -fPIC #-fvisibility=hidden
-GENERAL_OPTS := -O -Wall $(EXTRA_C_OPTS) $(VMM_FLAGS) -fPIC #-fvisibility=hidden
-CC_GENERAL_OPTS := $(GENERAL_OPTS) -Werror
+GENERAL_OPTS := -O -Wall $(EXTRA_C_OPTS) $(VMM_FLAGS) -fPIC -Werror#-fvisibility=hidden
+CC_GENERAL_OPTS := $(GENERAL_OPTS)
# Flags used for VMM C source files
CC_VMM_OPTS := -g -I$(PROJECT_ROOT)/include -D__V3VEE__ -D$(V3_ARCH) $(DECODER_FLAGS) $(JRLDEBUG)
vgabios_link:
ln -s -f ../src/vmboot/vgabios/VGABIOS-lgpl-latest.bin vgabios
-force_lwip:
- (cd ../src/lwip/build; make clean; make)
force_rombios: rombios_link
(cd ../src/vmboot/rombios; make clean; make)
force_payload: force_rombios force_vgabios
../scripts/make_payload.pl payload_layout.txt vm_kernel
-inter1: force_payload force_lwip
+inter1: force_payload
-make clean
world: inter1 vmm
(type *)( (char *)__mptr - offsetof(type,member) );})
-static inline void prefetch(const void *x) {;}
+static inline void prefetch(const void *x) {const void * foo; foo = x;}
/*
* These are non-NULL pointers that will result in page faults
};
int queue_data(struct serial_buffer * buf, char data) {
- int next_loc = (buf->head + 1) % SERIAL_BUF_LEN;
+ uint_t next_loc = (buf->head + 1) % SERIAL_BUF_LEN;
if (next_loc == buf->tail) {
return -1;
}
int dequeue_data(struct serial_buffer * buf, char * data) {
- int next_tail = (buf->tail + 1) % SERIAL_BUF_LEN;
+ uint_t next_tail = (buf->tail + 1) % SERIAL_BUF_LEN;
if (buf->head == buf->tail) {
return -1;
uchar_t * bitmap = (uchar_t *)io_port_bitmap;
bitmap += (port / 8);
- PrintDebug("Setting Bit for port 0x%x\n", port);
+ // PrintDebug("Setting Bit for port 0x%x\n", port);
*bitmap |= 1 << (port % 8);
}
#include <palacios/vmm_intr.h>
+#ifndef DEBUG_HALT
+#undef PrintDebug
+#define PrintDebug(fmt, args...)
+#endif
+
+
//
// This should trigger a #GP if cpl!=0, otherwise, yield to host
struct svm_io_info * io_info = (struct svm_io_info *)&(ctrl_area->exit_info1);
struct vmm_io_hook * hook = v3_get_io_hook(&(info->io_map), io_info->port);
- uint_t read_size = 0;
+ int read_size = 0;
if (hook == NULL) {
PrintError("Hook Not present for in on port %x\n", io_info->port);
struct svm_io_info * io_info = (struct svm_io_info *)&(ctrl_area->exit_info1);
struct vmm_io_hook * hook = v3_get_io_hook(&(info->io_map), io_info->port);
- uint_t read_size = 0;
+ int read_size = 0;
addr_t dst_addr = 0;
uint_t rep_num = 1;
struct svm_io_info * io_info = (struct svm_io_info *)&(ctrl_area->exit_info1);
struct vmm_io_hook * hook = v3_get_io_hook(&(info->io_map), io_info->port);
- uint_t write_size = 0;
+ int write_size = 0;
if (hook == NULL) {
PrintError("Hook Not present for out on port %x\n", io_info->port);
struct svm_io_info * io_info = (struct svm_io_info *)&(ctrl_area->exit_info1);
struct vmm_io_hook * hook = v3_get_io_hook(&(info->io_map), io_info->port);
- uint_t write_size = 0;
+ int write_size = 0;
addr_t dst_addr = 0;
uint_t rep_num = 1;
struct guest_mem_layout * layout = (struct guest_mem_layout *)config_ptr->vm_kernel;
extern v3_cpu_arch_t v3_cpu_type;
void * region_start;
- int i;
+ uint_t i;
int use_ramdisk = config_ptr->use_ramdisk;
int use_generic = USE_GENERIC;
ret = read_guest_va_memory(info, get_addr_linear(info, info->rip, &(info->segments.cs)), 15, instr);
}
+ if (ret == -1) {
+ PrintError("Could not read guest memory\n");
+ return -1;
+ }
+
#ifdef DEBUG_EMULATOR
PrintDebug("Instr (15 bytes) at %x:\n", instr);
PrintTraceMemDump(instr, 15);
// Read the data directly onto the emulated page
- if (read(read_gpa, (void *)(data_page->page_addr + data_addr_offset), instr_info.op_size, private_data) != instr_info.op_size) {
+ ret = read(read_gpa, (void *)(data_page->page_addr + data_addr_offset), instr_info.op_size, private_data);
+ if ((ret == -1) || ((uint_t)ret != instr_info.op_size)) {
PrintError("Read error in emulator\n");
V3_FreePage((void *)(data_page->page_addr));
V3_Free(data_page);
ulong_t hash_buffer(uchar_t * msg, uint_t length) {
ulong_t hash = 0;
ulong_t temp = 0;
- int i;
+ uint_t i;
for (i = 0; i < length; i++) {
hash = (hash << 4) + *(msg + i) + i;
#endif
+
+
+#ifndef DEBUG_XED
+#undef PrintDebug
+#define PrintDebug(fmt, args...)
+#endif
+
+
+
static xed_state_t decoder_state;
#define GPR_REGISTER 0