diff options
Diffstat (limited to 'drivers/lguest/lg.h')
-rw-r--r-- | drivers/lguest/lg.h | 23 |
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 | |||
98 | extern struct mutex lguest_lock; | 98 | extern struct mutex lguest_lock; |
99 | 99 | ||
100 | /* core.c: */ | 100 | /* core.c: */ |
101 | u32 lgread_u32(struct lguest *lg, unsigned long addr); | ||
102 | void lgwrite_u32(struct lguest *lg, unsigned long addr, u32 val); | ||
103 | void lgread(struct lguest *lg, void *buf, unsigned long addr, unsigned len); | ||
104 | void lgwrite(struct lguest *lg, unsigned long, const void *buf, unsigned len); | ||
105 | int lguest_address_ok(const struct lguest *lg, | 101 | int lguest_address_ok(const struct lguest *lg, |
106 | unsigned long addr, unsigned long len); | 102 | unsigned long addr, unsigned long len); |
103 | void __lgread(struct lguest *, void *, unsigned long, unsigned); | ||
104 | void __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 | |||
107 | int run_guest(struct lguest *lg, unsigned long __user *user); | 122 | int 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 |