Subject: Re: port-amd64/29116: gdt_grow doesn't grow per-cpu gdt
To: None <gnats-bugs@netbsd.org>
From: Frank van der Linden <fvdl@netbsd.org>
List: netbsd-bugs
Date: 01/25/2005 14:45:56
On Tue, Jan 25, 2005 at 01:19:00PM +0000, yamt@mwd.biglobe.ne.jp wrote:
> >Number: 29116
> >Category: port-amd64
> >Synopsis: gdt_grow doesn't grow per-cpu gdt
> >Confidential: no
> >Severity: non-critical
> >Priority: low
That's right, it doesn't.. the amd64 port doesn't use per-CPU GDTs.
The ci_gdt part of the cpu_info structure points to the same area
for each CPU.
The reason for this is that the %gs and %fs registers work differently.
On i386, the %fs register is used for per-CPU data; on amd64 the %gs
register. On i386, the %fs register goes through the GDT to find the
area it points to. On amd64 (in long (64bit) mode), %gs points to
an area defined by an MSR, which is loaded seperately; no GDT entry
is needed. Thus, a per-CPU GDT is not needed on amd64.
I'll leave the PR open, because the loops changing the gdt entry for
each CPU are redundant, and need to be removed, OR the gdt.c must
be merged between amd64 and i386 (this was my original intention).
- Frank