From 442512d59f3185278fc97966813a4d23175614d4 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 29 Dec 2009 22:18:01 +0100 Subject: [PATCH] libwine: Do not export any of the LDT support on non-i386 platforms. --- include/wine/library.h | 21 ++++----------------- include/winnt.h | 3 --- libs/wine/ldt.c | 10 +--------- libs/wine/wine.def | 8 -------- 4 files changed, 5 insertions(+), 37 deletions(-) diff --git a/include/wine/library.h b/include/wine/library.h index 9ff1910e6e6..8eedf043266 100644 --- a/include/wine/library.h +++ b/include/wine/library.h @@ -82,6 +82,8 @@ extern int wine_mmap_is_in_reserved_area( void *addr, size_t size ); extern int wine_mmap_enum_reserved_areas( int (*enum_func)(void *base, size_t size, void *arg), void *arg, int top_down ); +#ifdef __i386__ + /* LDT management */ extern void wine_ldt_init_locking( void (*lock_func)(void), void (*unlock_func)(void) ); @@ -92,15 +94,9 @@ extern void *wine_ldt_get_ptr( unsigned short sel, unsigned long offset ); extern unsigned short wine_ldt_alloc_entries( int count ); extern unsigned short wine_ldt_realloc_entries( unsigned short sel, int oldcount, int newcount ); extern void wine_ldt_free_entries( unsigned short sel, int count ); -#if defined(__i386__) && !defined(__MINGW32__) && !defined(_MSC_VER) extern unsigned short wine_ldt_alloc_fs(void); extern void wine_ldt_init_fs( unsigned short sel, const LDT_ENTRY *entry ); extern void wine_ldt_free_fs( unsigned short sel ); -#else /* __i386__ */ -static inline unsigned short wine_ldt_alloc_fs(void) { return 0x0b; /* pseudo GDT selector */ } -static inline void wine_ldt_init_fs( unsigned short sel, const LDT_ENTRY *entry ) { } -static inline void wine_ldt_free_fs( unsigned short sel ) { } -#endif /* __i386__ */ /* the local copy of the LDT */ extern struct __wine_ldt_copy @@ -123,9 +119,6 @@ static inline void wine_ldt_set_base( LDT_ENTRY *ent, const void *base ) ent->BaseLow = (WORD)(ULONG_PTR)base; ent->HighWord.Bits.BaseMid = (BYTE)((ULONG_PTR)base >> 16); ent->HighWord.Bits.BaseHi = (BYTE)((ULONG_PTR)base >> 24); -#ifdef _WIN64 - ent->BaseHigh = (ULONG_PTR)base >> 32; -#endif } static inline void wine_ldt_set_limit( LDT_ENTRY *ent, unsigned int limit ) { @@ -136,9 +129,6 @@ static inline void wine_ldt_set_limit( LDT_ENTRY *ent, unsigned int limit ) static inline void *wine_ldt_get_base( const LDT_ENTRY *ent ) { return (void *)(ent->BaseLow | -#ifdef _WIN64 - (ULONG_PTR)ent->BaseHigh << 32 | -#endif (ULONG_PTR)ent->HighWord.Bits.BaseMid << 16 | (ULONG_PTR)ent->HighWord.Bits.BaseHi << 24); } @@ -171,7 +161,6 @@ static inline int wine_ldt_is_empty( const LDT_ENTRY *ent ) /* segment register access */ -#ifdef __i386__ # ifdef __MINGW32__ # define __DEFINE_GET_SEG(seg) \ static inline unsigned short wine_get_##seg(void); \ @@ -200,10 +189,6 @@ static inline int wine_ldt_is_empty( const LDT_ENTRY *ent ) # define __DEFINE_GET_SEG(seg) extern unsigned short wine_get_##seg(void); # define __DEFINE_SET_SEG(seg) extern void wine_set_##seg(unsigned int); # endif /* __GNUC__ || _MSC_VER */ -#else /* __i386__ */ -# define __DEFINE_GET_SEG(seg) static inline unsigned short wine_get_##seg(void) { return 0; } -# define __DEFINE_SET_SEG(seg) static inline void wine_set_##seg(int val) { /* nothing */ } -#endif /* __i386__ */ __DEFINE_GET_SEG(cs) __DEFINE_GET_SEG(ds) @@ -216,6 +201,8 @@ __DEFINE_SET_SEG(gs) #undef __DEFINE_GET_SEG #undef __DEFINE_SET_SEG +#endif /* __i386__ */ + #ifdef __cplusplus } #endif diff --git a/include/winnt.h b/include/winnt.h index 28409af3b1e..d4a158e247c 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -866,9 +866,6 @@ typedef struct _LDT_ENTRY { unsigned BaseHi : 8; } Bits; } HighWord; -#ifdef _WIN64 /* FIXME: 64-bit code should not be using the LDT */ - DWORD BaseHigh; -#endif } LDT_ENTRY, *PLDT_ENTRY; /* x86-64 context definitions */ diff --git a/libs/wine/ldt.c b/libs/wine/ldt.c index 685ed6a2a12..d56790ff803 100644 --- a/libs/wine/ldt.c +++ b/libs/wine/ldt.c @@ -33,7 +33,7 @@ #include "winbase.h" #include "wine/library.h" -#ifdef __i386__ +#if defined(__i386__) && !defined(__MINGW32__) && !defined(_MSC_VER) #ifdef __linux__ @@ -118,8 +118,6 @@ static inline int set_thread_area( struct modify_ldt_s *ptr ) #include #endif -#endif /* __i386__ */ - /* local copy of the LDT */ #ifdef __APPLE__ struct __wine_ldt_copy wine_ldt_copy = { { 0, 0, 0 } }; @@ -190,8 +188,6 @@ static int internal_set_entry( unsigned short sel, const LDT_ENTRY *entry ) if (index < LDT_FIRST_ENTRY) return 0; /* cannot modify reserved entries */ -#ifdef __i386__ - #ifdef linux { struct modify_ldt_s ldt_info; @@ -234,8 +230,6 @@ static int internal_set_entry( unsigned short sel, const LDT_ENTRY *entry ) exit(1); #endif -#endif /* __i386__ */ - if (ret >= 0) { wine_ldt_copy.base[index] = wine_ldt_get_base(entry); @@ -384,8 +378,6 @@ void wine_ldt_free_entries( unsigned short sel, int count ) } -#if defined(__i386__) && !defined(__MINGW32__) && !defined(_MSC_VER) - static int global_fs_sel = -1; /* global selector for %fs shared among all threads */ /*********************************************************************** diff --git a/libs/wine/wine.def b/libs/wine/wine.def index b94397a3b72..ed315bd08b1 100644 --- a/libs/wine/wine.def +++ b/libs/wine/wine.def @@ -86,14 +86,6 @@ EXPORTS wine_init wine_init_argv0_path wine_is_dbcs_leadbyte - wine_ldt_alloc_entries - wine_ldt_free_entries - wine_ldt_get_entry - wine_ldt_get_ptr - wine_ldt_init_locking - wine_ldt_is_system - wine_ldt_realloc_entries - wine_ldt_set_entry wine_pthread_get_functions wine_pthread_set_functions wine_switch_to_stack