Commit 4ced7ef4 authored by Alexandre Julliard's avatar Alexandre Julliard

Use the "new" LDT set call on Linux.

parent 124eaf80
......@@ -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 */
......
......@@ -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++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment