From: Jack Lange Date: Wed, 15 Oct 2008 21:58:50 +0000 (-0500) Subject: tried to reduce compiler warnings, and cut down on debugging output X-Git-Tag: 1.0^2~48 X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=cafbc1318c847b8c18e2036dc56be7af7acefa4e tried to reduce compiler warnings, and cut down on debugging output --- diff --git a/build/Makefile b/build/Makefile index 0364304..cae3ceb 100644 --- a/build/Makefile +++ b/build/Makefile @@ -152,6 +152,22 @@ DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_RAMDISK=0 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 - diff --git a/palacios/build/Makefile b/palacios/build/Makefile index 9f05bf9..51d0096 100644 --- a/palacios/build/Makefile +++ b/palacios/build/Makefile @@ -148,13 +148,28 @@ endif 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 @@ -340,8 +355,8 @@ FD_SECTORS_PER_TRACK := $(PERL) $(PROJECT_ROOT)/scripts/numsecs_per_track # 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) @@ -411,8 +426,6 @@ rombios_link: 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) @@ -423,7 +436,7 @@ force_vgabios: vgabios_link 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 diff --git a/palacios/include/palacios/vmm_list.h b/palacios/include/palacios/vmm_list.h index d66d4c7..0d8747e 100644 --- a/palacios/include/palacios/vmm_list.h +++ b/palacios/include/palacios/vmm_list.h @@ -19,7 +19,7 @@ (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 diff --git a/palacios/src/devices/serial.c b/palacios/src/devices/serial.c index 55d7541..4f99113 100644 --- a/palacios/src/devices/serial.c +++ b/palacios/src/devices/serial.c @@ -162,7 +162,7 @@ struct serial_buffer { }; 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; @@ -175,7 +175,7 @@ int queue_data(struct serial_buffer * buf, char data) { } 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; diff --git a/palacios/src/palacios/svm.c b/palacios/src/palacios/svm.c index 015e396..7cf20ab 100644 --- a/palacios/src/palacios/svm.c +++ b/palacios/src/palacios/svm.c @@ -188,7 +188,7 @@ static void Init_VMCB_BIOS(vmcb_t * vmcb, struct guest_info *vm_info) { 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); } diff --git a/palacios/src/palacios/svm_halt.c b/palacios/src/palacios/svm_halt.c index 68261c3..2f5f1bb 100644 --- a/palacios/src/palacios/svm_halt.c +++ b/palacios/src/palacios/svm_halt.c @@ -27,6 +27,12 @@ #include +#ifndef DEBUG_HALT +#undef PrintDebug +#define PrintDebug(fmt, args...) +#endif + + // // This should trigger a #GP if cpl!=0, otherwise, yield to host diff --git a/palacios/src/palacios/svm_io.c b/palacios/src/palacios/svm_io.c index 63a5603..5a68133 100644 --- a/palacios/src/palacios/svm_io.c +++ b/palacios/src/palacios/svm_io.c @@ -39,7 +39,7 @@ int handle_svm_io_in(struct guest_info * info) { 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); @@ -83,7 +83,7 @@ int handle_svm_io_ins(struct guest_info * info) { 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; @@ -218,7 +218,7 @@ int handle_svm_io_out(struct guest_info * info) { 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); @@ -261,7 +261,7 @@ int handle_svm_io_outs(struct guest_info * info) { 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; diff --git a/palacios/src/palacios/vmm_config.c b/palacios/src/palacios/vmm_config.c index 3a4cbaf..ec6c5ab 100644 --- a/palacios/src/palacios/vmm_config.c +++ b/palacios/src/palacios/vmm_config.c @@ -102,7 +102,7 @@ int config_guest(struct guest_info * info, struct v3_vm_config * config_ptr) { 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; diff --git a/palacios/src/palacios/vmm_emulator.c b/palacios/src/palacios/vmm_emulator.c index 3294aa0..37fa3f9 100644 --- a/palacios/src/palacios/vmm_emulator.c +++ b/palacios/src/palacios/vmm_emulator.c @@ -154,6 +154,11 @@ int v3_emulate_memory_read(struct guest_info * info, addr_t read_gva, 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); @@ -183,7 +188,8 @@ int v3_emulate_memory_read(struct guest_info * info, addr_t read_gva, // 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); diff --git a/palacios/src/palacios/vmm_hashtable.c b/palacios/src/palacios/vmm_hashtable.c index 65dbca1..612ae78 100644 --- a/palacios/src/palacios/vmm_hashtable.c +++ b/palacios/src/palacios/vmm_hashtable.c @@ -125,7 +125,7 @@ ulong_t hash_long(ulong_t val, uint_t bits) { 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; diff --git a/palacios/src/palacios/vmm_xed.c b/palacios/src/palacios/vmm_xed.c index 7830458..bea0aaf 100644 --- a/palacios/src/palacios/vmm_xed.c +++ b/palacios/src/palacios/vmm_xed.c @@ -33,6 +33,15 @@ #endif + + +#ifndef DEBUG_XED +#undef PrintDebug +#define PrintDebug(fmt, args...) +#endif + + + static xed_state_t decoder_state; #define GPR_REGISTER 0