Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


matched extension file-naming conditions, changed a few ifdefs to match config files
[palacios.git] / palacios / src / extensions / vmm_mpi_accel.c
1 /* 
2  * This file is part of the Palacios Virtual Machine Monitor developed
3  * by the V3VEE Project with funding from the United States National 
4  * Science Foundation and the Department of Energy.  
5  *
6  * The V3VEE Project is a joint project between Northwestern University
7  * and the University of New Mexico.  You can find out more at 
8  * http://www.v3vee.org
9  *
10  * Copyright (c) 2011, Kyle C. Hale <kh@u.norhtwestern.edu>
11  * Copyright (c) 2011, The V3VEE Project <http://www.v3vee.org> 
12  * All rights reserved.
13  *
14  * Author: Kyle C. Hale <kh@u.northwestern.edu>
15  *
16  * This is free software.  You are permitted to use,
17  * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
18  */
19
20
21 #include <palacios/vmm.h>
22 #include <palacios/vm_guest.h>
23 #include <palacios/vmm_intr.h>
24 #include <palacios/vmm_syscall_hijack.h>
25 #include <palacios/vmm_mpi_accel.h>
26 #include <palacios/vmm_process_environment.h>
27 #include <palacios/vmm_execve_hook.h>
28
29
30 int v3_init_mpi_accel (struct guest_info * core) {
31     //binfile = "./envtest";
32     //args[1] = "LD_PRELOAD=./libcwrap.so";
33
34     v3_hook_swintr(core, 0x80, v3_syscall_handler, NULL);
35     v3_hook_syscall(core, 11, v3_sysexecve_handler, NULL);
36     v3_hook_executable(core, "./envtest", v3_mpi_preload_handler, NULL);
37
38     return 0;
39 }
40
41
42 int v3_deinit_mpi_accel (struct guest_info * core) {
43
44     return 0;
45 }
46
47
48 int v3_mpi_preload_handler (struct guest_info * core, void * priv_data) {
49
50     char * a[3];
51     a[0] = "TEST=HITHERE";
52     a[1] = "TEST2=/blah/blah/blah";
53     a[2] = "LD_PRELOAD=./libcwrap.so";
54
55     int ret = v3_inject_strings(core, (const char**)NULL, (const char**)a, 0, 3);
56     if (ret == -1) {
57         PrintDebug("Error injecting strings in execve handler\n");
58         return -1;
59     }
60
61     return 0;
62 }
63
64