...
 
Commits (2)
......@@ -12,22 +12,23 @@ VERSION_CMD=$(PWD)/version
obj-m += pisces.o
pisces-objs := src/main.o \
src/pisces_boot_params.o \
src/boot.o \
src/enclave_cons.o \
src/enclave_ctrl.o \
src/enclave_fs.o \
src/enclave.o \
src/pisces_lcall.o \
src/pisces_xbuf.o \
src/pisces_lock.o \
src/pisces_ringbuf.o \
src/file_io.o \
src/launch_code.o \
src/pgtables.o \
src/util-hashtable.o \
src/util-queue.o \
pisces-objs := src/main.o \
src/pisces_boot_params.o \
src/boot.o \
src/covirt.o \
src/enclave_cons.o \
src/enclave_ctrl.o \
src/enclave_fs.o \
src/enclave.o \
src/pisces_lcall.o \
src/pisces_xbuf.o \
src/pisces_lock.o \
src/pisces_ringbuf.o \
src/file_io.o \
src/launch_code.o \
src/pgtables.o \
src/util-hashtable.o \
src/util-queue.o \
src/v3_console.o
ifneq ($(XPMEM),n)
......
......@@ -9,22 +9,23 @@ libs := libpisces.a
ext_libs := $(PETLIB_PATH)/petlib.a
execs := pisces_load \
pisces_launch \
pisces_shutdown \
pisces_add \
pisces_cons \
pisces_reset \
pisces_run \
pisces_load_file \
v3_create \
v3_free \
v3_launch \
v3_stop \
v3_cons_sc \
v3_cons_nosc \
v3_dbg \
v3_pci \
execs := pisces_load \
pisces_launch \
pisces_shutdown \
pisces_add \
pisces_cons \
pisces_reset \
pisces_run \
pisces_load_file \
pisces_load_vmm \
v3_create \
v3_free \
v3_launch \
v3_stop \
v3_cons_sc \
v3_cons_nosc \
v3_dbg \
v3_pci \
libpisces-objs := pisces.o pisces_ctrl.o teardown.o
......
......@@ -68,6 +68,30 @@ pisces_load(char * kern,
}
int
pisces_load_vmm(char * vmm_path)
{
int vmm_fd = 0;
int ret = 0;
vmm_fd = open(vmm_path, O_RDONLY);
if (vmm_fd == -1) {
printf("Error: Could not find VMM Image at (%s)\n", vmm_path);
return -1;
}
ret = pet_ioctl_path("/dev/" DEVICE_NAME, PISCES_LOAD_VMM, (void *)(uintptr_t)vmm_fd);
if (ret < 0) {
printf("Error: could not load VMM into pisces\n");
return -1;
}
return 0;
}
int
pisces_launch(int pisces_id,
int numa_zone,
......
......@@ -37,6 +37,8 @@ int pisces_free(int pisces_id);
int pisces_teardown(int pisces_id, int online_cpus, int online_mem);
int pisces_load_vmm(char * vmm_path);
static inline char *
get_pisces_dev_path(int pisces_id)
{
......
/*
* Copyright (c) 2013, Jack Lange <jacklange@cs.pitt.edu>
* All rights reserved.
*
* This is free software. You are permitted to use,
* redistribute, and modify it as specified in the file "PETLAB_LICENSE".
*/
#include <stdio.h>
#include "pisces.h"
int main(int argc, char ** argv) {
char * vmm_path = argv[1];
int ret = 0;
ret = pisces_load_vmm(vmm_path);
if (ret == 0) {
printf("VMM Loaded\n");
}
return ret;
}
/*
* Copyright (c) 2018, Jack Lange <jacklange@cs.pitt.edu>
* All rights reserved.
*
* This is free software. You are permitted to use,
* redistribute, and modify it as specified in the file "PETLAB_LICENSE".
*/
#include <linux/fs.h>
#include <linux/file.h>
#include <linux/slab.h>
#include "covirt.h"
#include "file_io.h"
static int vmm_loaded = 0;
static void * vmm_binary = NULL;
static u32 vmm_binary_size = 0;
int
covirt_load_vmm(int vmm_fd)
{
struct file * vmm_file = fget(vmm_fd);
u64 bytes_read = 0;
int ret = 0;
vmm_binary_size = file_size(vmm_file);
vmm_binary = kmalloc(vmm_binary_size, GFP_KERNEL);
while (bytes_read < vmm_binary_size) {
ret = file_read(vmm_file,
(void *)(vmm_binary + bytes_read),
vmm_binary_size - bytes_read,
bytes_read);
if (ret <= 0) {
printk(KERN_ERR "Error reading VMM binary. Only read %llu bytes.\n",
bytes_read);
goto err;
}
}
fput(vmm_file);
vmm_loaded = 1;
return 0;
err:
if (vmm_binary) kfree(vmm_binary);
vmm_binary_size = 0;
return -1;
}
u32
covirt_get_vmm_state(void)
{
if (vmm_loaded == 0) {
return 0;
}
return vmm_binary_size;
}
uintptr_t
covirt_get_vmm_addr(void)
{
if (vmm_loaded == 0) {
return (uintptr_t)0;
}
return (uintptr_t)vmm_binary;
}
/*
* Copyright (c) 2018, Jack Lange <jacklange@cs.pitt.edu>
* All rights reserved.
*
* This is free software. You are permitted to use,
* redistribute, and modify it as specified in the file "PETLAB_LICENSE".
*/
#ifndef __COVIRT_H__
#define __COVIRT_H__
#include <linux/types.h>
int
covirt_load_vmm(int vmm_fd);
u32 covirt_get_vmm_size(void);
uintptr_t covirt_get_vmm_addr(void);
#endif
......@@ -145,6 +145,13 @@ device_ioctl(struct file * file,
break;
}
case PISCES_LOAD_VMM: {
int fd = arg;
}
default:
printk(KERN_ERR "Invalid Pisces IOCTL: %d\n", ioctl);
return -EINVAL;
......
......@@ -62,7 +62,7 @@ load_kernel(struct pisces_enclave * enclave,
if (ret <= 0) {
printk(KERN_ERR "Error reading kernel image. Only read %llu bytes.\n", bytes_read);
file_close(kern_image);
//file_close(kern_image);
return -1;
}
......@@ -99,7 +99,7 @@ load_initrd(struct pisces_enclave * enclave,
if (ret <= 0) {
printk(KERN_ERR "Error reading initrd. Only read %llu bytes.\n", bytes_read);
file_close(initrd_image);
//file_close(initrd_image);
return -1;
}
......
......@@ -20,6 +20,7 @@
/* Pisces global cmds */
#define PISCES_LOAD_IMAGE 1001
#define PISCES_FREE_ENCLAVE 1003
#define PISCES_LOAD_VMM 1010
/* Pisces enclave cmds */
#define PISCES_ENCLAVE_LAUNCH 2000
......