aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/lguest/interrupts_and_traps.c
diff options
context:
space:
mode:
authorJes Sorensen <jes@sgi.com>2007-10-21 21:03:28 -0400
committerRusty Russell <rusty@rustcorp.com.au>2007-10-23 01:49:51 -0400
commit625efab1cd3d4da4634dfe26df6b4005385397e2 (patch)
treee08cd714edece430ae8a8aef894adfadbccc064a /drivers/lguest/interrupts_and_traps.c
parent56adbe9ddc935600c64635d6a55c260a63c67e4a (diff)
Move i386 part of core.c to x86/core.c.
Separate i386 architecture specific from core.c and move it to x86/core.c and add x86/lguest.h header file to match. Signed-off-by: Jes Sorensen <jes@sgi.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/lguest/interrupts_and_traps.c')
-rw-r--r--drivers/lguest/interrupts_and_traps.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/lguest/interrupts_and_traps.c b/drivers/lguest/interrupts_and_traps.c
index 0dfb0903aa69..fdefc0afc38c 100644
--- a/drivers/lguest/interrupts_and_traps.c
+++ b/drivers/lguest/interrupts_and_traps.c
@@ -165,7 +165,7 @@ void maybe_do_interrupt(struct lguest *lg)
165 /* Look at the IDT entry the Guest gave us for this interrupt. The 165 /* Look at the IDT entry the Guest gave us for this interrupt. The
166 * first 32 (FIRST_EXTERNAL_VECTOR) entries are for traps, so we skip 166 * first 32 (FIRST_EXTERNAL_VECTOR) entries are for traps, so we skip
167 * over them. */ 167 * over them. */
168 idt = &lg->idt[FIRST_EXTERNAL_VECTOR+irq]; 168 idt = &lg->arch.idt[FIRST_EXTERNAL_VECTOR+irq];
169 /* If they don't have a handler (yet?), we just ignore it */ 169 /* If they don't have a handler (yet?), we just ignore it */
170 if (idt_present(idt->a, idt->b)) { 170 if (idt_present(idt->a, idt->b)) {
171 /* OK, mark it no longer pending and deliver it. */ 171 /* OK, mark it no longer pending and deliver it. */
@@ -197,14 +197,14 @@ int deliver_trap(struct lguest *lg, unsigned int num)
197{ 197{
198 /* Trap numbers are always 8 bit, but we set an impossible trap number 198 /* Trap numbers are always 8 bit, but we set an impossible trap number
199 * for traps inside the Switcher, so check that here. */ 199 * for traps inside the Switcher, so check that here. */
200 if (num >= ARRAY_SIZE(lg->idt)) 200 if (num >= ARRAY_SIZE(lg->arch.idt))
201 return 0; 201 return 0;
202 202
203 /* Early on the Guest hasn't set the IDT entries (or maybe it put a 203 /* Early on the Guest hasn't set the IDT entries (or maybe it put a
204 * bogus one in): if we fail here, the Guest will be killed. */ 204 * bogus one in): if we fail here, the Guest will be killed. */
205 if (!idt_present(lg->idt[num].a, lg->idt[num].b)) 205 if (!idt_present(lg->arch.idt[num].a, lg->arch.idt[num].b))
206 return 0; 206 return 0;
207 set_guest_interrupt(lg, lg->idt[num].a, lg->idt[num].b, has_err(num)); 207 set_guest_interrupt(lg, lg->arch.idt[num].a, lg->arch.idt[num].b, has_err(num));
208 return 1; 208 return 1;
209} 209}
210 210
@@ -341,10 +341,10 @@ void load_guest_idt_entry(struct lguest *lg, unsigned int num, u32 lo, u32 hi)
341 lg->changed |= CHANGED_IDT; 341 lg->changed |= CHANGED_IDT;
342 342
343 /* Check that the Guest doesn't try to step outside the bounds. */ 343 /* Check that the Guest doesn't try to step outside the bounds. */
344 if (num >= ARRAY_SIZE(lg->idt)) 344 if (num >= ARRAY_SIZE(lg->arch.idt))
345 kill_guest(lg, "Setting idt entry %u", num); 345 kill_guest(lg, "Setting idt entry %u", num);
346 else 346 else
347 set_trap(lg, &lg->idt[num], num, lo, hi); 347 set_trap(lg, &lg->arch.idt[num], num, lo, hi);
348} 348}
349 349
350/* The default entry for each interrupt points into the Switcher routines which 350/* The default entry for each interrupt points into the Switcher routines which
@@ -387,7 +387,7 @@ void copy_traps(const struct lguest *lg, struct desc_struct *idt,
387 387
388 /* We can simply copy the direct traps, otherwise we use the default 388 /* We can simply copy the direct traps, otherwise we use the default
389 * ones in the Switcher: they will return to the Host. */ 389 * ones in the Switcher: they will return to the Host. */
390 for (i = 0; i < ARRAY_SIZE(lg->idt); i++) { 390 for (i = 0; i < ARRAY_SIZE(lg->arch.idt); i++) {
391 /* If no Guest can ever override this trap, leave it alone. */ 391 /* If no Guest can ever override this trap, leave it alone. */
392 if (!direct_trap(i)) 392 if (!direct_trap(i))
393 continue; 393 continue;
@@ -396,8 +396,8 @@ void copy_traps(const struct lguest *lg, struct desc_struct *idt,
396 * Interrupt gates (type 14) disable interrupts as they are 396 * Interrupt gates (type 14) disable interrupts as they are
397 * entered, which we never let the Guest do. Not present 397 * entered, which we never let the Guest do. Not present
398 * entries (type 0x0) also can't go direct, of course. */ 398 * entries (type 0x0) also can't go direct, of course. */
399 if (idt_type(lg->idt[i].a, lg->idt[i].b) == 0xF) 399 if (idt_type(lg->arch.idt[i].a, lg->arch.idt[i].b) == 0xF)
400 idt[i] = lg->idt[i]; 400 idt[i] = lg->arch.idt[i];
401 else 401 else
402 /* Reset it to the default. */ 402 /* Reset it to the default. */
403 default_idt_entry(&idt[i], i, def[i]); 403 default_idt_entry(&idt[i], i, def[i]);