Commit b5448369 authored by Alexandre Julliard's avatar Alexandre Julliard

krnl386: Avoid using the LDT definitions from libwine.

parent a02d2773
...@@ -319,7 +319,7 @@ static void DOSMEM_InitSegments(void) ...@@ -319,7 +319,7 @@ static void DOSMEM_InitSegments(void)
/* /*
* PM / offset N*5: Interrupt N in 16-bit protected mode. * PM / offset N*5: Interrupt N in 16-bit protected mode.
*/ */
int16_sel = GLOBAL_Alloc( GMEM_FIXED, 5 * 256, 0, WINE_LDT_FLAGS_CODE ); int16_sel = GLOBAL_Alloc( GMEM_FIXED, 5 * 256, 0, LDT_FLAGS_CODE );
ptr = GlobalLock16( int16_sel ); ptr = GlobalLock16( int16_sel );
for(i=0; i<256; i++) { for(i=0; i<256; i++) {
/* /*
...@@ -340,7 +340,7 @@ static void DOSMEM_InitSegments(void) ...@@ -340,7 +340,7 @@ static void DOSMEM_InitSegments(void)
* PM / offset 3: Stub which swaps back to 32-bit application code/stack. * PM / offset 3: Stub which swaps back to 32-bit application code/stack.
* PM / offset 5: Stub which enables interrupts * PM / offset 5: Stub which enables interrupts
*/ */
relay_code_sel = GLOBAL_Alloc( GMEM_FIXED, sizeof(relay), 0, WINE_LDT_FLAGS_CODE ); relay_code_sel = GLOBAL_Alloc( GMEM_FIXED, sizeof(relay), 0, LDT_FLAGS_CODE );
ptr = GlobalLock16( relay_code_sel ); ptr = GlobalLock16( relay_code_sel );
memcpy( ptr, relay, sizeof(relay) ); memcpy( ptr, relay, sizeof(relay) );
GlobalUnlock16( relay_code_sel ); GlobalUnlock16( relay_code_sel );
...@@ -472,11 +472,11 @@ BOOL DOSMEM_Init(void) ...@@ -472,11 +472,11 @@ BOOL DOSMEM_Init(void)
vectored_handler = AddVectoredExceptionHandler(FALSE, dosmem_handler); vectored_handler = AddVectoredExceptionHandler(FALSE, dosmem_handler);
DOSMEM_0000H = GLOBAL_CreateBlock( GMEM_FIXED, DOSMEM_sysmem, DOSMEM_0000H = GLOBAL_CreateBlock( GMEM_FIXED, DOSMEM_sysmem,
DOSMEM_64KB, 0, WINE_LDT_FLAGS_DATA ); DOSMEM_64KB, 0, LDT_FLAGS_DATA );
DOSMEM_BiosDataSeg = GLOBAL_CreateBlock( GMEM_FIXED, DOSMEM_sysmem + 0x400, DOSMEM_BiosDataSeg = GLOBAL_CreateBlock( GMEM_FIXED, DOSMEM_sysmem + 0x400,
0x100, 0, WINE_LDT_FLAGS_DATA ); 0x100, 0, LDT_FLAGS_DATA );
DOSMEM_BiosSysSeg = GLOBAL_CreateBlock( GMEM_FIXED, DOSMEM_dosmem + 0xf0000, DOSMEM_BiosSysSeg = GLOBAL_CreateBlock( GMEM_FIXED, DOSMEM_dosmem + 0xf0000,
DOSMEM_64KB, 0, WINE_LDT_FLAGS_DATA ); DOSMEM_64KB, 0, LDT_FLAGS_DATA );
return TRUE; return TRUE;
} }
......
...@@ -144,7 +144,7 @@ HGLOBAL16 GLOBAL_CreateBlock( WORD flags, void *ptr, DWORD size, ...@@ -144,7 +144,7 @@ HGLOBAL16 GLOBAL_CreateBlock( WORD flags, void *ptr, DWORD size,
pArena->flags = flags & GA_MOVEABLE; pArena->flags = flags & GA_MOVEABLE;
if (flags & GMEM_DISCARDABLE) pArena->flags |= GA_DISCARDABLE; if (flags & GMEM_DISCARDABLE) pArena->flags |= GA_DISCARDABLE;
if (flags & GMEM_DDESHARE) pArena->flags |= GA_IPCSHARE; if (flags & GMEM_DDESHARE) pArena->flags |= GA_IPCSHARE;
if (!(selflags & (WINE_LDT_FLAGS_CODE^WINE_LDT_FLAGS_DATA))) pArena->flags |= GA_DGROUP; if (!(selflags & (LDT_FLAGS_CODE ^ LDT_FLAGS_DATA))) pArena->flags |= GA_DGROUP;
pArena->selCount = selcount; pArena->selCount = selcount;
if (selcount > 1) /* clear the next arena blocks */ if (selcount > 1) /* clear the next arena blocks */
memset( pArena + 1, 0, (selcount - 1) * sizeof(GLOBALARENA) ); memset( pArena + 1, 0, (selcount - 1) * sizeof(GLOBALARENA) );
...@@ -260,7 +260,7 @@ HGLOBAL16 WINAPI GlobalAlloc16( ...@@ -260,7 +260,7 @@ HGLOBAL16 WINAPI GlobalAlloc16(
STACK16FRAME *frame = CURRENT_STACK16; STACK16FRAME *frame = CURRENT_STACK16;
owner = GetExePtr( frame->cs ); owner = GetExePtr( frame->cs );
} }
return GLOBAL_Alloc( flags, size, owner, WINE_LDT_FLAGS_DATA ); return GLOBAL_Alloc( flags, size, owner, LDT_FLAGS_DATA );
} }
...@@ -785,7 +785,7 @@ DWORD WINAPI GlobalDOSAlloc16( ...@@ -785,7 +785,7 @@ DWORD WINAPI GlobalDOSAlloc16(
WORD wSelector; WORD wSelector;
GLOBALARENA *pArena; GLOBALARENA *pArena;
wSelector = GLOBAL_CreateBlock(GMEM_FIXED, lpBlock, size, hModule, WINE_LDT_FLAGS_DATA ); wSelector = GLOBAL_CreateBlock(GMEM_FIXED, lpBlock, size, hModule, LDT_FLAGS_DATA );
pArena = GET_ARENA_PTR(wSelector); pArena = GET_ARENA_PTR(wSelector);
pArena->flags |= GA_DOSMEM; pArena->flags |= GA_DOSMEM;
return MAKELONG(wSelector,uParagraph); return MAKELONG(wSelector,uParagraph);
......
...@@ -174,7 +174,6 @@ static BYTE *INSTR_GetOperandAddr( CONTEXT *context, BYTE *instr, ...@@ -174,7 +174,6 @@ static BYTE *INSTR_GetOperandAddr( CONTEXT *context, BYTE *instr,
int long_addr, int segprefix, int *len ) int long_addr, int segprefix, int *len )
{ {
int mod, rm, base = 0, index = 0, ss = 0, seg = 0, off; int mod, rm, base = 0, index = 0, ss = 0, seg = 0, off;
LDT_ENTRY entry;
#define GET_VAL(val,type) \ #define GET_VAL(val,type) \
{ *val = *(type *)instr; instr += sizeof(type); *len += sizeof(type); } { *val = *(type *)instr; instr += sizeof(type); *len += sizeof(type); }
...@@ -317,10 +316,9 @@ static BYTE *INSTR_GetOperandAddr( CONTEXT *context, BYTE *instr, ...@@ -317,10 +316,9 @@ static BYTE *INSTR_GetOperandAddr( CONTEXT *context, BYTE *instr,
/* Make sure the segment and offset are valid */ /* Make sure the segment and offset are valid */
if (ldt_is_system(seg)) return (BYTE *)(base + (index << ss)); if (ldt_is_system(seg)) return (BYTE *)(base + (index << ss));
if ((seg & 7) != 7) return NULL; if ((seg & 7) != 7) return NULL;
if (!ldt_get_entry( seg, &entry )) return NULL; if (!ldt_is_valid( seg )) return NULL;
if (wine_ldt_is_empty( &entry )) return NULL; if (ldt_get_limit( seg ) < (base + (index << ss))) return NULL;
if (wine_ldt_get_limit(&entry) < (base + (index << ss))) return NULL; return (BYTE *)ldt_get_base( seg ) + base + (index << ss);
return (BYTE *)wine_ldt_get_base(&entry) + base + (index << ss);
#undef GET_VAL #undef GET_VAL
} }
......
...@@ -240,20 +240,16 @@ void WINAPI DOSVM_Int31Handler( CONTEXT *context ) ...@@ -240,20 +240,16 @@ void WINAPI DOSVM_Int31Handler( CONTEXT *context )
case 0x0006: /* Get selector base address */ case 0x0006: /* Get selector base address */
TRACE( "get selector base address (0x%04x)\n", BX_reg(context) ); TRACE( "get selector base address (0x%04x)\n", BX_reg(context) );
if (!ldt_is_valid( BX_reg(context) ))
{ {
LDT_ENTRY entry; context->Eax = 0x8022; /* invalid selector */
SET_CFLAG(context);
if (!ldt_get_entry( BX_reg(context), &entry ) || wine_ldt_is_empty(&entry)) }
{ else
context->Eax = 0x8022; /* invalid selector */ {
SET_CFLAG(context); void *base = ldt_get_base( BX_reg(context) );
} SET_CX( context, HIWORD(base) );
else SET_DX( context, LOWORD(base) );
{
void *base = wine_ldt_get_base(&entry);
SET_CX( context, HIWORD(base) );
SET_DX( context, LOWORD(base) );
}
} }
break; break;
......
...@@ -129,7 +129,7 @@ BOOL WINAPI KERNEL_DllEntryPoint( DWORD reasion, HINSTANCE16 inst, WORD ds, ...@@ -129,7 +129,7 @@ BOOL WINAPI KERNEL_DllEntryPoint( DWORD reasion, HINSTANCE16 inst, WORD ds,
#define SET_ENTRY_POINT( num, addr ) \ #define SET_ENTRY_POINT( num, addr ) \
NE_SetEntryPoint( inst, (num), GLOBAL_CreateBlock( GMEM_FIXED, \ NE_SetEntryPoint( inst, (num), GLOBAL_CreateBlock( GMEM_FIXED, \
DOSMEM_MapDosToLinear(addr), 0x10000, inst, \ DOSMEM_MapDosToLinear(addr), 0x10000, inst, \
WINE_LDT_FLAGS_DATA )) LDT_FLAGS_DATA ))
SET_ENTRY_POINT( 174, 0xa0000 ); /* KERNEL.174: __A000H */ SET_ENTRY_POINT( 174, 0xa0000 ); /* KERNEL.174: __A000H */
SET_ENTRY_POINT( 181, 0xb0000 ); /* KERNEL.181: __B000H */ SET_ENTRY_POINT( 181, 0xb0000 ); /* KERNEL.181: __B000H */
......
...@@ -232,8 +232,26 @@ extern void NE_DllProcessAttach( HMODULE16 hModule ) DECLSPEC_HIDDEN; ...@@ -232,8 +232,26 @@ extern void NE_DllProcessAttach( HMODULE16 hModule ) DECLSPEC_HIDDEN;
extern void NE_CallUserSignalProc( HMODULE16 hModule, UINT16 code ) DECLSPEC_HIDDEN; extern void NE_CallUserSignalProc( HMODULE16 hModule, UINT16 code ) DECLSPEC_HIDDEN;
/* selector.c */ /* selector.c */
#define LDT_SIZE 8192
struct ldt_copy
{
void *base[LDT_SIZE];
unsigned int limit[LDT_SIZE];
unsigned char flags[LDT_SIZE];
};
extern const struct ldt_copy *ldt_copy DECLSPEC_HIDDEN;
#define LDT_FLAGS_DATA 0x13 /* Data segment */
#define LDT_FLAGS_CODE 0x1b /* Code segment */
#define LDT_FLAGS_32BIT 0x40 /* Segment is 32-bit (code or stack) */
static inline void *ldt_get_base( WORD sel ) { return ldt_copy->base[sel >> 3]; }
static inline unsigned int ldt_get_limit( WORD sel ) { return ldt_copy->limit[sel >> 3]; }
static inline unsigned char ldt_get_flags( WORD sel ) { return ldt_copy->flags[sel >> 3]; }
extern void init_selectors(void) DECLSPEC_HIDDEN; extern void init_selectors(void) DECLSPEC_HIDDEN;
extern BOOL ldt_is_system( WORD sel ) DECLSPEC_HIDDEN; extern BOOL ldt_is_system( WORD sel ) DECLSPEC_HIDDEN;
extern BOOL ldt_is_valid( WORD sel ) DECLSPEC_HIDDEN;
extern void *ldt_get_ptr( WORD sel, DWORD offset ) DECLSPEC_HIDDEN; extern void *ldt_get_ptr( WORD sel, DWORD offset ) DECLSPEC_HIDDEN;
extern BOOL ldt_get_entry( WORD sel, LDT_ENTRY *entry ) DECLSPEC_HIDDEN; extern BOOL ldt_get_entry( WORD sel, LDT_ENTRY *entry ) DECLSPEC_HIDDEN;
extern void ldt_set_entry( WORD sel, LDT_ENTRY entry ) DECLSPEC_HIDDEN; extern void ldt_set_entry( WORD sel, LDT_ENTRY entry ) DECLSPEC_HIDDEN;
...@@ -241,7 +259,7 @@ extern WORD SELECTOR_AllocBlock( const void *base, DWORD size, unsigned char fla ...@@ -241,7 +259,7 @@ extern WORD SELECTOR_AllocBlock( const void *base, DWORD size, unsigned char fla
extern WORD SELECTOR_ReallocBlock( WORD sel, const void *base, DWORD size ) DECLSPEC_HIDDEN; extern WORD SELECTOR_ReallocBlock( WORD sel, const void *base, DWORD size ) DECLSPEC_HIDDEN;
extern void SELECTOR_FreeBlock( WORD sel ) DECLSPEC_HIDDEN; extern void SELECTOR_FreeBlock( WORD sel ) DECLSPEC_HIDDEN;
#define IS_SELECTOR_32BIT(sel) \ #define IS_SELECTOR_32BIT(sel) \
(ldt_is_system(sel) || (wine_ldt_copy.flags[LOWORD(sel) >> 3] & WINE_LDT_FLAGS_32BIT)) (ldt_is_system(sel) || (ldt_copy->flags[LOWORD(sel) >> 3] & LDT_FLAGS_32BIT))
/* relay16.c */ /* relay16.c */
extern int relay_call_from_16( void *entry_point, unsigned char *args16, CONTEXT *context ) DECLSPEC_HIDDEN; extern int relay_call_from_16( void *entry_point, unsigned char *args16, CONTEXT *context ) DECLSPEC_HIDDEN;
......
...@@ -1785,8 +1785,8 @@ HANDLE WINAPI Local32Init16( WORD segment, DWORD tableSize, ...@@ -1785,8 +1785,8 @@ HANDLE WINAPI Local32Init16( WORD segment, DWORD tableSize,
nrBlocks = (totSize + 0x7fff) >> 15; nrBlocks = (totSize + 0x7fff) >> 15;
selectorTable = HeapAlloc( header->heap, 0, nrBlocks * 2 ); selectorTable = HeapAlloc( header->heap, 0, nrBlocks * 2 );
selectorEven = SELECTOR_AllocBlock( base, totSize, WINE_LDT_FLAGS_DATA ); selectorEven = SELECTOR_AllocBlock( base, totSize, LDT_FLAGS_DATA );
selectorOdd = SELECTOR_AllocBlock( base + 0x8000, totSize - 0x8000, WINE_LDT_FLAGS_DATA ); selectorOdd = SELECTOR_AllocBlock( base + 0x8000, totSize - 0x8000, LDT_FLAGS_DATA );
if ( !selectorTable || !selectorEven || !selectorOdd ) if ( !selectorTable || !selectorEven || !selectorOdd )
{ {
HeapFree( header->heap, 0, selectorTable ); HeapFree( header->heap, 0, selectorTable );
......
...@@ -921,7 +921,7 @@ static HMODULE16 NE_DoLoadBuiltinModule( const IMAGE_DOS_HEADER *mz_header, cons ...@@ -921,7 +921,7 @@ static HMODULE16 NE_DoLoadBuiltinModule( const IMAGE_DOS_HEADER *mz_header, cons
} }
patch_code_segment( pModule ); patch_code_segment( pModule );
*(void **)mz_header->e_res2 = &wine_ldt_copy; *(const void **)mz_header->e_res2 = ldt_copy->base;
return hInstance; return hInstance;
} }
......
...@@ -1018,8 +1018,8 @@ BOOL NE_CreateSegment( NE_MODULE *pModule, int segnum ) ...@@ -1018,8 +1018,8 @@ BOOL NE_CreateSegment( NE_MODULE *pModule, int segnum )
if ( segnum == SELECTOROF(pModule->ne_sssp) ) minsize += pModule->ne_stack; if ( segnum == SELECTOROF(pModule->ne_sssp) ) minsize += pModule->ne_stack;
if ( segnum == pModule->ne_autodata ) minsize += pModule->ne_heap; if ( segnum == pModule->ne_autodata ) minsize += pModule->ne_heap;
selflags = (pSeg->flags & NE_SEGFLAGS_DATA) ? WINE_LDT_FLAGS_DATA : WINE_LDT_FLAGS_CODE; selflags = (pSeg->flags & NE_SEGFLAGS_DATA) ? LDT_FLAGS_DATA : LDT_FLAGS_CODE;
if (pSeg->flags & NE_SEGFLAGS_32BIT) selflags |= WINE_LDT_FLAGS_32BIT; if (pSeg->flags & NE_SEGFLAGS_32BIT) selflags |= LDT_FLAGS_32BIT;
pSeg->hSeg = GLOBAL_Alloc( NE_Ne2MemFlags(pSeg->flags), minsize, pModule->self, selflags ); pSeg->hSeg = GLOBAL_Alloc( NE_Ne2MemFlags(pSeg->flags), minsize, pModule->self, selflags );
if (!pSeg->hSeg) return FALSE; if (!pSeg->hSeg) return FALSE;
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(selector); WINE_DEFAULT_DEBUG_CHANNEL(selector);
#define LDT_SIZE 8192 const struct ldt_copy *ldt_copy = NULL;
static ULONG bitmap_data[LDT_SIZE / 32]; static ULONG bitmap_data[LDT_SIZE / 32];
static RTL_BITMAP ldt_bitmap = { LDT_SIZE, bitmap_data }; static RTL_BITMAP ldt_bitmap = { LDT_SIZE, bitmap_data };
...@@ -40,7 +40,7 @@ static WORD first_ldt_entry = 32; ...@@ -40,7 +40,7 @@ static WORD first_ldt_entry = 32;
/* get the number of selectors needed to cover up to the selector limit */ /* get the number of selectors needed to cover up to the selector limit */
static inline WORD get_sel_count( WORD sel ) static inline WORD get_sel_count( WORD sel )
{ {
return (wine_ldt_copy.limit[sel >> __AHSHIFT] >> 16) + 1; return (ldt_get_limit( sel ) >> 16) + 1;
} }
static inline int is_gdt_sel( WORD sel ) static inline int is_gdt_sel( WORD sel )
...@@ -48,6 +48,25 @@ static inline int is_gdt_sel( WORD sel ) ...@@ -48,6 +48,25 @@ static inline int is_gdt_sel( WORD sel )
return !(sel & 4); return !(sel & 4);
} }
static LDT_ENTRY ldt_make_entry( const void *base, unsigned int limit, unsigned char flags )
{
LDT_ENTRY entry;
entry.BaseLow = (WORD)(ULONG_PTR)base;
entry.HighWord.Bits.BaseMid = (BYTE)((ULONG_PTR)base >> 16);
entry.HighWord.Bits.BaseHi = (BYTE)((ULONG_PTR)base >> 24);
if ((entry.HighWord.Bits.Granularity = (limit >= 0x100000))) limit >>= 12;
entry.LimitLow = (WORD)limit;
entry.HighWord.Bits.LimitHi = limit >> 16;
entry.HighWord.Bits.Dpl = 3;
entry.HighWord.Bits.Pres = 1;
entry.HighWord.Bits.Type = flags;
entry.HighWord.Bits.Sys = 0;
entry.HighWord.Bits.Reserved_0 = 0;
entry.HighWord.Bits.Default_Big = (flags & LDT_FLAGS_32BIT) != 0;
return entry;
}
/*********************************************************************** /***********************************************************************
* init_selectors * init_selectors
*/ */
...@@ -56,6 +75,7 @@ void init_selectors(void) ...@@ -56,6 +75,7 @@ void init_selectors(void)
if (!is_gdt_sel( wine_get_gs() )) first_ldt_entry += 512; if (!is_gdt_sel( wine_get_gs() )) first_ldt_entry += 512;
if (!is_gdt_sel( wine_get_fs() )) first_ldt_entry += 512; if (!is_gdt_sel( wine_get_fs() )) first_ldt_entry += 512;
RtlSetBits( &ldt_bitmap, 0, first_ldt_entry ); RtlSetBits( &ldt_bitmap, 0, first_ldt_entry );
ldt_copy = (struct ldt_copy *)&wine_ldt_copy;
} }
/*********************************************************************** /***********************************************************************
...@@ -67,15 +87,21 @@ BOOL ldt_is_system( WORD sel ) ...@@ -67,15 +87,21 @@ BOOL ldt_is_system( WORD sel )
} }
/*********************************************************************** /***********************************************************************
* ldt_is_valid
*/
BOOL ldt_is_valid( WORD sel )
{
return !ldt_is_system( sel ) && RtlAreBitsSet( &ldt_bitmap, sel >> 3, 1 );
}
/***********************************************************************
* ldt_get_ptr * ldt_get_ptr
*/ */
void *ldt_get_ptr( WORD sel, DWORD offset ) void *ldt_get_ptr( WORD sel, DWORD offset )
{ {
ULONG index = sel >> 3;
if (ldt_is_system( sel )) return (void *)offset; if (ldt_is_system( sel )) return (void *)offset;
if (!(wine_ldt_copy.flags[index] & WINE_LDT_FLAGS_32BIT)) offset &= 0xffff; if (!(ldt_get_flags( sel ) & LDT_FLAGS_32BIT)) offset &= 0xffff;
return (char *)wine_ldt_copy.base[index] + offset; return (char *)ldt_get_base( sel ) + offset;
} }
/*********************************************************************** /***********************************************************************
...@@ -83,16 +109,12 @@ void *ldt_get_ptr( WORD sel, DWORD offset ) ...@@ -83,16 +109,12 @@ void *ldt_get_ptr( WORD sel, DWORD offset )
*/ */
BOOL ldt_get_entry( WORD sel, LDT_ENTRY *entry ) BOOL ldt_get_entry( WORD sel, LDT_ENTRY *entry )
{ {
ULONG index = sel >> 3; if (!ldt_is_valid( sel ))
if (ldt_is_system( sel ) || !(wine_ldt_copy.flags[index] & WINE_LDT_FLAGS_ALLOCATED))
{ {
*entry = null_entry; *entry = null_entry;
return FALSE; return FALSE;
} }
wine_ldt_set_base( entry, wine_ldt_copy.base[index] ); *entry = ldt_make_entry( ldt_get_base( sel ), ldt_get_limit( sel ), ldt_get_flags( sel ));
wine_ldt_set_limit( entry, wine_ldt_copy.limit[index] );
wine_ldt_set_flags( entry, wine_ldt_copy.flags[index] );
return TRUE; return TRUE;
} }
...@@ -133,10 +155,7 @@ WORD WINAPI AllocSelectorArray16( WORD count ) ...@@ -133,10 +155,7 @@ WORD WINAPI AllocSelectorArray16( WORD count )
if (sel) if (sel)
{ {
LDT_ENTRY entry; LDT_ENTRY entry = ldt_make_entry( 0, 1, LDT_FLAGS_DATA ); /* avoid 0 base and limit */
wine_ldt_set_base( &entry, 0 );
wine_ldt_set_limit( &entry, 1 ); /* avoid 0 base and limit */
wine_ldt_set_flags( &entry, WINE_LDT_FLAGS_DATA );
for (i = 0; i < count; i++) ldt_set_entry( sel + (i << 3), entry ); for (i = 0; i < count; i++) ldt_set_entry( sel + (i << 3), entry );
} }
return sel; return sel;
...@@ -186,15 +205,11 @@ WORD WINAPI FreeSelector16( WORD sel ) ...@@ -186,15 +205,11 @@ WORD WINAPI FreeSelector16( WORD sel )
*/ */
static void SELECTOR_SetEntries( WORD sel, const void *base, DWORD size, unsigned char flags ) static void SELECTOR_SetEntries( WORD sel, const void *base, DWORD size, unsigned char flags )
{ {
LDT_ENTRY entry;
WORD i, count = (size + 0xffff) / 0x10000; WORD i, count = (size + 0xffff) / 0x10000;
wine_ldt_set_flags( &entry, flags );
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
wine_ldt_set_base( &entry, base ); ldt_set_entry( sel + (i << 3), ldt_make_entry( base, size - 1, flags ));
wine_ldt_set_limit( &entry, size - 1 );
ldt_set_entry( sel + (i << 3), entry );
base = (const char *)base + 0x10000; base = (const char *)base + 0x10000;
size -= 0x10000; /* yep, Windows sets limit like that, not 64K sel units */ size -= 0x10000; /* yep, Windows sets limit like that, not 64K sel units */
} }
...@@ -241,12 +256,13 @@ void SELECTOR_FreeBlock( WORD sel ) ...@@ -241,12 +256,13 @@ void SELECTOR_FreeBlock( WORD sel )
*/ */
WORD SELECTOR_ReallocBlock( WORD sel, const void *base, DWORD size ) WORD SELECTOR_ReallocBlock( WORD sel, const void *base, DWORD size )
{ {
LDT_ENTRY entry;
int oldcount, newcount; int oldcount, newcount;
BYTE flags;
if (!size) size = 1; if (!size) size = 1;
if (!ldt_get_entry( sel, &entry )) return sel; if (!ldt_is_valid( sel )) return sel;
oldcount = (wine_ldt_get_limit(&entry) >> 16) + 1; flags = ldt_get_flags( sel );
oldcount = (ldt_get_limit( sel ) >> 16) + 1;
newcount = (size + 0xffff) >> 16; newcount = (size + 0xffff) >> 16;
if (oldcount < newcount) /* we need to add selectors */ if (oldcount < newcount) /* we need to add selectors */
...@@ -267,7 +283,7 @@ WORD SELECTOR_ReallocBlock( WORD sel, const void *base, DWORD size ) ...@@ -267,7 +283,7 @@ WORD SELECTOR_ReallocBlock( WORD sel, const void *base, DWORD size )
{ {
free_entries( sel + (newcount << 3), oldcount - newcount ); free_entries( sel + (newcount << 3), oldcount - newcount );
} }
if (sel) SELECTOR_SetEntries( sel, base, size, wine_ldt_get_flags(&entry) ); if (sel) SELECTOR_SetEntries( sel, base, size, flags );
return sel; return sel;
} }
...@@ -277,12 +293,10 @@ WORD SELECTOR_ReallocBlock( WORD sel, const void *base, DWORD size ) ...@@ -277,12 +293,10 @@ WORD SELECTOR_ReallocBlock( WORD sel, const void *base, DWORD size )
*/ */
WORD WINAPI PrestoChangoSelector16( WORD selSrc, WORD selDst ) WORD WINAPI PrestoChangoSelector16( WORD selSrc, WORD selDst )
{ {
LDT_ENTRY entry; if (!ldt_is_valid( selSrc )) return selDst;
if (!ldt_get_entry( selSrc, &entry )) return selDst;
/* toggle the executable bit */ /* toggle the executable bit */
entry.HighWord.Bits.Type ^= (WINE_LDT_FLAGS_CODE ^ WINE_LDT_FLAGS_DATA); ldt_set_entry( selDst, ldt_make_entry( ldt_get_base( selSrc ), ldt_get_limit( selSrc ),
ldt_set_entry( selDst, entry ); ldt_get_flags( selSrc ) ^ (LDT_FLAGS_CODE ^ LDT_FLAGS_DATA) ));
return selDst; return selDst;
} }
...@@ -294,14 +308,12 @@ WORD WINAPI PrestoChangoSelector16( WORD selSrc, WORD selDst ) ...@@ -294,14 +308,12 @@ WORD WINAPI PrestoChangoSelector16( WORD selSrc, WORD selDst )
WORD WINAPI AllocCStoDSAlias16( WORD sel ) WORD WINAPI AllocCStoDSAlias16( WORD sel )
{ {
WORD newsel; WORD newsel;
LDT_ENTRY entry;
if (!ldt_get_entry( sel, &entry )) return 0; if (!ldt_is_valid( sel )) return 0;
newsel = AllocSelector16( 0 ); newsel = AllocSelector16( 0 );
TRACE("(%04x): returning %04x\n", sel, newsel ); TRACE("(%04x): returning %04x\n", sel, newsel );
if (!newsel) return 0; if (!newsel) return 0;
entry.HighWord.Bits.Type = WINE_LDT_FLAGS_DATA; ldt_set_entry( newsel, ldt_make_entry( ldt_get_base(sel), ldt_get_limit(sel), LDT_FLAGS_DATA ));
ldt_set_entry( newsel, entry );
return newsel; return newsel;
} }
...@@ -312,14 +324,12 @@ WORD WINAPI AllocCStoDSAlias16( WORD sel ) ...@@ -312,14 +324,12 @@ WORD WINAPI AllocCStoDSAlias16( WORD sel )
WORD WINAPI AllocDStoCSAlias16( WORD sel ) WORD WINAPI AllocDStoCSAlias16( WORD sel )
{ {
WORD newsel; WORD newsel;
LDT_ENTRY entry;
if (!ldt_get_entry( sel, &entry )) return 0; if (!ldt_is_valid( sel )) return 0;
newsel = AllocSelector16( 0 ); newsel = AllocSelector16( 0 );
TRACE("(%04x): returning %04x\n", sel, newsel ); TRACE("(%04x): returning %04x\n", sel, newsel );
if (!newsel) return 0; if (!newsel) return 0;
entry.HighWord.Bits.Type = WINE_LDT_FLAGS_CODE; ldt_set_entry( newsel, ldt_make_entry( ldt_get_base(sel), ldt_get_limit(sel), LDT_FLAGS_CODE ));
ldt_set_entry( newsel, entry );
return newsel; return newsel;
} }
...@@ -327,13 +337,13 @@ WORD WINAPI AllocDStoCSAlias16( WORD sel ) ...@@ -327,13 +337,13 @@ WORD WINAPI AllocDStoCSAlias16( WORD sel )
/*********************************************************************** /***********************************************************************
* LongPtrAdd (KERNEL.180) * LongPtrAdd (KERNEL.180)
*/ */
void WINAPI LongPtrAdd16( DWORD ptr, DWORD add ) void WINAPI LongPtrAdd16( SEGPTR ptr, DWORD add )
{ {
LDT_ENTRY entry; WORD sel = SELECTOROF( ptr );
if (!ldt_get_entry( SELECTOROF(ptr), &entry )) return; if (!ldt_is_valid( sel )) return;
wine_ldt_set_base( &entry, (char *)wine_ldt_get_base(&entry) + add ); ldt_set_entry( sel, ldt_make_entry( (char *)ldt_get_base( sel ) + add,
ldt_set_entry( SELECTOROF(ptr), entry ); ldt_get_limit( sel ), ldt_get_flags( sel )));
} }
...@@ -342,12 +352,9 @@ void WINAPI LongPtrAdd16( DWORD ptr, DWORD add ) ...@@ -342,12 +352,9 @@ void WINAPI LongPtrAdd16( DWORD ptr, DWORD add )
*/ */
DWORD WINAPI GetSelectorBase( WORD sel ) DWORD WINAPI GetSelectorBase( WORD sel )
{ {
void *base = wine_ldt_copy.base[sel >> __AHSHIFT];
/* if base points into DOSMEM, assume we have to /* if base points into DOSMEM, assume we have to
* return pointer into physical lower 1MB */ * return pointer into physical lower 1MB */
return DOSMEM_MapLinearToDos( ldt_get_base( sel ));
return DOSMEM_MapLinearToDos( base );
} }
...@@ -356,11 +363,9 @@ DWORD WINAPI GetSelectorBase( WORD sel ) ...@@ -356,11 +363,9 @@ DWORD WINAPI GetSelectorBase( WORD sel )
*/ */
WORD WINAPI SetSelectorBase( WORD sel, DWORD base ) WORD WINAPI SetSelectorBase( WORD sel, DWORD base )
{ {
LDT_ENTRY entry; if (!ldt_is_valid( sel )) return 0;
ldt_set_entry( sel, ldt_make_entry( DOSMEM_MapDosToLinear(base),
if (!ldt_get_entry( sel, &entry )) return 0; ldt_get_limit( sel ), ldt_get_flags( sel )));
wine_ldt_set_base( &entry, DOSMEM_MapDosToLinear(base) );
ldt_set_entry( sel, entry );
return sel; return sel;
} }
...@@ -370,7 +375,7 @@ WORD WINAPI SetSelectorBase( WORD sel, DWORD base ) ...@@ -370,7 +375,7 @@ WORD WINAPI SetSelectorBase( WORD sel, DWORD base )
*/ */
DWORD WINAPI GetSelectorLimit16( WORD sel ) DWORD WINAPI GetSelectorLimit16( WORD sel )
{ {
return wine_ldt_copy.limit[sel >> __AHSHIFT]; return ldt_get_limit( sel );
} }
...@@ -379,11 +384,8 @@ DWORD WINAPI GetSelectorLimit16( WORD sel ) ...@@ -379,11 +384,8 @@ DWORD WINAPI GetSelectorLimit16( WORD sel )
*/ */
WORD WINAPI SetSelectorLimit16( WORD sel, DWORD limit ) WORD WINAPI SetSelectorLimit16( WORD sel, DWORD limit )
{ {
LDT_ENTRY entry; if (!ldt_is_valid( sel )) return 0;
ldt_set_entry( sel, ldt_make_entry( ldt_get_base( sel ), limit, ldt_get_flags( sel )));
if (!ldt_get_entry( sel, &entry )) return 0;
wine_ldt_set_limit( &entry, limit );
ldt_set_entry( sel, entry );
return sel; return sel;
} }
...@@ -416,13 +418,10 @@ WORD WINAPI SelectorAccessRights16( WORD sel, WORD op, WORD val ) ...@@ -416,13 +418,10 @@ WORD WINAPI SelectorAccessRights16( WORD sel, WORD op, WORD val )
BOOL16 WINAPI IsBadCodePtr16( SEGPTR ptr ) BOOL16 WINAPI IsBadCodePtr16( SEGPTR ptr )
{ {
WORD sel = SELECTOROF( ptr ); WORD sel = SELECTOROF( ptr );
LDT_ENTRY entry;
if (!ldt_get_entry( sel, &entry )) return TRUE;
if (wine_ldt_is_empty( &entry )) return TRUE;
/* check for code segment, ignoring conforming, read-only and accessed bits */ /* check for code segment, ignoring conforming, read-only and accessed bits */
if ((entry.HighWord.Bits.Type ^ WINE_LDT_FLAGS_CODE) & 0x18) return TRUE; if ((ldt_get_flags( sel ) ^ LDT_FLAGS_CODE) & 0x18) return TRUE;
if (OFFSETOF(ptr) > wine_ldt_get_limit(&entry)) return TRUE; if (OFFSETOF(ptr) > ldt_get_limit( sel )) return TRUE;
return FALSE; return FALSE;
} }
...@@ -433,15 +432,12 @@ BOOL16 WINAPI IsBadCodePtr16( SEGPTR ptr ) ...@@ -433,15 +432,12 @@ BOOL16 WINAPI IsBadCodePtr16( SEGPTR ptr )
BOOL16 WINAPI IsBadStringPtr16( SEGPTR ptr, UINT16 size ) BOOL16 WINAPI IsBadStringPtr16( SEGPTR ptr, UINT16 size )
{ {
WORD sel = SELECTOROF( ptr ); WORD sel = SELECTOROF( ptr );
LDT_ENTRY entry;
if (!ldt_get_entry( sel, &entry )) return TRUE;
if (wine_ldt_is_empty( &entry )) return TRUE;
/* check for data or readable code segment */ /* check for data or readable code segment */
if (!(entry.HighWord.Bits.Type & 0x10)) return TRUE; /* system descriptor */ if (!(ldt_get_flags( sel ) & 0x10)) return TRUE; /* system descriptor */
if ((entry.HighWord.Bits.Type & 0x0a) == 0x08) return TRUE; /* non-readable code segment */ if ((ldt_get_flags( sel ) & 0x0a) == 0x08) return TRUE; /* non-readable code segment */
if (strlen(MapSL(ptr)) < size) size = strlen(MapSL(ptr)) + 1; if (strlen(MapSL(ptr)) < size) size = strlen(MapSL(ptr)) + 1;
if (size && (OFFSETOF(ptr) + size - 1 > wine_ldt_get_limit(&entry))) return TRUE; if (size && (OFFSETOF(ptr) + size - 1 > ldt_get_limit( sel ))) return TRUE;
return FALSE; return FALSE;
} }
...@@ -452,14 +448,11 @@ BOOL16 WINAPI IsBadStringPtr16( SEGPTR ptr, UINT16 size ) ...@@ -452,14 +448,11 @@ BOOL16 WINAPI IsBadStringPtr16( SEGPTR ptr, UINT16 size )
BOOL16 WINAPI IsBadHugeReadPtr16( SEGPTR ptr, DWORD size ) BOOL16 WINAPI IsBadHugeReadPtr16( SEGPTR ptr, DWORD size )
{ {
WORD sel = SELECTOROF( ptr ); WORD sel = SELECTOROF( ptr );
LDT_ENTRY entry;
if (!ldt_get_entry( sel, &entry )) return TRUE;
if (wine_ldt_is_empty( &entry )) return TRUE;
/* check for data or readable code segment */ /* check for data or readable code segment */
if (!(entry.HighWord.Bits.Type & 0x10)) return TRUE; /* system descriptor */ if (!(ldt_get_flags( sel ) & 0x10)) return TRUE; /* system descriptor */
if ((entry.HighWord.Bits.Type & 0x0a) == 0x08) return TRUE; /* non-readable code segment */ if ((ldt_get_flags( sel ) & 0x0a) == 0x08) return TRUE; /* non-readable code segment */
if (size && (OFFSETOF(ptr) + size - 1 > wine_ldt_get_limit( &entry ))) return TRUE; if (size && (OFFSETOF(ptr) + size - 1 > ldt_get_limit( sel ))) return TRUE;
return FALSE; return FALSE;
} }
...@@ -470,13 +463,10 @@ BOOL16 WINAPI IsBadHugeReadPtr16( SEGPTR ptr, DWORD size ) ...@@ -470,13 +463,10 @@ BOOL16 WINAPI IsBadHugeReadPtr16( SEGPTR ptr, DWORD size )
BOOL16 WINAPI IsBadHugeWritePtr16( SEGPTR ptr, DWORD size ) BOOL16 WINAPI IsBadHugeWritePtr16( SEGPTR ptr, DWORD size )
{ {
WORD sel = SELECTOROF( ptr ); WORD sel = SELECTOROF( ptr );
LDT_ENTRY entry;
if (!ldt_get_entry( sel, &entry )) return TRUE;
if (wine_ldt_is_empty( &entry )) return TRUE;
/* check for writable data segment, ignoring expand-down and accessed flags */ /* check for writable data segment, ignoring expand-down and accessed flags */
if ((entry.HighWord.Bits.Type ^ WINE_LDT_FLAGS_DATA) & ~5) return TRUE; if ((ldt_get_flags( sel ) ^ LDT_FLAGS_DATA) & 0x1a) return TRUE;
if (size && (OFFSETOF(ptr) + size - 1 > wine_ldt_get_limit( &entry ))) return TRUE; if (size && (OFFSETOF(ptr) + size - 1 > ldt_get_limit( sel ))) return TRUE;
return FALSE; return FALSE;
} }
...@@ -550,7 +540,7 @@ SEGPTR WINAPI MapLS( LPCVOID ptr ) ...@@ -550,7 +540,7 @@ SEGPTR WINAPI MapLS( LPCVOID ptr )
if (!free) /* no free entry found, create a new one */ if (!free) /* no free entry found, create a new one */
{ {
if (!(free = HeapAlloc( GetProcessHeap(), 0, sizeof(*free) ))) goto done; if (!(free = HeapAlloc( GetProcessHeap(), 0, sizeof(*free) ))) goto done;
if (!(free->sel = SELECTOR_AllocBlock( base, 0x10000, WINE_LDT_FLAGS_DATA ))) if (!(free->sel = SELECTOR_AllocBlock( base, 0x10000, LDT_FLAGS_DATA )))
{ {
HeapFree( GetProcessHeap(), 0, free ); HeapFree( GetProcessHeap(), 0, free );
goto done; goto done;
...@@ -598,7 +588,7 @@ void WINAPI UnMapLS( SEGPTR sptr ) ...@@ -598,7 +588,7 @@ void WINAPI UnMapLS( SEGPTR sptr )
*/ */
LPVOID WINAPI MapSL( SEGPTR sptr ) LPVOID WINAPI MapSL( SEGPTR sptr )
{ {
return (char *)wine_ldt_copy.base[SELECTOROF(sptr) >> __AHSHIFT] + OFFSETOF(sptr); return (char *)ldt_get_base( SELECTOROF(sptr) ) + OFFSETOF(sptr);
} }
/*********************************************************************** /***********************************************************************
......
...@@ -107,7 +107,7 @@ SNOOP16_RegisterDLL(HMODULE16 hModule,LPCSTR name) { ...@@ -107,7 +107,7 @@ SNOOP16_RegisterDLL(HMODULE16 hModule,LPCSTR name) {
TRACE("hmod=%x, name=%s\n", hModule, name); TRACE("hmod=%x, name=%s\n", hModule, name);
if (!snr) { if (!snr) {
xsnr=GLOBAL_Alloc(GMEM_ZEROINIT,2*sizeof(*snr),0,WINE_LDT_FLAGS_CODE|WINE_LDT_FLAGS_32BIT); xsnr=GLOBAL_Alloc(GMEM_ZEROINIT,2*sizeof(*snr),0,LDT_FLAGS_CODE | LDT_FLAGS_32BIT);
snr = GlobalLock16(xsnr); snr = GlobalLock16(xsnr);
snr[0].pushbp = 0x5566; snr[0].pushbp = 0x5566;
snr[0].pusheax = 0x50; snr[0].pusheax = 0x50;
...@@ -152,7 +152,7 @@ SNOOP16_RegisterDLL(HMODULE16 hModule,LPCSTR name) { ...@@ -152,7 +152,7 @@ SNOOP16_RegisterDLL(HMODULE16 hModule,LPCSTR name) {
strcpy( (*dll)->name, name ); strcpy( (*dll)->name, name );
if ((q=strrchr((*dll)->name,'.'))) if ((q=strrchr((*dll)->name,'.')))
*q='\0'; *q='\0';
(*dll)->funhandle = GlobalHandleToSel16(GLOBAL_Alloc(GMEM_ZEROINIT,65535,0,WINE_LDT_FLAGS_CODE)); (*dll)->funhandle = GlobalHandleToSel16(GLOBAL_Alloc(GMEM_ZEROINIT,65535,0,LDT_FLAGS_CODE));
(*dll)->funs = GlobalLock16((*dll)->funhandle); (*dll)->funs = GlobalLock16((*dll)->funhandle);
if (!(*dll)->funs) { if (!(*dll)->funs) {
HeapFree(GetProcessHeap(),0,*dll); HeapFree(GetProcessHeap(),0,*dll);
...@@ -270,7 +270,7 @@ static void WINAPI SNOOP16_Entry(FARPROC proc, LPBYTE args, CONTEXT *context) { ...@@ -270,7 +270,7 @@ static void WINAPI SNOOP16_Entry(FARPROC proc, LPBYTE args, CONTEXT *context) {
rets = &((*rets)->next); rets = &((*rets)->next);
} }
if (!*rets) { if (!*rets) {
HANDLE16 hand = GlobalHandleToSel16(GLOBAL_Alloc(GMEM_ZEROINIT,65535,0,WINE_LDT_FLAGS_CODE)); HANDLE16 hand = GlobalHandleToSel16(GLOBAL_Alloc(GMEM_ZEROINIT,65535,0,LDT_FLAGS_CODE));
*rets = GlobalLock16(hand); *rets = GlobalLock16(hand);
(*rets)->rethandle = hand; (*rets)->rethandle = hand;
i = 0; /* entry 0 is free */ i = 0; /* entry 0 is free */
......
...@@ -201,7 +201,7 @@ static SEGPTR TASK_AllocThunk(void) ...@@ -201,7 +201,7 @@ static SEGPTR TASK_AllocThunk(void)
if (!sel) /* Allocate a new segment */ if (!sel) /* Allocate a new segment */
{ {
sel = GLOBAL_Alloc( GMEM_FIXED, FIELD_OFFSET( THUNKS, thunks[MIN_THUNKS] ), sel = GLOBAL_Alloc( GMEM_FIXED, FIELD_OFFSET( THUNKS, thunks[MIN_THUNKS] ),
pTask->hPDB, WINE_LDT_FLAGS_CODE ); pTask->hPDB, LDT_FLAGS_CODE );
if (!sel) return 0; if (!sel) return 0;
TASK_CreateThunks( sel, 0, MIN_THUNKS ); TASK_CreateThunks( sel, 0, MIN_THUNKS );
pThunk->next = sel; pThunk->next = sel;
...@@ -300,7 +300,7 @@ static TDB *TASK_Create( NE_MODULE *pModule, UINT16 cmdShow, LPCSTR cmdline, BYT ...@@ -300,7 +300,7 @@ static TDB *TASK_Create( NE_MODULE *pModule, UINT16 cmdShow, LPCSTR cmdline, BYT
/* Allocate a selector for the PDB */ /* Allocate a selector for the PDB */
pTask->hPDB = GLOBAL_CreateBlock( GMEM_FIXED, &pTask->pdb, sizeof(PDB16), pTask->hPDB = GLOBAL_CreateBlock( GMEM_FIXED, &pTask->pdb, sizeof(PDB16),
hModule, WINE_LDT_FLAGS_DATA ); hModule, LDT_FLAGS_DATA );
/* Fill the PDB */ /* Fill the PDB */
...@@ -341,7 +341,7 @@ static TDB *TASK_Create( NE_MODULE *pModule, UINT16 cmdShow, LPCSTR cmdline, BYT ...@@ -341,7 +341,7 @@ static TDB *TASK_Create( NE_MODULE *pModule, UINT16 cmdShow, LPCSTR cmdline, BYT
/* Allocate a code segment alias for the TDB */ /* Allocate a code segment alias for the TDB */
pTask->hCSAlias = GLOBAL_CreateBlock( GMEM_FIXED, pTask, sizeof(TDB), pTask->hCSAlias = GLOBAL_CreateBlock( GMEM_FIXED, pTask, sizeof(TDB),
pTask->hPDB, WINE_LDT_FLAGS_CODE ); pTask->hPDB, LDT_FLAGS_CODE );
/* Default DTA overwrites command line */ /* Default DTA overwrites command line */
......
...@@ -1075,7 +1075,7 @@ AllocSLCallback( ...@@ -1075,7 +1075,7 @@ AllocSLCallback(
*(DWORD*)(thunk+18) = GetCurrentProcessId(); *(DWORD*)(thunk+18) = GetCurrentProcessId();
sel = SELECTOR_AllocBlock( thunk, 32, WINE_LDT_FLAGS_CODE ); sel = SELECTOR_AllocBlock( thunk, 32, LDT_FLAGS_CODE );
return (sel<<16)|0; return (sel<<16)|0;
} }
...@@ -1617,7 +1617,7 @@ static BOOL THUNK_Init(void) ...@@ -1617,7 +1617,7 @@ static BOOL THUNK_Init(void)
ThunkletHeap = HeapCreate( HEAP_CREATE_ENABLE_EXECUTE, 0x10000, 0x10000 ); ThunkletHeap = HeapCreate( HEAP_CREATE_ENABLE_EXECUTE, 0x10000, 0x10000 );
if (!ThunkletHeap) return FALSE; if (!ThunkletHeap) return FALSE;
ThunkletCodeSel = SELECTOR_AllocBlock( ThunkletHeap, 0x10000, WINE_LDT_FLAGS_CODE ); ThunkletCodeSel = SELECTOR_AllocBlock( ThunkletHeap, 0x10000, LDT_FLAGS_CODE );
thunk = HeapAlloc( ThunkletHeap, 0, 5 ); thunk = HeapAlloc( ThunkletHeap, 0, 5 );
if (!thunk) return FALSE; if (!thunk) return FALSE;
...@@ -2048,8 +2048,7 @@ SEGPTR WINAPI Get16DLLAddress(HMODULE16 handle, LPSTR func_name) ...@@ -2048,8 +2048,7 @@ SEGPTR WINAPI Get16DLLAddress(HMODULE16 handle, LPSTR func_name)
if (!code_sel32) if (!code_sel32)
{ {
if (!ThunkletHeap) THUNK_Init(); if (!ThunkletHeap) THUNK_Init();
code_sel32 = SELECTOR_AllocBlock( ThunkletHeap, 0x10000, code_sel32 = SELECTOR_AllocBlock( ThunkletHeap, 0x10000, LDT_FLAGS_CODE | LDT_FLAGS_32BIT );
WINE_LDT_FLAGS_CODE | WINE_LDT_FLAGS_32BIT );
if (!code_sel32) return 0; if (!code_sel32) return 0;
} }
if (!(thunk = HeapAlloc( ThunkletHeap, 0, 32 ))) return 0; if (!(thunk = HeapAlloc( ThunkletHeap, 0, 32 ))) return 0;
......
...@@ -59,7 +59,7 @@ BOOL WOWTHUNK_Init(void) ...@@ -59,7 +59,7 @@ BOOL WOWTHUNK_Init(void)
/* allocate the code selector for CallTo16 routines */ /* allocate the code selector for CallTo16 routines */
WORD codesel = SELECTOR_AllocBlock( __wine_call16_start, WORD codesel = SELECTOR_AllocBlock( __wine_call16_start,
(BYTE *)(&CallTo16_TebSelector + 1) - __wine_call16_start, (BYTE *)(&CallTo16_TebSelector + 1) - __wine_call16_start,
WINE_LDT_FLAGS_CODE | WINE_LDT_FLAGS_32BIT ); LDT_FLAGS_CODE | LDT_FLAGS_32BIT );
if (!codesel) return FALSE; if (!codesel) return FALSE;
/* Patch the return addresses for CallTo16 routines */ /* Patch the return addresses for CallTo16 routines */
......
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