From 4ced7ef45f83438e8a4a5689e3000bdfef378891 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 14 Aug 2002 21:10:50 +0000 Subject: [PATCH] Use the "new" LDT set call on Linux. --- library/ldt.c | 4 +++- memory/selector.c | 7 +++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/library/ldt.c b/library/ldt.c index 5563e6e0cf0..1d0eca018b6 100644 --- a/library/ldt.c +++ b/library/ldt.c @@ -48,6 +48,7 @@ struct modify_ldt_s unsigned int read_exec_only : 1; unsigned int limit_in_pages : 1; unsigned int seg_not_present : 1; + unsigned int useable:1; }; static inline int modify_ldt( int func, struct modify_ldt_s *ptr, @@ -140,8 +141,9 @@ int wine_ldt_set_entry( unsigned short sel, const LDT_ENTRY *entry ) ldt_info.read_exec_only = !(entry->HighWord.Bits.Type & 2); ldt_info.limit_in_pages = entry->HighWord.Bits.Granularity; ldt_info.seg_not_present = !entry->HighWord.Bits.Pres; + ldt_info.useable = entry->HighWord.Bits.Sys; - if ((ret = modify_ldt(1, &ldt_info, sizeof(ldt_info))) < 0) + if ((ret = modify_ldt(0x11, &ldt_info, sizeof(ldt_info))) < 0) perror( "modify_ldt" ); } #endif /* linux */ diff --git a/memory/selector.c b/memory/selector.c index e161fa68fcb..38792528436 100644 --- a/memory/selector.c +++ b/memory/selector.c @@ -119,12 +119,12 @@ WORD WINAPI FreeSelector16( WORD sel ) #ifdef __i386__ /* Check if we are freeing current %fs or %gs selector */ - if (!((wine_get_fs() ^ sel) & ~7)) + if (!((wine_get_fs() ^ sel) & ~3)) { WARN("Freeing %%fs selector (%04x), not good.\n", wine_get_fs() ); wine_set_fs( 0 ); } - if (!((wine_get_gs() ^ sel) & ~7)) wine_set_gs( 0 ); + if (!((wine_get_gs() ^ sel) & ~3)) wine_set_gs( 0 ); #endif /* __i386__ */ wine_ldt_set_entry( sel, &null_entry ); @@ -161,8 +161,7 @@ static void SELECTOR_SetEntries( WORD sel, const void *base, DWORD size, unsigne WORD i, count; wine_ldt_set_base( &entry, base ); - /* Make sure base and limit are not 0 together if the size is not 0 */ - wine_ldt_set_limit( &entry, (!base && size == 1) ? 1 : size - 1 ); + wine_ldt_set_limit( &entry, size - 1 ); wine_ldt_set_flags( &entry, flags ); count = (size + 0xffff) / 0x10000; for (i = 0; i < count; i++)