Introduce execution domains in code and building
[archipelago] / xseg / sys / kernel / xsegmod.c
1 #include <linux/kernel.h>
2 #include <linux/types.h>
3 #include <linux/slab.h>
4 #include <linux/module.h>
5
6 #include <sys/domain.h>
7 #include <xq/domain.h>
8 #include <xseg/domain.h>
9
10 int (*xseg_snprintf)(char *str, size_t size, const char *format, ...) = snprintf;
11 EXPORT_SYMBOL(xseg_snprintf);
12
13 char __xseg_errbuf[4096];
14 EXPORT_SYMBOL(__xseg_errbuf);
15
16 static spinlock_t __lock;
17
18 void __lock_domain(void)
19 {
20         spin_lock_irq(&__lock);
21 }
22
23 void __unlock_domain(void)
24 {
25         spin_unlock_irq(&__lock);
26 }
27
28 void __load_plugin(const char *name)
29 {
30         return;
31 }
32
33 uint64_t __get_id(void)
34 {
35         return (uint64_t)1;
36 }
37
38 int __xseg_preinit(void)
39 {
40         return 0;
41 }
42
43 void __xseg_log(const char *msg)
44 {
45         (void)printk(KERN_INFO "%s\n", msg);
46 }
47 EXPORT_SYMBOL(__xseg_log);
48
49 void *xq_malloc(unsigned long size)
50 {
51         return kmalloc(size, GFP_KERNEL);
52 }
53
54 void xq_mfree(void *ptr)
55 {
56         return kfree(ptr);
57 }
58
59 static int __init xsegmod_init(void)
60 {
61         printk(KERN_INFO "xseg loaded");
62         return 0;
63 }
64
65 static void __exit xsegmod_exit(void)
66 {
67         printk(KERN_INFO "xseg unloaded");
68         return;
69 }
70
71 module_init(xsegmod_init);
72 module_exit(xsegmod_exit);
73
74 MODULE_DESCRIPTION("xseg");
75 MODULE_AUTHOR("XSEG");
76 MODULE_LICENSE("GPL");
77