/* All this reference to mapping stacks leads us neatly into the other complex part of the Host: page table handling.  */
static void set_trap(struct lg_cpu *cpu, struct desc_struct *trap, unsigned int num, u32 lo, u32 hi)
/* All this reference to mapping stacks leads us neatly into the other complex part of the Host: page table handling.  */
static void set_trap(struct lg_cpu *cpu, struct desc_struct *trap, unsigned int num, u32 lo, u32 hi)
{
	u8 type = idt_type(lo, hi);
	if (!idt_present(lo, hi)) {
		trap->a = trap->b = 0;
		return;
	}
	if (type != 0xE && type != 0xF)
		kill_guest(cpu, "bad IDT type %i", type);
	trap->a = ((__KERNEL_CS|GUEST_PL)<<16) | (lo&0x0000FFFF);
	trap->b = (hi&0xFFFFEF00);
}