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.


Paranoid error checking in userspace utils
[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 static int inject_mce(struct v3_guest * guest, unsigned int cmd, unsigned long arg,
21                       void * priv_data)
22 {
23     unsigned long type = (unsigned long)priv_data;
24     switch ( type ) {
25         case SCRUBBER_MCE:
26             return v3_mcheck_inject_scrubber_mce((struct v3_vm_info *)guest->v3_ctx, 0, arg);
27             break;
28         default:
29             // TODO: How to print an error in the host OS?
30             //PrintError("Injection of unknown machine check type %lu requested.\n", type);
31             return -1;
32             break;
33     }
34 }
35
36 static int guest_init(struct v3_guest * guest, void ** vm_data) {
37
38     add_guest_ctrl(guest, V3_VM_INJECT_SCRUBBER_MCE, inject_mce, (void *)SCRUBBER_MCE);
39     return 0;
40 }
41
42 static int guest_deinit(struct v3_guest * guest, void * vm_data) {
43     
44     return 0;
45 }
46
47
48 struct linux_ext mcheck_ext = {
49     .name = "MACHINE CHECK",
50     .init = NULL,
51     .deinit = NULL,
52     .guest_init = guest_init, 
53     .guest_deinit = guest_deinit
54 };
55
56
57 register_extension(&mcheck_ext);