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;
}
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);
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);
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);
}
// 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 {
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;
}