$(CC) $(CFLAGS) -I../linux_module -fPIC -c v3_io_chan.c
$(CC) $(CFLAGS) -I../linux_module -fPIC -c v3_user_host_dev.c
$(CC) -shared -o $@ v3_io_chan.o v3_user_host_dev.o
- cp $@ /usr/lib64/
- cp v3_io_chan.h /usr/include/
+ -echo "Attempting install into system paths"
+ -cp $@ /usr/lib64/
+ -cp v3_io_chan.h /usr/include/
#
# JSON library for use in some tools
#
# Guarded module registration for GEARS
#
v3_register_gm: v3_register_gm.c libjson.a libv3_ctrl.a v3_ctrl.h
- $(CC) $(CFLAGS) $< -L. -lm -lv3_ctrl -ljson -o $@
+ $(CC) $(CFLAGS) $< -L. -lv3_ctrl -ljson -lm -o $@
#
# User keyed stream support includes a library and examples
# VNC support is compiled separately
#
v3_x0vncserver :
- @if [ -a x0vncserver ] ; \
+ @if [ -e x0vncserver ] ; \
then \
cp x0vncserver v3_x0vncserver ; \
else \
# GUI is compiled separately
#
v3_x0gui :
- @if [ -a gui/Palacios ] ; \
+ @if [ -e gui/Palacios ] ; \
then \
cp gui/Palacios v3_x0gui ; \
else \
/* store a hash of the file blob for integrity checking later */
hdrs[i].file_hash = v3_hash_buffer(faddr, files[i].size);
- printf("File Hash: %llx\n", hdrs[i].file_hash);
+ printf("File Hash: %lx\n", hdrs[i].file_hash);
close(fd);
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;
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) {
}
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);
}
sprintf(unbacked_region,"helloworldhelloworldhelloworld");
DEBUG_PRINT("unbacked_region ptr: %p contents: %s\n",unbacked_region,(char*)unbacked_region);
- DEBUG_PRINT("Vaddr : %p ; Paddr : %p\n", unbacked_region, vtop((uint64_t)unbacked_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))) {
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;
perror("Failed Syscall: ");
}
- DEBUG_PRINT("Device File: System call rc %d, errno %d\n",(int)sys_rc,sys_errno);
+ 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);
vm_idx = strtol(idx, NULL, 0);
- printf("Freeing VM %d\n", vm_idx);
+ printf("Freeing VM %lu\n", vm_idx);
if (v3_dev_ioctl(V3_FREE_GUEST, (void*)vm_idx) < 0) {
- fprintf(stderr, "Error freeing VM %d (%s)\n", vm_idx,argv[1]);
+ fprintf(stderr, "Error freeing VM %lu (%s)\n", vm_idx,argv[1]);
return -1;
}
fprintf(stderr,"Could not find number of regions for %s\n",vmdev);
return 0;
}
- if (sscanf(buf,"Regions: %llu (%llu shown)",&num_regions,&num_regions_shown)==2) {
+ if (sscanf(buf,"Regions: %lu (%lu shown)",&num_regions,&num_regions_shown)==2) {
break;
}
}
free(m);
return 0;
}
- if (sscanf(buf," region %d has HPAs %llx-%llx",&num,&start,&end)==3) {
+ if (sscanf(buf," region %lu has HPAs %lx-%lx",&num,&start,&end)==3) {
m->block[i].gpa = (void*)guest_cur;
m->block[i].hpa = (void*)start;
m->block[i].numpages = (end-start) / 4096 + !!((end-start) % 4096);
(off_t) (map->block[i].hpa));
if (map->block[i].uva == MAP_FAILED) {
- fprintf(stderr, "Failed to map block %llu\n",i);
+ fprintf(stderr, "Failed to map block %lu\n",i);
map->block[i].uva=0;
v3_unmap_guest_mem(map);
return -1;
return -1;
}
- if (sscanf(argv[3],"%llx",&gpa)!=1) {
+ if (sscanf(argv[3],"%lx",&gpa)!=1) {
fprintf(stderr,"Don't understand address %s\n",argv[3]);
return -1;
}
return -1;
}
- fprintf(stderr, "Write complete (%llu bytes)\n", numbytes);
+ fprintf(stderr, "Write complete (%lu bytes)\n", numbytes);
free(data);
}
}
- fprintf(stderr, "Read complete (%llu bytes)\n", numbytes);
+ fprintf(stderr, "Read complete (%lu bytes)\n", numbytes);
free(data);
return -1;
}
- fprintf(stderr, "Hash complete (%llu bytes), result is 0x%llx\n", numbytes, hash);
+ fprintf(stderr, "Hash complete (%lu bytes), result is 0x%lx\n", numbytes, hash);
break;
fprintf(fd,"Reset:\t%s\n",
s->reset_type==V3_MEM_TRACK_ONESHOT ? "oneshot" :
s->reset_type==V3_MEM_TRACK_PERIODIC ? "periodic" : "UNKNOWN");
- fprintf(fd,"Interval:\t%llu cycles\n", s->period);
+ fprintf(fd,"Interval:\t%lu cycles\n", s->period);
fprintf(fd,"Access:\t%s%s%s\n",
s->access_type&V3_MEM_TRACK_READ ? "r" : "",
s->access_type&V3_MEM_TRACK_WRITE ? "w" : "",
s->access_type&V3_MEM_TRACK_EXEC ? "x" : "");
- fprintf(fd,"Cores:\t%llu\n",s->num_cores);
- fprintf(fd,"Pages:\t%llu\n\n",s->core[0].num_pages);
+ fprintf(fd,"Cores:\t%u\n",s->num_cores);
+ fprintf(fd,"Pages:\t%lu\n\n",s->core[0].num_pages);
for (i=0;i<s->num_cores;i++) {
- fprintf(fd,"Core %llu (%llu to %llu, ",
+ fprintf(fd,"Core %lu (%lu to %lu, ",
i, s->core[i].start_time, s->core[i].end_time);
count=0;
for (j=0;j<s->core[i].num_pages;j++) {
count+=GET_BIT(s->core[i].access_bitmap,j);
}
- fprintf(fd," %llu pages touched) : ", count);
+ fprintf(fd," %lu pages touched) : ", count);
for (j=0;j<s->core[i].num_pages;j++) {
if (GET_BIT(s->core[i].access_bitmap,j)) {
fprintf(fd,"X");
// page allocation outside of the base regions
// note that the seed pools provide 2-4 MB chunks
// to start
-#define PALACIOS_MIN_ALLOC (64*4096)
+#define PALACIOS_MIN_ALLOC (64*4096ULL)
#define SYS_PATH "/sys/devices/system/memory/"
(PALACIOS_MIN_ALLOC!=0 && mem_size_bytes < PALACIOS_MIN_ALLOC)) {
EPRINTF("Trying to add a smaller single chunk of memory than Palacios needs\n"
"Your request: %llu bytes\n"
- "Palacios run-time memory block size: %llu bytes\n",
+ "Palacios run-time memory block size: %llu bytes\n"
"Palacios minimal contiguous alloc: %llu bytes\n",
mem_size_bytes, palacios_runtime_mem_block_size,
PALACIOS_MIN_ALLOC);
- VPRINTF("Trying to find %dMB (%d bytes) of memory above %llu with limit32=%d\n", mem_size_bytes/(1024*1024), mem_size_bytes, mem_min_start, limit32);
+ VPRINTF("Trying to find %lluMB (%llu bytes) of memory above %llu with limit32=%d\n", mem_size_bytes/(1024*1024), mem_size_bytes, mem_min_start, limit32);
/* Figure out the block size */
{
unsigned int block_size_bytes = 0;
int bitmap_entries = 0;
unsigned char * bitmap = NULL;
- int num_blocks = 0;
+ unsigned int num_blocks = 0;
int reg_start = 0;
int mem_ready = 0;
reg_start = base_addr / block_size_bytes;
- VPRINTF("That is %lu blocks of size %llu starting at block %d\n", num_blocks, block_size_bytes, reg_start);
+ VPRINTF("That is %u blocks of size %u starting at block %d\n", num_blocks, block_size_bytes, reg_start);
cmd.gpa = strtoll(argv[2],0,16);
cmd.pcore_id = atoi(argv[3]);
- printf("Migrating memory region of %p to memory with affinity for physical CPU %d\n", cmd.gpa, cmd.pcore_id);
+ printf("Migrating memory region of %p to memory with affinity for physical CPU %d\n", (void*)cmd.gpa, cmd.pcore_id);
vm_fd = open(vm_dev, O_RDONLY);
return -1;
}
- printf("Simulating VM for %lu msecs\n", msecs);
+ printf("Simulating VM for %u msecs\n", msecs);
vm_fd = open(filename, O_RDONLY);
sint64_t datalen = req->buf_len - req->data_off;
if (datalen != req->xfer) {
- fprintf(stderr,"Odd, xfer=%lld but datalen computed is %lld\n",req->xfer,datalen);
+ fprintf(stderr,"Odd, xfer=%ld but datalen computed is %ld\n",req->xfer,datalen);
if (datalen > req->xfer) {
datalen = req->xfer;
}
if (rc!=taglen) {
// failed to write tag, lets report as negative error
- fprintf(stderr,"Failed to write tag (taglen=%lld, rc=%d)\n",taglen,rc);
+ fprintf(stderr,"Failed to write tag (taglen=%ld, rc=%d)\n",taglen,rc);
rc = -1;
} else {
// Write data
rc = write_all(fd,req->buf+taglen,datalen);
if (rc!=datalen) {
- fprintf(stderr,"Failed to write data (datalen=%lld, rc=%d)\n",datalen,rc);
+ fprintf(stderr,"Failed to write data (datalen=%ld, rc=%d)\n",datalen,rc);
}
}
if (rc!=taglen) {
// Error
- fprintf(stderr,"Failed to read tag (taglen=%lld, rc=%d)\n",taglen,rc);
+ fprintf(stderr,"Failed to read tag (taglen=%ld, rc=%d)\n",taglen,rc);
rc = -1;
} else {
// tag check