aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/lguest/lg.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/lguest/lg.h')
-rw-r--r--drivers/lguest/lg.h23
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h
index 4d45b7036e82..d9144beca82c 100644
--- a/drivers/lguest/lg.h
+++ b/drivers/lguest/lg.h
@@ -98,12 +98,27 @@ struct lguest
98extern struct mutex lguest_lock; 98extern struct mutex lguest_lock;
99 99
100/* core.c: */ 100/* core.c: */
101u32 lgread_u32(struct lguest *lg, unsigned long addr);
102void lgwrite_u32(struct lguest *lg, unsigned long addr, u32 val);
103void lgread(struct lguest *lg, void *buf, unsigned long addr, unsigned len);
104void lgwrite(struct lguest *lg, unsigned long, const void *buf, unsigned len);
105int lguest_address_ok(const struct lguest *lg, 101int lguest_address_ok(const struct lguest *lg,
106 unsigned long addr, unsigned long len); 102 unsigned long addr, unsigned long len);
103void __lgread(struct lguest *, void *, unsigned long, unsigned);
104void __lgwrite(struct lguest *, unsigned long, const void *, unsigned);
105
106/*L:306 Using memory-copy operations like that is usually inconvient, so we
107 * have the following helper macros which read and write a specific type (often
108 * an unsigned long).
109 *
110 * This reads into a variable of the given type then returns that. */
111#define lgread(lg, addr, type) \
112 ({ type _v; __lgread((lg), &_v, (addr), sizeof(_v)); _v; })
113
114/* This checks that the variable is of the given type, then writes it out. */
115#define lgwrite(lg, addr, type, val) \
116 do { \
117 typecheck(type, val); \
118 __lgwrite((lg), (addr), &(val), sizeof(val)); \
119 } while(0)
120/* (end of memory access helper routines) :*/
121
107int run_guest(struct lguest *lg, unsigned long __user *user); 122int run_guest(struct lguest *lg, unsigned long __user *user);
108 123
109/* Helper macros to obtain the first 12 or the last 20 bits, this is only the 124/* Helper macros to obtain the first 12 or the last 20 bits, this is only the