From 427fea0ba6e4c9fd5a5a5f8e41dfd0916006abc8 Mon Sep 17 00:00:00 2001 From: Bill Paul Date: Sun, 17 Apr 2005 19:36:08 +0000 Subject: [PATCH] Now that the GDT has been reorganized and GNDIS_SEL has been reserved for us, use it if it's available, otherwise default to using slot 7 as before. --- sys/compat/ndis/kern_windrv.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/sys/compat/ndis/kern_windrv.c b/sys/compat/ndis/kern_windrv.c index 81b3a6dbe779..cd631fd36a58 100644 --- a/sys/compat/ndis/kern_windrv.c +++ b/sys/compat/ndis/kern_windrv.c @@ -52,6 +52,10 @@ __FBSDID("$FreeBSD$"); #include +#ifdef __i386__ +#include +#endif + #include #include #include @@ -545,7 +549,19 @@ extern void x86_setldt(struct gdt *, uint16_t); #define SEL_LDT 4 /* local descriptor table */ #define SEL_TO_FS(x) (((x) << 3)) -#define FREEBSD_EMPTYSEL 7 + +/* + * FreeBSD 6.0 and later has a special GDT segment reserved + * specifically for us, so if GNDIS_SEL is defined, use that. + * If not, use GTGATE_SEL, which is uninitialized and infrequently + * used. + */ + +#ifdef GNDIS_SEL +#define FREEBSD_EMPTYSEL GNDIS_SEL +#else +#define FREEBSD_EMPTYSEL GTGATE_SEL /* slot 7 */ +#endif /* * The meanings of various bits in a descriptor vary a little