Skip to contentSkip to conversation

Privilege levels in xenolinux

DISCUSSION Purav Saraiya 2 participants 2 messages Nov 8, 2005

lore
Share & tools
lore
#0 lore raw

The following assembly code is used to set the Descriptors in xenolinux. Theoretically, for xenolinux we have Descriptor privilege level(DPL) = 1 for all its descriptors. But from the instruction,

        "movb %4,5(%2)\n\t"  (with the parameter, type =0x82 and 0x89)

it seems that the DPL is set to 0.

How is this possible. Dont we have xenolinux running at privilege level 1? Am I going wrong somewhere?

#define _set_tssldt_desc(n,addr,limit,type) \

__asm__ __volatile__ ("movw %w3,0(%2)\n\t" \
        "movw %%ax,2(%2)\n\t" \
        "rorl $16,%%eax\n\t" \
        "movb %%al,4(%2)\n\t" \
        "movb %4,5(%2)\n\t" \
        "movb $0,6(%2)\n\t" \
        "movb %%ah,7(%2)\n\t" \
        "rorl $16,%%eax" \
        : "=m"(*(n)) : "a" (addr), "r"(n), "ir"(limit), "i"(type))

The above inline assembly is called as :

_set_tssldt_desc(&per_cpu(cpu_gdt_table, cpu)[entry], (int)addr,

                offsetof(struct tss_struct, __cacheline_filler) - 1, 0x89);

_set_tssldt_desc(&per_cpu(cpu_gdt_table, cpu)[GDT_ENTRY_LDT], (int)addr, ((size << 3)-1), 0x82);

Thanks for any replies,
Purav

#1 lore raw
Quoted 9 lines · Purav Saraiya

The following assembly code is used to set the Descriptors in xenolinux. Theoretically, for xenolinux we have Descriptor privilege level(DPL) = 1 for all its descriptors. But from the instruction,

        "movb %4,5(%2)\n\t"  (with the parameter, type =0x82 and 0x89)

it seems that the DPL is set to 0.

How is this possible. Dont we have xenolinux running at privilege level 1? Am I going wrong somewhere?

That's dead code in Xen Linux. We set up LDTs via an explicit hypercall, not via LLDT.

-- Keir