X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=linux_usr%2Fv3_devfile_shadow.c;h=65d9a29d911c1f2dd8645910df5a9788a5bded86;hb=564dade4aee58eb392b960dd33823b5e030869ac;hp=dc4cddc952c99a4f801824f42a8e94dd0538b6de;hpb=4a7e01a6d71dcfb0ecf19ca4271f195a654a94ca;p=palacios.git diff --git a/linux_usr/v3_devfile_shadow.c b/linux_usr/v3_devfile_shadow.c index dc4cddc..65d9a29 100644 --- a/linux_usr/v3_devfile_shadow.c +++ b/linux_usr/v3_devfile_shadow.c @@ -52,7 +52,7 @@ static inline uint64_t get_uva_from_gpa(struct v3_guest_mem_map *map, uint64_t g for (i=0; i< map->numblocks; i++) { if(gpa < (uint64_t)map->block[i].gpa){ offset = gpa - prev_gpa; - DEBUG_PRINT("gpa %llx, prev_gpa %llx, offset %llx, res %llx\n",gpa,prev_gpa,offset,prev_uva+offset); + DEBUG_PRINT("gpa %lx, prev_gpa %lx, offset %lx, res %lx\n",gpa,prev_gpa,offset,prev_uva+offset); return prev_uva+offset; } prev_uva = (uint64_t)map->block[i].uva; @@ -142,7 +142,7 @@ static uint64_t vtop(uint64_t vaddr) uint64_t e; char addr[80]; sprintf(addr,"/proc/%d/pagemap", getpid()); - DEBUG_PRINT("Page size : %d, Offset: %d, In vtop",sysconf(_SC_PAGESIZE),offset); + DEBUG_PRINT("Page size : %ld, Offset: %lu, In vtop",sysconf(_SC_PAGESIZE),offset); // https://www.kernel.org/doc/Documentation/vm/pagemap.txt if ((pagemap = fopen(addr, "r"))) { if (lseek(fileno(pagemap), offset, SEEK_SET) == offset) { @@ -191,7 +191,6 @@ int main(int argc, char** argv) uint64_t sys_rc, sys_errno, sys_code, a1,a2,a3,a4,a5,a6, bit_vec; int host_mod_fd, fd_shared, i, val; long long zero = 0; - void* region; void* unbacked_region; fd_set readset; int select_rc; @@ -215,7 +214,7 @@ int main(int argc, char** argv) } for (i=0; i< map->numblocks; i++) { - DEBUG_PRINT("Region %llu: gpa=%p, hpa=%p, uva=%p, numpages=%llu\n", + DEBUG_PRINT("Region %d: gpa=%p, hpa=%p, uva=%p, numpages=%lu\n", i, map->block[i].gpa, map->block[i].hpa,map->block[i].uva, map->block[i].numpages); } @@ -236,8 +235,8 @@ int main(int argc, char** argv) sprintf(unbacked_region,"helloworldhelloworldhelloworld"); DEBUG_PRINT("unbacked_region ptr: %p contents: %s\n",unbacked_region,(char*)unbacked_region); - DEBUG_PRINT("Vadrr : %p ; Paddr : %p\n", unbacked_region, vtop((uint64_t)unbacked_region)); - DEBUG_PRINT("Persisting as a userspace for VM %s with address %p\n",argv[1], region); + DEBUG_PRINT("Vaddr : %p ; Paddr : %p\n", (void*)unbacked_region, (void*)vtop((uint64_t)unbacked_region)); + DEBUG_PRINT("Persisting as a userspace for VM %s with address %p\n",argv[1], unbacked_region); if (ioctl(host_mod_fd,INIT_IOCTL,vtop((uint64_t)unbacked_region))) { perror("init ioctl"); @@ -265,12 +264,12 @@ int main(int argc, char** argv) load_args_from_shared_page((uint64_t*)unbacked_region,&sys_code,&a1,&a2,&a3,&a4,&a5,&a6,&bit_vec); //Extract Guest pointer arguments and map them to current userspace - DEBUG_PRINT("About to deref args\nsys_code: %016llu, a1: %016llu, a2: %016llu,\na3: %016llu,a4: %016llu,a5: %016llu,a6: %016llu,bit_vec: %016llu\n", sys_code, a1, a2, a3,a4,a5,a6,bit_vec); + DEBUG_PRINT("About to deref args\nsys_code: %016lu, a1: %016lu, a2: %016lu,\na3: %016lu,a4: %016lu,a5: %016lu,a6: %016lu,bit_vec: %016lu\n", sys_code, a1, a2, a3,a4,a5,a6,bit_vec); // swizzle pointers from their GPAs to their HVAs deref_args(map,&a1,&a2,&a3,&a4,&a5,&a6,bit_vec); - DEBUG_PRINT("Derefed args\nsys_code: %016llu, a1: %016llu, a2: %016llu,\na3: %016llu,a4: %016llu,a5: %016llu,a6: %016llu,bit_vec: %016llu\n", sys_code, a1, a2, a3,a4,a5,a6,bit_vec); + DEBUG_PRINT("Derefed args\nsys_code: %016lu, a1: %016lu, a2: %016lu,\na3: %016lu,a4: %016lu,a5: %016lu,a6: %016lu,bit_vec: %016lu\n", sys_code, a1, a2, a3,a4,a5,a6,bit_vec); sys_rc = syscall(sys_code,a1,a2,a3,a4,a5,a6); sys_errno = errno; @@ -279,7 +278,7 @@ int main(int argc, char** argv) perror("Failed Syscall: "); } - DEBUG_PRINT("Device File: System call rc %d, %016llu %016llx %016lld\n",(int)sys_rc,sys_rc); + DEBUG_PRINT("Device File: System call rc %d, errno %lu\n",(int)sys_rc,sys_errno); //put return value into shared region store_args_to_shared_page((uint64_t*)unbacked_region, &sys_rc, &sys_errno);