Re: [PATCH 2.4.24] Fix GDT limit in setup.S

From: Richard B. Johnson
Date: Mon Feb 16 2004 - 15:44:08 EST


On Tue, 17 Feb 2004, Coywolf Qi Hunt wrote:

> Hello 2.4.xx hackers,
>
> In setup.S, i feel like that the gdt limit 0x8000 is not proper and it
> should be 0x800. How came 0x800 into 0x8000 in 2.4.xx code? Is there a
> story? It shouldn't be a careless typo. 256 gdt entries should be
> enough and since it's boot gdt, 256 is ok even if the code is run on SMP
> with 64 cpus.
>

The first element has nothing to do with the number of GDT entries.
It represents the LIMIT. Because the granularity bit is
set meaning 4 kilobyte pages and 0x8000 * 0x1000 = 0x8000000
| |
| |_______ Page size
|______________ GDT value
This is the size of address space that is unity-mapped for boot.

The granularity is also not the number of GDT entries. It
represents the length for which the GDT definition applies.

Because this GDT is used only for booting, somebody decided that
there would never be any boot code beyond 2 GB so there was no
reason to make room for it. If you change the number to 0x0800,
you are declaring that neither the boot code nor any RAM-disk
combination will ever exceed 0x800 * 0x1000 = 0x800000 bytes.
Therefore you broke my imbedded system. Do not do this.

> At least the comment doesn't match the code. Either fix the code or fix
> the comment. We really needn't so many GDT entries. Let's use the intel
> segmentation in a most limited way. Below follows a patch fixing the code.
>
> I don't have the latest 2.4.24, but setup.S isn't changed from 2.4.23 to
> 2.4.24.
>
> Regards, Coywolf
>


Cheers,
Dick Johnson
Penguin : Linux version 2.4.24 on an i686 machine (797.90 BogoMips).
Note 96.31% of all statistics are fiction.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/