aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlauber de Oliveira Costa <gcosta@redhat.com>2008-01-07 08:05:32 -0500
committerRusty Russell <rusty@rustcorp.com.au>2008-01-30 06:50:11 -0500
commita53a35a8b485b9c16b73e5177bddaa4321971199 (patch)
tree8ed96838cb47d1263f63aba6dd6921b3c811f46c
parenta3863f68b0d7fe2073c0f4efe534ec87a685c4fa (diff)
lguest: make registers per-vcpu
This is the most obvious per-vcpu field: registers. So this patch moves it from struct lguest to struct vcpu, and patch the places in which they are used, accordingly Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r--drivers/lguest/interrupts_and_traps.c28
-rw-r--r--drivers/lguest/lg.h9
-rw-r--r--drivers/lguest/lguest_user.c37
-rw-r--r--drivers/lguest/page_tables.c4
-rw-r--r--drivers/lguest/x86/core.c38
5 files changed, 60 insertions, 56 deletions
diff --git a/drivers/lguest/interrupts_and_traps.c b/drivers/lguest/interrupts_and_traps.c
index 8f59232f458b..468faf8233d6 100644
--- a/drivers/lguest/interrupts_and_traps.c
+++ b/drivers/lguest/interrupts_and_traps.c
@@ -70,7 +70,7 @@ static void set_guest_interrupt(struct lg_cpu *cpu, u32 lo, u32 hi, int has_err)
70 /* There are two cases for interrupts: one where the Guest is already 70 /* There are two cases for interrupts: one where the Guest is already
71 * in the kernel, and a more complex one where the Guest is in 71 * in the kernel, and a more complex one where the Guest is in
72 * userspace. We check the privilege level to find out. */ 72 * userspace. We check the privilege level to find out. */
73 if ((lg->regs->ss&0x3) != GUEST_PL) { 73 if ((cpu->regs->ss&0x3) != GUEST_PL) {
74 /* The Guest told us their kernel stack with the SET_STACK 74 /* The Guest told us their kernel stack with the SET_STACK
75 * hypercall: both the virtual address and the segment */ 75 * hypercall: both the virtual address and the segment */
76 virtstack = lg->esp1; 76 virtstack = lg->esp1;
@@ -81,12 +81,12 @@ static void set_guest_interrupt(struct lg_cpu *cpu, u32 lo, u32 hi, int has_err)
81 * stack: when the Guest does an "iret" back from the interrupt 81 * stack: when the Guest does an "iret" back from the interrupt
82 * handler the CPU will notice they're dropping privilege 82 * handler the CPU will notice they're dropping privilege
83 * levels and expect these here. */ 83 * levels and expect these here. */
84 push_guest_stack(lg, &gstack, lg->regs->ss); 84 push_guest_stack(lg, &gstack, cpu->regs->ss);
85 push_guest_stack(lg, &gstack, lg->regs->esp); 85 push_guest_stack(lg, &gstack, cpu->regs->esp);
86 } else { 86 } else {
87 /* We're staying on the same Guest (kernel) stack. */ 87 /* We're staying on the same Guest (kernel) stack. */
88 virtstack = lg->regs->esp; 88 virtstack = cpu->regs->esp;
89 ss = lg->regs->ss; 89 ss = cpu->regs->ss;
90 90
91 origstack = gstack = guest_pa(lg, virtstack); 91 origstack = gstack = guest_pa(lg, virtstack);
92 } 92 }
@@ -95,7 +95,7 @@ static void set_guest_interrupt(struct lg_cpu *cpu, u32 lo, u32 hi, int has_err)
95 * the "Interrupt Flag" bit is always set. We copy that bit from the 95 * the "Interrupt Flag" bit is always set. We copy that bit from the
96 * Guest's "irq_enabled" field into the eflags word: we saw the Guest 96 * Guest's "irq_enabled" field into the eflags word: we saw the Guest
97 * copy it back in "lguest_iret". */ 97 * copy it back in "lguest_iret". */
98 eflags = lg->regs->eflags; 98 eflags = cpu->regs->eflags;
99 if (get_user(irq_enable, &lg->lguest_data->irq_enabled) == 0 99 if (get_user(irq_enable, &lg->lguest_data->irq_enabled) == 0
100 && !(irq_enable & X86_EFLAGS_IF)) 100 && !(irq_enable & X86_EFLAGS_IF))
101 eflags &= ~X86_EFLAGS_IF; 101 eflags &= ~X86_EFLAGS_IF;
@@ -104,19 +104,19 @@ static void set_guest_interrupt(struct lg_cpu *cpu, u32 lo, u32 hi, int has_err)
104 * "eflags" word, the old code segment, and the old instruction 104 * "eflags" word, the old code segment, and the old instruction
105 * pointer. */ 105 * pointer. */
106 push_guest_stack(lg, &gstack, eflags); 106 push_guest_stack(lg, &gstack, eflags);
107 push_guest_stack(lg, &gstack, lg->regs->cs); 107 push_guest_stack(lg, &gstack, cpu->regs->cs);
108 push_guest_stack(lg, &gstack, lg->regs->eip); 108 push_guest_stack(lg, &gstack, cpu->regs->eip);
109 109
110 /* For the six traps which supply an error code, we push that, too. */ 110 /* For the six traps which supply an error code, we push that, too. */
111 if (has_err) 111 if (has_err)
112 push_guest_stack(lg, &gstack, lg->regs->errcode); 112 push_guest_stack(lg, &gstack, cpu->regs->errcode);
113 113
114 /* Now we've pushed all the old state, we change the stack, the code 114 /* Now we've pushed all the old state, we change the stack, the code
115 * segment and the address to execute. */ 115 * segment and the address to execute. */
116 lg->regs->ss = ss; 116 cpu->regs->ss = ss;
117 lg->regs->esp = virtstack + (gstack - origstack); 117 cpu->regs->esp = virtstack + (gstack - origstack);
118 lg->regs->cs = (__KERNEL_CS|GUEST_PL); 118 cpu->regs->cs = (__KERNEL_CS|GUEST_PL);
119 lg->regs->eip = idt_address(lo, hi); 119 cpu->regs->eip = idt_address(lo, hi);
120 120
121 /* There are two kinds of interrupt handlers: 0xE is an "interrupt 121 /* There are two kinds of interrupt handlers: 0xE is an "interrupt
122 * gate" which expects interrupts to be disabled on entry. */ 122 * gate" which expects interrupts to be disabled on entry. */
@@ -157,7 +157,7 @@ void maybe_do_interrupt(struct lg_cpu *cpu)
157 157
158 /* They may be in the middle of an iret, where they asked us never to 158 /* They may be in the middle of an iret, where they asked us never to
159 * deliver interrupts. */ 159 * deliver interrupts. */
160 if (lg->regs->eip >= lg->noirq_start && lg->regs->eip < lg->noirq_end) 160 if (cpu->regs->eip >= lg->noirq_start && cpu->regs->eip < lg->noirq_end)
161 return; 161 return;
162 162
163 /* If they're halted, interrupts restart them. */ 163 /* If they're halted, interrupts restart them. */
diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h
index 072d0d4fd0b9..35b331230c55 100644
--- a/drivers/lguest/lg.h
+++ b/drivers/lguest/lg.h
@@ -44,6 +44,10 @@ struct lg_cpu {
44 unsigned int id; 44 unsigned int id;
45 struct lguest *lg; 45 struct lguest *lg;
46 46
47 /* At end of a page shared mapped over lguest_pages in guest. */
48 unsigned long regs_page;
49 struct lguest_regs *regs;
50
47 /* If a hypercall was asked for, this points to the arguments. */ 51 /* If a hypercall was asked for, this points to the arguments. */
48 struct hcall_args *hcall; 52 struct hcall_args *hcall;
49 u32 next_hcall; 53 u32 next_hcall;
@@ -58,9 +62,6 @@ struct lg_cpu {
58/* The private info the thread maintains about the guest. */ 62/* The private info the thread maintains about the guest. */
59struct lguest 63struct lguest
60{ 64{
61 /* At end of a page shared mapped over lguest_pages in guest. */
62 unsigned long regs_page;
63 struct lguest_regs *regs;
64 struct lguest_data __user *lguest_data; 65 struct lguest_data __user *lguest_data;
65 struct task_struct *tsk; 66 struct task_struct *tsk;
66 struct mm_struct *mm; /* == tsk->mm, but that becomes NULL on exit */ 67 struct mm_struct *mm; /* == tsk->mm, but that becomes NULL on exit */
@@ -181,7 +182,7 @@ void lguest_arch_run_guest(struct lg_cpu *cpu);
181void lguest_arch_handle_trap(struct lg_cpu *cpu); 182void lguest_arch_handle_trap(struct lg_cpu *cpu);
182int lguest_arch_init_hypercalls(struct lg_cpu *cpu); 183int lguest_arch_init_hypercalls(struct lg_cpu *cpu);
183int lguest_arch_do_hcall(struct lg_cpu *cpu, struct hcall_args *args); 184int lguest_arch_do_hcall(struct lg_cpu *cpu, struct hcall_args *args);
184void lguest_arch_setup_regs(struct lguest *lg, unsigned long start); 185void lguest_arch_setup_regs(struct lg_cpu *cpu, unsigned long start);
185 186
186/* <arch>/switcher.S: */ 187/* <arch>/switcher.S: */
187extern char start_switcher_text[], end_switcher_text[], switch_to_guest[]; 188extern char start_switcher_text[], end_switcher_text[], switch_to_guest[];
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c
index 605db5c49e7f..d21d95b2b1fc 100644
--- a/drivers/lguest/lguest_user.c
+++ b/drivers/lguest/lguest_user.c
@@ -106,6 +106,19 @@ static int lg_cpu_start(struct lg_cpu *cpu, unsigned id, unsigned long start_ip)
106 cpu->lg->nr_cpus++; 106 cpu->lg->nr_cpus++;
107 init_clockdev(cpu); 107 init_clockdev(cpu);
108 108
109 /* We need a complete page for the Guest registers: they are accessible
110 * to the Guest and we can only grant it access to whole pages. */
111 cpu->regs_page = get_zeroed_page(GFP_KERNEL);
112 if (!cpu->regs_page)
113 return -ENOMEM;
114
115 /* We actually put the registers at the bottom of the page. */
116 cpu->regs = (void *)cpu->regs_page + PAGE_SIZE - sizeof(*cpu->regs);
117
118 /* Now we initialize the Guest's registers, handing it the start
119 * address. */
120 lguest_arch_setup_regs(cpu, start_ip);
121
109 return 0; 122 return 0;
110} 123}
111 124
@@ -160,16 +173,6 @@ static int initialize(struct file *file, const unsigned long __user *input)
160 if (err) 173 if (err)
161 goto release_guest; 174 goto release_guest;
162 175
163 /* We need a complete page for the Guest registers: they are accessible
164 * to the Guest and we can only grant it access to whole pages. */
165 lg->regs_page = get_zeroed_page(GFP_KERNEL);
166 if (!lg->regs_page) {
167 err = -ENOMEM;
168 goto release_guest;
169 }
170 /* We actually put the registers at the bottom of the page. */
171 lg->regs = (void *)lg->regs_page + PAGE_SIZE - sizeof(*lg->regs);
172
173 /* Initialize the Guest's shadow page tables, using the toplevel 176 /* Initialize the Guest's shadow page tables, using the toplevel
174 * address the Launcher gave us. This allocates memory, so can 177 * address the Launcher gave us. This allocates memory, so can
175 * fail. */ 178 * fail. */
@@ -177,10 +180,6 @@ static int initialize(struct file *file, const unsigned long __user *input)
177 if (err) 180 if (err)
178 goto free_regs; 181 goto free_regs;
179 182
180 /* Now we initialize the Guest's registers, handing it the start
181 * address. */
182 lguest_arch_setup_regs(lg, args[3]);
183
184 /* We keep a pointer to the Launcher task (ie. current task) for when 183 /* We keep a pointer to the Launcher task (ie. current task) for when
185 * other Guests want to wake this one (inter-Guest I/O). */ 184 * other Guests want to wake this one (inter-Guest I/O). */
186 lg->tsk = current; 185 lg->tsk = current;
@@ -205,7 +204,8 @@ static int initialize(struct file *file, const unsigned long __user *input)
205 return sizeof(args); 204 return sizeof(args);
206 205
207free_regs: 206free_regs:
208 free_page(lg->regs_page); 207 /* FIXME: This should be in free_vcpu */
208 free_page(lg->cpus[0].regs_page);
209release_guest: 209release_guest:
210 kfree(lg); 210 kfree(lg);
211unlock: 211unlock:
@@ -280,9 +280,12 @@ static int close(struct inode *inode, struct file *file)
280 /* We need the big lock, to protect from inter-guest I/O and other 280 /* We need the big lock, to protect from inter-guest I/O and other
281 * Launchers initializing guests. */ 281 * Launchers initializing guests. */
282 mutex_lock(&lguest_lock); 282 mutex_lock(&lguest_lock);
283 for (i = 0; i < lg->nr_cpus; i++) 283 for (i = 0; i < lg->nr_cpus; i++) {
284 /* Cancels the hrtimer set via LHCALL_SET_CLOCKEVENT. */ 284 /* Cancels the hrtimer set via LHCALL_SET_CLOCKEVENT. */
285 hrtimer_cancel(&lg->cpus[i].hrt); 285 hrtimer_cancel(&lg->cpus[i].hrt);
286 /* We can free up the register page we allocated. */
287 free_page(lg->cpus[i].regs_page);
288 }
286 /* Free up the shadow page tables for the Guest. */ 289 /* Free up the shadow page tables for the Guest. */
287 free_guest_pagetable(lg); 290 free_guest_pagetable(lg);
288 /* Now all the memory cleanups are done, it's safe to release the 291 /* Now all the memory cleanups are done, it's safe to release the
@@ -292,8 +295,6 @@ static int close(struct inode *inode, struct file *file)
292 * kmalloc()ed string, either of which is ok to hand to kfree(). */ 295 * kmalloc()ed string, either of which is ok to hand to kfree(). */
293 if (!IS_ERR(lg->dead)) 296 if (!IS_ERR(lg->dead))
294 kfree(lg->dead); 297 kfree(lg->dead);
295 /* We can free up the register page we allocated. */
296 free_page(lg->regs_page);
297 /* We clear the entire structure, which also marks it as free for the 298 /* We clear the entire structure, which also marks it as free for the
298 * next user. */ 299 * next user. */
299 memset(lg, 0, sizeof(*lg)); 300 memset(lg, 0, sizeof(*lg));
diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c
index 17d3329e34c2..f19add469944 100644
--- a/drivers/lguest/page_tables.c
+++ b/drivers/lguest/page_tables.c
@@ -640,6 +640,7 @@ void map_switcher_in_guest(struct lg_cpu *cpu, struct lguest_pages *pages)
640 pte_t *switcher_pte_page = __get_cpu_var(switcher_pte_pages); 640 pte_t *switcher_pte_page = __get_cpu_var(switcher_pte_pages);
641 pgd_t switcher_pgd; 641 pgd_t switcher_pgd;
642 pte_t regs_pte; 642 pte_t regs_pte;
643 unsigned long pfn;
643 644
644 /* Make the last PGD entry for this Guest point to the Switcher's PTE 645 /* Make the last PGD entry for this Guest point to the Switcher's PTE
645 * page for this CPU (with appropriate flags). */ 646 * page for this CPU (with appropriate flags). */
@@ -654,7 +655,8 @@ void map_switcher_in_guest(struct lg_cpu *cpu, struct lguest_pages *pages)
654 * CPU's "struct lguest_pages": if we make sure the Guest's register 655 * CPU's "struct lguest_pages": if we make sure the Guest's register
655 * page is already mapped there, we don't have to copy them out 656 * page is already mapped there, we don't have to copy them out
656 * again. */ 657 * again. */
657 regs_pte = pfn_pte (__pa(lg->regs_page) >> PAGE_SHIFT, __pgprot(_PAGE_KERNEL)); 658 pfn = __pa(cpu->regs_page) >> PAGE_SHIFT;
659 regs_pte = pfn_pte(pfn, __pgprot(_PAGE_KERNEL));
658 switcher_pte_page[(unsigned long)pages/PAGE_SIZE%PTRS_PER_PTE] = regs_pte; 660 switcher_pte_page[(unsigned long)pages/PAGE_SIZE%PTRS_PER_PTE] = regs_pte;
659} 661}
660/*:*/ 662/*:*/
diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c
index ae46c6b1f2f9..d96a93d95aea 100644
--- a/drivers/lguest/x86/core.c
+++ b/drivers/lguest/x86/core.c
@@ -127,7 +127,7 @@ static void run_guest_once(struct lg_cpu *cpu, struct lguest_pages *pages)
127 /* Set the trap number to 256 (impossible value). If we fault while 127 /* Set the trap number to 256 (impossible value). If we fault while
128 * switching to the Guest (bad segment registers or bug), this will 128 * switching to the Guest (bad segment registers or bug), this will
129 * cause us to abort the Guest. */ 129 * cause us to abort the Guest. */
130 lg->regs->trapnum = 256; 130 cpu->regs->trapnum = 256;
131 131
132 /* Now: we push the "eflags" register on the stack, then do an "lcall". 132 /* Now: we push the "eflags" register on the stack, then do an "lcall".
133 * This is how we change from using the kernel code segment to using 133 * This is how we change from using the kernel code segment to using
@@ -195,11 +195,11 @@ void lguest_arch_run_guest(struct lg_cpu *cpu)
195 * bad virtual address. We have to grab this now, because once we 195 * bad virtual address. We have to grab this now, because once we
196 * re-enable interrupts an interrupt could fault and thus overwrite 196 * re-enable interrupts an interrupt could fault and thus overwrite
197 * cr2, or we could even move off to a different CPU. */ 197 * cr2, or we could even move off to a different CPU. */
198 if (lg->regs->trapnum == 14) 198 if (cpu->regs->trapnum == 14)
199 lg->arch.last_pagefault = read_cr2(); 199 lg->arch.last_pagefault = read_cr2();
200 /* Similarly, if we took a trap because the Guest used the FPU, 200 /* Similarly, if we took a trap because the Guest used the FPU,
201 * we have to restore the FPU it expects to see. */ 201 * we have to restore the FPU it expects to see. */
202 else if (lg->regs->trapnum == 7) 202 else if (cpu->regs->trapnum == 7)
203 math_state_restore(); 203 math_state_restore();
204 204
205 /* Restore SYSENTER if it's supposed to be on. */ 205 /* Restore SYSENTER if it's supposed to be on. */
@@ -225,12 +225,12 @@ static int emulate_insn(struct lg_cpu *cpu)
225 unsigned int insnlen = 0, in = 0, shift = 0; 225 unsigned int insnlen = 0, in = 0, shift = 0;
226 /* The eip contains the *virtual* address of the Guest's instruction: 226 /* The eip contains the *virtual* address of the Guest's instruction:
227 * guest_pa just subtracts the Guest's page_offset. */ 227 * guest_pa just subtracts the Guest's page_offset. */
228 unsigned long physaddr = guest_pa(lg, lg->regs->eip); 228 unsigned long physaddr = guest_pa(lg, cpu->regs->eip);
229 229
230 /* This must be the Guest kernel trying to do something, not userspace! 230 /* This must be the Guest kernel trying to do something, not userspace!
231 * The bottom two bits of the CS segment register are the privilege 231 * The bottom two bits of the CS segment register are the privilege
232 * level. */ 232 * level. */
233 if ((lg->regs->cs & 3) != GUEST_PL) 233 if ((cpu->regs->cs & 3) != GUEST_PL)
234 return 0; 234 return 0;
235 235
236 /* Decoding x86 instructions is icky. */ 236 /* Decoding x86 instructions is icky. */
@@ -273,12 +273,12 @@ static int emulate_insn(struct lg_cpu *cpu)
273 if (in) { 273 if (in) {
274 /* Lower bit tells is whether it's a 16 or 32 bit access */ 274 /* Lower bit tells is whether it's a 16 or 32 bit access */
275 if (insn & 0x1) 275 if (insn & 0x1)
276 lg->regs->eax = 0xFFFFFFFF; 276 cpu->regs->eax = 0xFFFFFFFF;
277 else 277 else
278 lg->regs->eax |= (0xFFFF << shift); 278 cpu->regs->eax |= (0xFFFF << shift);
279 } 279 }
280 /* Finally, we've "done" the instruction, so move past it. */ 280 /* Finally, we've "done" the instruction, so move past it. */
281 lg->regs->eip += insnlen; 281 cpu->regs->eip += insnlen;
282 /* Success! */ 282 /* Success! */
283 return 1; 283 return 1;
284} 284}
@@ -287,12 +287,12 @@ static int emulate_insn(struct lg_cpu *cpu)
287void lguest_arch_handle_trap(struct lg_cpu *cpu) 287void lguest_arch_handle_trap(struct lg_cpu *cpu)
288{ 288{
289 struct lguest *lg = cpu->lg; 289 struct lguest *lg = cpu->lg;
290 switch (lg->regs->trapnum) { 290 switch (cpu->regs->trapnum) {
291 case 13: /* We've intercepted a General Protection Fault. */ 291 case 13: /* We've intercepted a General Protection Fault. */
292 /* Check if this was one of those annoying IN or OUT 292 /* Check if this was one of those annoying IN or OUT
293 * instructions which we need to emulate. If so, we just go 293 * instructions which we need to emulate. If so, we just go
294 * back into the Guest after we've done it. */ 294 * back into the Guest after we've done it. */
295 if (lg->regs->errcode == 0) { 295 if (cpu->regs->errcode == 0) {
296 if (emulate_insn(cpu)) 296 if (emulate_insn(cpu))
297 return; 297 return;
298 } 298 }
@@ -307,7 +307,7 @@ void lguest_arch_handle_trap(struct lg_cpu *cpu)
307 * 307 *
308 * The errcode tells whether this was a read or a write, and 308 * The errcode tells whether this was a read or a write, and
309 * whether kernel or userspace code. */ 309 * whether kernel or userspace code. */
310 if (demand_page(lg, lg->arch.last_pagefault, lg->regs->errcode)) 310 if (demand_page(lg, lg->arch.last_pagefault, cpu->regs->errcode))
311 return; 311 return;
312 312
313 /* OK, it's really not there (or not OK): the Guest needs to 313 /* OK, it's really not there (or not OK): the Guest needs to
@@ -338,19 +338,19 @@ void lguest_arch_handle_trap(struct lg_cpu *cpu)
338 case LGUEST_TRAP_ENTRY: 338 case LGUEST_TRAP_ENTRY:
339 /* Our 'struct hcall_args' maps directly over our regs: we set 339 /* Our 'struct hcall_args' maps directly over our regs: we set
340 * up the pointer now to indicate a hypercall is pending. */ 340 * up the pointer now to indicate a hypercall is pending. */
341 cpu->hcall = (struct hcall_args *)lg->regs; 341 cpu->hcall = (struct hcall_args *)cpu->regs;
342 return; 342 return;
343 } 343 }
344 344
345 /* We didn't handle the trap, so it needs to go to the Guest. */ 345 /* We didn't handle the trap, so it needs to go to the Guest. */
346 if (!deliver_trap(cpu, lg->regs->trapnum)) 346 if (!deliver_trap(cpu, cpu->regs->trapnum))
347 /* If the Guest doesn't have a handler (either it hasn't 347 /* If the Guest doesn't have a handler (either it hasn't
348 * registered any yet, or it's one of the faults we don't let 348 * registered any yet, or it's one of the faults we don't let
349 * it handle), it dies with a cryptic error message. */ 349 * it handle), it dies with a cryptic error message. */
350 kill_guest(lg, "unhandled trap %li at %#lx (%#lx)", 350 kill_guest(lg, "unhandled trap %li at %#lx (%#lx)",
351 lg->regs->trapnum, lg->regs->eip, 351 cpu->regs->trapnum, cpu->regs->eip,
352 lg->regs->trapnum == 14 ? lg->arch.last_pagefault 352 cpu->regs->trapnum == 14 ? lg->arch.last_pagefault
353 : lg->regs->errcode); 353 : cpu->regs->errcode);
354} 354}
355 355
356/* Now we can look at each of the routines this calls, in increasing order of 356/* Now we can look at each of the routines this calls, in increasing order of
@@ -557,9 +557,9 @@ int lguest_arch_init_hypercalls(struct lg_cpu *cpu)
557 * 557 *
558 * Most of the Guest's registers are left alone: we used get_zeroed_page() to 558 * Most of the Guest's registers are left alone: we used get_zeroed_page() to
559 * allocate the structure, so they will be 0. */ 559 * allocate the structure, so they will be 0. */
560void lguest_arch_setup_regs(struct lguest *lg, unsigned long start) 560void lguest_arch_setup_regs(struct lg_cpu *cpu, unsigned long start)
561{ 561{
562 struct lguest_regs *regs = lg->regs; 562 struct lguest_regs *regs = cpu->regs;
563 563
564 /* There are four "segment" registers which the Guest needs to boot: 564 /* There are four "segment" registers which the Guest needs to boot:
565 * The "code segment" register (cs) refers to the kernel code segment 565 * The "code segment" register (cs) refers to the kernel code segment
@@ -586,5 +586,5 @@ void lguest_arch_setup_regs(struct lguest *lg, unsigned long start)
586 586
587 /* There are a couple of GDT entries the Guest expects when first 587 /* There are a couple of GDT entries the Guest expects when first
588 * booting. */ 588 * booting. */
589 setup_guest_gdt(lg); 589 setup_guest_gdt(cpu->lg);
590} 590}