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.


Cleanup of linkage issues for non-Linux hosts
[palacios.git] / linux_module / mcheck.c
1 /* 
2  * DebugFS interface
3  * (c) Patrick Bridges and Philip Soltero, 2011
4  */
5
6 #include <linux/kernel.h>
7 #include <linux/fs.h>
8 #include <linux/debugfs.h>
9 #include <linux/uaccess.h>
10
11 //#include <interfaces/vmm_mcheck.h>
12
13 #include "palacios.h"
14 #include "vm.h"
15 #include "linux-exts.h"
16
17 #define SCRUBBER_MCE 0x1
18 #define V3_VM_INJECT_SCRUBBER_MCE (10224+20)
19
20 /* Missing the vmm_mcheck.h header file */
21
22 struct v3_vm_info;
23
24 int v3_mcheck_inject_scrubber_mce(struct v3_vm_info *info, int cpu, uint64_t dst);
25
26 static int inject_mce(struct v3_guest * guest, unsigned int cmd, unsigned long arg,
27                       void * priv_data)
28 {
29     unsigned long type = (unsigned long)priv_data;
30     switch ( type ) {
31         case SCRUBBER_MCE:
32             return v3_mcheck_inject_scrubber_mce((struct v3_vm_info *)guest->v3_ctx, 0, arg);
33             break;
34         default:
35             // TODO: How to print an error in the host OS?
36             //PrintError("Injection of unknown machine check type %lu requested.\n", type);
37             return -1;
38             break;
39     }
40 }
41
42 static int guest_init(struct v3_guest * guest, void ** vm_data) {
43
44     add_guest_ctrl(guest, V3_VM_INJECT_SCRUBBER_MCE, inject_mce, (void *)SCRUBBER_MCE);
45     return 0;
46 }
47
48 static int guest_deinit(struct v3_guest * guest, void * vm_data) {
49     
50     remove_guest_ctrl(guest, V3_VM_INJECT_SCRUBBER_MCE);
51     return 0;
52 }
53
54 static int all_deinit(void)
55 {
56     // nothing to do
57     return 0;
58 }
59
60
61 struct linux_ext mcheck_ext = {
62     .name = "MACHINE CHECK",
63     .init = NULL,
64     .deinit = all_deinit,
65     .guest_init = guest_init, 
66     .guest_deinit = guest_deinit
67 };
68
69
70 register_extension(&mcheck_ext);