From: Jack Lange Date: Tue, 26 Jan 2010 06:50:35 +0000 (-0600) Subject: added back in 32 bit support X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=571979dad8fc2138a7e11c4fe61e812a0a0b17d1 added back in 32 bit support --- diff --git a/palacios/include/palacios/vmm_lowlevel.h b/palacios/include/palacios/vmm_lowlevel.h index 331a307..af1f820 100644 --- a/palacios/include/palacios/vmm_lowlevel.h +++ b/palacios/include/palacios/vmm_lowlevel.h @@ -69,11 +69,24 @@ struct sys_segment64 { static void __inline__ v3_cpuid(uint32_t target, uint32_t * eax, uint32_t * ebx, uint32_t * ecx, uint32_t * edx) { +#ifdef __V3_64BIT__ __asm__ __volatile__ ( "cpuid\n\t" : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx) : "0" (target), "2" (*ecx) ); +#elif __V3_32BIT__ + // 32 bit code compiled with -fPIC, cannot use ebx as an ouput reg. Fantastic. + __asm__ __volatile__ ( + "pushl %%ebx\n\t" + "movl %%edi, %%ebx\n\t" + "cpuid\n\t" + "movl %%ebx, %%edi\n\t" + "popl %%ebx\n\t" + : "=a" (*eax), "=D" (*ebx), "=c" (*ecx), "=d" (*edx) + : "0" (target), "2" (*ecx) + ); +#endif return; } diff --git a/palacios/src/devices/lnx_virtio_balloon.c b/palacios/src/devices/lnx_virtio_balloon.c index 088cea4..3350e26 100644 --- a/palacios/src/devices/lnx_virtio_balloon.c +++ b/palacios/src/devices/lnx_virtio_balloon.c @@ -142,8 +142,9 @@ static int handle_kick(struct vm_device * dev) { addr_t page_addr; tmp_desc = &(q->desc[desc_idx]); - PrintDebug("Header Descriptor (ptr=%p) gpa=%p, len=%d, flags=%x, next=%d\n", tmp_desc, - (void *)(tmp_desc->addr_gpa), tmp_desc->length, + PrintDebug("Header Descriptor (ptr=%p) gpa=%p, len=%d, flags=%x, next=%d\n", + tmp_desc, + (void *)(addr_t)(tmp_desc->addr_gpa), tmp_desc->length, tmp_desc->flags, tmp_desc->next); diff --git a/palacios/src/devices/lnx_virtio_sym.c b/palacios/src/devices/lnx_virtio_sym.c index 852709e..2cd3745 100644 --- a/palacios/src/devices/lnx_virtio_sym.c +++ b/palacios/src/devices/lnx_virtio_sym.c @@ -115,8 +115,9 @@ static int handle_kick(struct vm_device * dev) { addr_t page_addr; tmp_desc = &(q->desc[desc_idx]); - PrintDebug("Header Descriptor (ptr=%p) gpa=%p, len=%d, flags=%x, next=%d\n", tmp_desc, - (void *)(tmp_desc->addr_gpa), tmp_desc->length, + PrintDebug("Header Descriptor (ptr=%p) gpa=%p, len=%d, flags=%x, next=%d\n", + tmp_desc, + (void *)(addr_t)(tmp_desc->addr_gpa), tmp_desc->length, tmp_desc->flags, tmp_desc->next); diff --git a/palacios/src/devices/sym_swap2.c b/palacios/src/devices/sym_swap2.c index 3946636..f67ca85 100644 --- a/palacios/src/devices/sym_swap2.c +++ b/palacios/src/devices/sym_swap2.c @@ -571,7 +571,7 @@ static int connect_fn(struct guest_info * info, swap->active = 0; swap->cache_base_addr = (addr_t)V3_AllocPages(swap->cache_size / 4096); - swap->cache = (uint8_t *)V3_VAddr((void *)(swap->cache_base_addr)); + swap->cache = (uint8_t *)V3_VAddr((void *)(addr_t)(swap->cache_base_addr)); memset(swap->cache, 0, swap->cache_size); } diff --git a/palacios/src/palacios/vm_guest.c b/palacios/src/palacios/vm_guest.c index de0cb21..c2bb07d 100644 --- a/palacios/src/palacios/vm_guest.c +++ b/palacios/src/palacios/vm_guest.c @@ -310,7 +310,7 @@ void v3_print_stack(struct guest_info * info) { // We start i at one because the current stack pointer points to an unused stack element for (i = 0; i <= 24; i++) { if (cpu_mode == LONG) { - V3_Print("\t%p\n", (void *)*(uint64_t *)(host_addr + (i * 8))); + V3_Print("\t%p\n", (void *)*(addr_t *)(host_addr + (i * 8))); } else if (cpu_mode == REAL) { V3_Print("Don't currently handle 16 bit stacks... \n"); } else { diff --git a/palacios/src/palacios/vmm_sym_iface.c b/palacios/src/palacios/vmm_sym_iface.c index 8395955..fea864d 100644 --- a/palacios/src/palacios/vmm_sym_iface.c +++ b/palacios/src/palacios/vmm_sym_iface.c @@ -84,14 +84,14 @@ static int msr_write(uint_t msr, struct v3_msr src, void * priv_data) { struct v3_sym_state * state = &(info->sym_state); if (msr == SYM_PAGE_MSR) { - PrintDebug("Symbiotic MSR write for page %p\n", (void *)src.value); + PrintDebug("Symbiotic MSR write for page %p\n", (void *)(addr_t)src.value); if (state->active == 1) { // unmap page struct v3_shadow_region * old_reg = v3_get_shadow_region(info, (addr_t)state->guest_pg_addr); if (old_reg == NULL) { - PrintError("Could not find previously active symbiotic page (%p)\n", (void *)state->guest_pg_addr); + PrintError("Could not find previously active symbiotic page (%p)\n", (void *)(addr_t)state->guest_pg_addr); return -1; }