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