Subject: Re: port-amd64/29116: gdt_grow doesn't grow per-cpu gdt
To: None <port-amd64-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: Frank van der Linden <fvdl@netbsd.org>
List: netbsd-bugs
Date: 01/25/2005 13:44:02
The following reply was made to PR port-amd64/29116; it has been noted by GNATS.

From: Frank van der Linden <fvdl@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: netbsd-bugs@netbsd.org
Subject: Re: port-amd64/29116: gdt_grow doesn't grow per-cpu gdt
Date: Tue, 25 Jan 2005 14:45:56 +0100

 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