aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/lguest/core.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2015-02-11 15:15:09 +1030
committerRusty Russell <rusty@rustcorp.com.au>2015-02-11 16:47:29 +1030
commit18c137371b2ea86d263b75665a4904a0b8872990 (patch)
tree59f8e6bf9b43195b8d9d77fb3235468baeb8d946 /drivers/lguest/core.c
parentlguest: have --rng read from /dev/urandom not /dev/random. (diff)
downloadlinux-dev-18c137371b2ea86d263b75665a4904a0b8872990.tar.xz
linux-dev-18c137371b2ea86d263b75665a4904a0b8872990.zip
lguest: add operations to get/set a register from the Launcher.
We use the ptrace API struct, and we currently don't let them set anything but the normal registers (we'd have to filter the others). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/lguest/core.c')
-rw-r--r--drivers/lguest/core.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c
index 6590558d1d31..cdb2f9aa5860 100644
--- a/drivers/lguest/core.c
+++ b/drivers/lguest/core.c
@@ -208,6 +208,14 @@ void __lgwrite(struct lg_cpu *cpu, unsigned long addr, const void *b,
*/
int run_guest(struct lg_cpu *cpu, unsigned long __user *user)
{
+ /* If the launcher asked for a register with LHREQ_GETREG */
+ if (cpu->reg_read) {
+ if (put_user(*cpu->reg_read, user))
+ return -EFAULT;
+ cpu->reg_read = NULL;
+ return sizeof(*cpu->reg_read);
+ }
+
/* We stop running once the Guest is dead. */
while (!cpu->lg->dead) {
unsigned int irq;