John Smith wrote:
> Hi,
>
> I was looking at this macro in
pm.c:
>
> #define GDT_ENTRY(flags,base,limit) \
> (((u64)(base & 0xff000000) << 32) | \
> ((u64)flags << 40) | \
> ((u64)(limit & 0x00ff0000) << 32) | \
> ((u64)(base & 0x00ffff00) << 16) | \
> ((u64)(limit & 0x0000ffff)))
>
> I think it should be:
>
> #define GDT_ENTRY(flags,base,limit) \
> (((u64)(base & 0xff000000) << 32) | \
> ((u64)flags << 40) | \
> ((u64)(limit & 0x00ff0000) << 32) | \
> ((u64)(base & 0x00ffffff) << 16) | \ <----------
> ((u64)(limit & 0x0000ffff)))
>
> The base is 0 in the code so it's OK but I think that if we use a
> *theoretical* base like 0xffffffff the macro won't set the gdt entry
> correctly.
>
> Did I miss something?
>
Nope, that's absolutely correct (and yes, it's a non-manifest bug.)