diff options
author | Eduardo Habkost <ehabkost@Rawhide-64.localdomain> | 2008-07-08 18:06:59 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-16 05:02:15 -0400 |
commit | e176d367d0cc8b8efd2e0960c9edf5d2fe7cd9f1 (patch) | |
tree | 52d09f9d4a22b67a8a525e94fcb3d79043a62b04 /arch/x86/xen | |
parent | 836fe2f291cb450a6193fa713878efe7d32bec6e (diff) |
xen64: xen_write_idt_entry() and cvt_gate_to_trap()
Changed to use the (to-be-)unified descriptor structs.
Signed-off-by: Eduardo Habkost <ehabkost@Rawhide-64.localdomain>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: Stephen Tweedie <sct@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/xen')
-rw-r--r-- | arch/x86/xen/enlighten.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index da91404fc66c..f5e96f7a4c5c 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -401,23 +401,18 @@ static void xen_write_ldt_entry(struct desc_struct *dt, int entrynum, | |||
401 | preempt_enable(); | 401 | preempt_enable(); |
402 | } | 402 | } |
403 | 403 | ||
404 | static int cvt_gate_to_trap(int vector, u32 low, u32 high, | 404 | static int cvt_gate_to_trap(int vector, const gate_desc *val, |
405 | struct trap_info *info) | 405 | struct trap_info *info) |
406 | { | 406 | { |
407 | u8 type, dpl; | 407 | if (val->type != 0xf && val->type != 0xe) |
408 | |||
409 | type = (high >> 8) & 0x1f; | ||
410 | dpl = (high >> 13) & 3; | ||
411 | |||
412 | if (type != 0xf && type != 0xe) | ||
413 | return 0; | 408 | return 0; |
414 | 409 | ||
415 | info->vector = vector; | 410 | info->vector = vector; |
416 | info->address = (high & 0xffff0000) | (low & 0x0000ffff); | 411 | info->address = gate_offset(*val); |
417 | info->cs = low >> 16; | 412 | info->cs = gate_segment(*val); |
418 | info->flags = dpl; | 413 | info->flags = val->dpl; |
419 | /* interrupt gates clear IF */ | 414 | /* interrupt gates clear IF */ |
420 | if (type == 0xe) | 415 | if (val->type == 0xe) |
421 | info->flags |= 4; | 416 | info->flags |= 4; |
422 | 417 | ||
423 | return 1; | 418 | return 1; |
@@ -444,11 +439,10 @@ static void xen_write_idt_entry(gate_desc *dt, int entrynum, const gate_desc *g) | |||
444 | 439 | ||
445 | if (p >= start && (p + 8) <= end) { | 440 | if (p >= start && (p + 8) <= end) { |
446 | struct trap_info info[2]; | 441 | struct trap_info info[2]; |
447 | u32 *desc = (u32 *)g; | ||
448 | 442 | ||
449 | info[1].address = 0; | 443 | info[1].address = 0; |
450 | 444 | ||
451 | if (cvt_gate_to_trap(entrynum, desc[0], desc[1], &info[0])) | 445 | if (cvt_gate_to_trap(entrynum, g, &info[0])) |
452 | if (HYPERVISOR_set_trap_table(info)) | 446 | if (HYPERVISOR_set_trap_table(info)) |
453 | BUG(); | 447 | BUG(); |
454 | } | 448 | } |
@@ -461,13 +455,13 @@ static void xen_convert_trap_info(const struct desc_ptr *desc, | |||
461 | { | 455 | { |
462 | unsigned in, out, count; | 456 | unsigned in, out, count; |
463 | 457 | ||
464 | count = (desc->size+1) / 8; | 458 | count = (desc->size+1) / sizeof(gate_desc); |
465 | BUG_ON(count > 256); | 459 | BUG_ON(count > 256); |
466 | 460 | ||
467 | for (in = out = 0; in < count; in++) { | 461 | for (in = out = 0; in < count; in++) { |
468 | const u32 *entry = (u32 *)(desc->address + in * 8); | 462 | gate_desc *entry = (gate_desc*)(desc->address) + in; |
469 | 463 | ||
470 | if (cvt_gate_to_trap(in, entry[0], entry[1], &traps[out])) | 464 | if (cvt_gate_to_trap(in, entry, &traps[out])) |
471 | out++; | 465 | out++; |
472 | } | 466 | } |
473 | traps[out].address = 0; | 467 | traps[out].address = 0; |