aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/lguest
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/lguest')
-rw-r--r--drivers/lguest/lguest_user.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c
index 3b92a61ba8d2..c4bfe5a2b6b7 100644
--- a/drivers/lguest/lguest_user.c
+++ b/drivers/lguest/lguest_user.c
@@ -88,6 +88,18 @@ static ssize_t read(struct file *file, char __user *user, size_t size,loff_t*o)
88 return run_guest(lg, (unsigned long __user *)user); 88 return run_guest(lg, (unsigned long __user *)user);
89} 89}
90 90
91static int lg_cpu_start(struct lg_cpu *cpu, unsigned id, unsigned long start_ip)
92{
93 if (id >= NR_CPUS)
94 return -EINVAL;
95
96 cpu->id = id;
97 cpu->lg = container_of((cpu - id), struct lguest, cpus[0]);
98 cpu->lg->nr_cpus++;
99
100 return 0;
101}
102
91/*L:020 The initialization write supplies 4 pointer sized (32 or 64 bit) 103/*L:020 The initialization write supplies 4 pointer sized (32 or 64 bit)
92 * values (in addition to the LHREQ_INITIALIZE value). These are: 104 * values (in addition to the LHREQ_INITIALIZE value). These are:
93 * 105 *
@@ -134,6 +146,11 @@ static int initialize(struct file *file, const unsigned long __user *input)
134 lg->mem_base = (void __user *)(long)args[0]; 146 lg->mem_base = (void __user *)(long)args[0];
135 lg->pfn_limit = args[1]; 147 lg->pfn_limit = args[1];
136 148
149 /* This is the first cpu */
150 err = cpu_start(&lg->cpus[0], 0, args[3]);
151 if (err)
152 goto release_guest;
153
137 /* We need a complete page for the Guest registers: they are accessible 154 /* We need a complete page for the Guest registers: they are accessible
138 * to the Guest and we can only grant it access to whole pages. */ 155 * to the Guest and we can only grant it access to whole pages. */
139 lg->regs_page = get_zeroed_page(GFP_KERNEL); 156 lg->regs_page = get_zeroed_page(GFP_KERNEL);