diff --git a/debugger/dbgmain.c b/debugger/dbgmain.c index 73b1ef059f9..eb0a5b631b5 100644 --- a/debugger/dbgmain.c +++ b/debugger/dbgmain.c @@ -6,7 +6,6 @@ #include #include #include "config.h" -#include "ldt.h" #include "windows.h" #include "toolhelp.h" #include "debugger.h" diff --git a/dlls/commdlg/filedlg95.c b/dlls/commdlg/filedlg95.c index fddfce4c7d4..3ba4f130166 100644 --- a/dlls/commdlg/filedlg95.c +++ b/dlls/commdlg/filedlg95.c @@ -41,7 +41,6 @@ #include "winbase.h" #include "ntddk.h" #include "winnls.h" -#include "ldt.h" #include "heap.h" #include "commdlg.h" #include "dlgs.h" diff --git a/dlls/gdi/gdi_main.c b/dlls/gdi/gdi_main.c index f71d6e17d3c..f468a72fc34 100644 --- a/dlls/gdi/gdi_main.c +++ b/dlls/gdi/gdi_main.c @@ -7,7 +7,6 @@ #include "wine/winbase16.h" #include "gdi.h" -#include "global.h" #include "tweak.h" #include "win16drv.h" #include "winbase.h" diff --git a/dlls/oleaut32/oleaut.c b/dlls/oleaut32/oleaut.c index 50e8b78fcfb..b5b63bc1056 100644 --- a/dlls/oleaut32/oleaut.c +++ b/dlls/oleaut32/oleaut.c @@ -10,7 +10,6 @@ #include "ole2.h" #include "heap.h" -#include "ldt.h" #include "debugtools.h" DEFAULT_DEBUG_CHANNEL(ole); diff --git a/dlls/user/resource.c b/dlls/user/resource.c index 0da63f2b973..d8d40dcd365 100644 --- a/dlls/user/resource.c +++ b/dlls/user/resource.c @@ -13,7 +13,6 @@ #include "wine/winuser16.h" #include "heap.h" -#include "ldt.h" #include "debugtools.h" DEFAULT_DEBUG_CHANNEL(resource); diff --git a/dlls/winaspi/winaspi32.c b/dlls/winaspi/winaspi32.c index ca52b504cac..3f490b0c367 100644 --- a/dlls/winaspi/winaspi32.c +++ b/dlls/winaspi/winaspi32.c @@ -17,7 +17,6 @@ #include "options.h" #include "heap.h" #include "debugtools.h" -#include "ldt.h" DEFAULT_DEBUG_CHANNEL(aspi); diff --git a/dlls/winmm/wineoss/audio.c b/dlls/winmm/wineoss/audio.c index c349148e6ed..ec04d254b6e 100644 --- a/dlls/winmm/wineoss/audio.c +++ b/dlls/winmm/wineoss/audio.c @@ -37,7 +37,6 @@ #include "dsdriver.h" #include "oss.h" #include "heap.h" -#include "ldt.h" #include "debugtools.h" DEFAULT_DEBUG_CHANNEL(wave); diff --git a/dlls/winmm/wineoss/midi.c b/dlls/winmm/wineoss/midi.c index ede39f58893..fe1c9d8d2e6 100644 --- a/dlls/winmm/wineoss/midi.c +++ b/dlls/winmm/wineoss/midi.c @@ -25,7 +25,6 @@ #include "oss.h" #include "debugtools.h" #include "heap.h" -#include "ldt.h" DEFAULT_DEBUG_CHANNEL(midi); diff --git a/graphics/enhmetafiledrv/init.c b/graphics/enhmetafiledrv/init.c index 796fc72a981..6d644ac1099 100644 --- a/graphics/enhmetafiledrv/init.c +++ b/graphics/enhmetafiledrv/init.c @@ -10,7 +10,6 @@ #include "wingdi.h" #include "gdi.h" #include "heap.h" -#include "global.h" #include "enhmetafile.h" #include "enhmetafiledrv.h" #include "debugtools.h" diff --git a/graphics/metafiledrv/init.c b/graphics/metafiledrv/init.c index 442f3cbdc01..760d04832fe 100644 --- a/graphics/metafiledrv/init.c +++ b/graphics/metafiledrv/init.c @@ -8,7 +8,6 @@ #include "wine/winbase16.h" #include "gdi.h" #include "heap.h" -#include "global.h" #include "metafile.h" #include "metafiledrv.h" #include "debugtools.h" diff --git a/graphics/x11drv/bitmap.c b/graphics/x11drv/bitmap.c index 181a268505a..ab10c80a7ad 100644 --- a/graphics/x11drv/bitmap.c +++ b/graphics/x11drv/bitmap.c @@ -17,7 +17,6 @@ #include "bitmap.h" #include "heap.h" #include "debugtools.h" -#include "local.h" #include "x11drv.h" #include "wingdi.h" #include "windef.h" diff --git a/graphics/x11drv/brush.c b/graphics/x11drv/brush.c index ee17da10442..b4a74f8a2a6 100644 --- a/graphics/x11drv/brush.c +++ b/graphics/x11drv/brush.c @@ -14,7 +14,6 @@ #include "color.h" #include "x11drv.h" #include "debugtools.h" -#include "local.h" DEFAULT_DEBUG_CHANNEL(gdi); diff --git a/graphics/x11drv/clipping.c b/graphics/x11drv/clipping.c index 0f3070772ae..c71833a3576 100644 --- a/graphics/x11drv/clipping.c +++ b/graphics/x11drv/clipping.c @@ -15,7 +15,6 @@ #include "region.h" #include "debugtools.h" #include "heap.h" -#include "local.h" DEFAULT_DEBUG_CHANNEL(x11drv); diff --git a/graphics/x11drv/objects.c b/graphics/x11drv/objects.c index 8ea488a14ee..cb5377c525e 100644 --- a/graphics/x11drv/objects.c +++ b/graphics/x11drv/objects.c @@ -13,7 +13,6 @@ #include "brush.h" #include "font.h" #include "pen.h" -#include "local.h" #include "debugtools.h" DEFAULT_DEBUG_CHANNEL(gdi); diff --git a/graphics/x11drv/oembitmap.c b/graphics/x11drv/oembitmap.c index b5138ce9900..8970e17cc1c 100644 --- a/graphics/x11drv/oembitmap.c +++ b/graphics/x11drv/oembitmap.c @@ -26,7 +26,6 @@ typedef unsigned long Pixel; #include "debugtools.h" #include "gdi.h" #include "heap.h" -#include "local.h" #include "tweak.h" #include "x11drv.h" diff --git a/graphics/x11drv/xfont.c b/graphics/x11drv/xfont.c index 5057014bbbe..6b690404063 100644 --- a/graphics/x11drv/xfont.c +++ b/graphics/x11drv/xfont.c @@ -31,7 +31,6 @@ #include "options.h" #include "font.h" #include "debugtools.h" -#include "ldt.h" #include "tweak.h" #include "x11font.h" #include "server.h" diff --git a/include/gdi.h b/include/gdi.h index 5020258944f..6dbc8a7acfc 100644 --- a/include/gdi.h +++ b/include/gdi.h @@ -12,8 +12,6 @@ #include "windef.h" #include "wingdi.h" #include "wine/wingdi16.h" -#include "ldt.h" -#include "local.h" #include "path.h" #include diff --git a/include/ldt.h b/include/ldt.h deleted file mode 100644 index 9abd720458f..00000000000 --- a/include/ldt.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * LDT copy - * - * Copyright 1995 Alexandre Julliard - */ - -#ifndef __WINE_LDT_H -#define __WINE_LDT_H - -#include "windef.h" -#include "wine/library.h" - -#define __AHSHIFT 3 /* don't change! */ -#define __AHINCR (1 << __AHSHIFT) - -/* Convert a segmented ptr (16:16) to a linear (32) pointer */ - -#define PTR_SEG_OFF_TO_LIN(seg,off) \ - ((void*)((char*)wine_ldt_copy.base[LOWORD(seg) >> __AHSHIFT] + (unsigned int)(off))) -#define PTR_REAL_TO_LIN(seg,off) \ - ((void*)(((unsigned int)(seg) << 4) + LOWORD(off))) -#define PTR_SEG_TO_LIN(ptr) \ - PTR_SEG_OFF_TO_LIN(SELECTOROF(ptr),OFFSETOF(ptr)) -#define PTR_SEG_OFF_TO_SEGPTR(seg,off) \ - ((SEGPTR)MAKELONG(off,seg)) -#define PTR_SEG_OFF_TO_HUGEPTR(seg,off) \ - PTR_SEG_OFF_TO_SEGPTR( (seg) + (HIWORD(off) << __AHSHIFT), LOWORD(off) ) - -extern UINT W32S_offset; - -#define W32S_APP2WINE(addr) ((addr)? (DWORD)(addr) + W32S_offset : 0) -#define W32S_WINE2APP(addr) ((addr)? (DWORD)(addr) - W32S_offset : 0) - -#define FIRST_LDT_ENTRY_TO_ALLOC 17 - -#define IS_SELECTOR_FREE(sel) (!(wine_ldt_copy.flags[LOWORD(sel) >> __AHSHIFT] & WINE_LDT_FLAGS_ALLOCATED)) - -/* Determine if sel is a system selector (i.e. not managed by Wine) */ -#define IS_SELECTOR_SYSTEM(sel) \ - (!((sel) & 4) || ((LOWORD(sel) >> __AHSHIFT) < FIRST_LDT_ENTRY_TO_ALLOC)) -#define IS_SELECTOR_32BIT(sel) \ - (IS_SELECTOR_SYSTEM(sel) || (wine_ldt_copy.flags[LOWORD(sel) >> __AHSHIFT] & WINE_LDT_FLAGS_32BIT)) - -#endif /* __WINE_LDT_H */ diff --git a/include/miscemu.h b/include/miscemu.h index 61d9854daee..eeaabcfa5eb 100644 --- a/include/miscemu.h +++ b/include/miscemu.h @@ -8,7 +8,7 @@ #define __WINE_MISCEMU_H #include "winnt.h" -#include "ldt.h" +#include "selectors.h" #include "wine/windef16.h" /* msdos/dosconf.c */ @@ -248,6 +248,9 @@ extern void WINAPI XMS_Handler(CONTEXT86*); /* misc/aspi.c */ extern void ASPI_DOS_HandleInt(CONTEXT86 *context); +#define PTR_REAL_TO_LIN(seg,off) \ + ((void*)(((unsigned int)(seg) << 4) + LOWORD(off))) + /* NOTE: Interrupts might get called from three modes: real mode, 16-bit, and * (via DeviceIoControl) 32-bit. For automatic conversion of pointer * parameters, interrupt handlers should use CTX_SEG_OFF_TO_LIN with @@ -265,7 +268,7 @@ extern void ASPI_DOS_HandleInt(CONTEXT86 *context); */ #define CTX_SEG_OFF_TO_LIN(context,seg,off) \ (ISV86(context) ? PTR_REAL_TO_LIN((seg),(off)) : \ - (!seg || IS_SELECTOR_SYSTEM(seg))? (void *)(off) : PTR_SEG_OFF_TO_LIN((seg),LOWORD(off))) + (!seg || IS_SELECTOR_SYSTEM(seg))? (void *)(off) : MapSL(MAKESEGPTR((seg),(off)))) #define INT_BARF(context,num) \ ERR( "int%x: unknown/not implemented parameters:\n" \ diff --git a/include/selectors.h b/include/selectors.h index 7949126fddf..6f400948cde 100644 --- a/include/selectors.h +++ b/include/selectors.h @@ -8,35 +8,25 @@ #define __WINE_SELECTORS_H #include "windef.h" -#include "ldt.h" +#include "wine/library.h" extern WORD SELECTOR_AllocBlock( const void *base, DWORD size, unsigned char flags ); extern WORD SELECTOR_ReallocBlock( WORD sel, const void *base, DWORD size ); extern void SELECTOR_FreeBlock( WORD sel ); -#ifdef __i386__ -# ifdef __GNUC__ -# define __DEFINE_GET_SEG(seg) \ - extern inline unsigned short __get_##seg(void) \ - { unsigned short res; __asm__("movw %%" #seg ",%w0" : "=r"(res)); return res; } -# define __DEFINE_SET_SEG(seg) \ - extern inline void __set_##seg(int val) { __asm__("movw %w0,%%" #seg : : "r" (val)); } -# else /* __GNUC__ */ -# define __DEFINE_GET_SEG(seg) extern unsigned short __get_##seg(void); -# define __DEFINE_SET_SEG(seg) extern void __set_##seg(unsigned int); -# endif /* __GNUC__ */ -#else /* __i386__ */ -# define __DEFINE_GET_SEG(seg) static inline unsigned short __get_##seg(void) { return 0; } -# define __DEFINE_SET_SEG(seg) /* nothing */ -#endif /* __i386__ */ +extern UINT W32S_offset; -__DEFINE_GET_SEG(cs) -__DEFINE_GET_SEG(ds) -__DEFINE_GET_SEG(es) -__DEFINE_GET_SEG(fs) -__DEFINE_GET_SEG(gs) -__DEFINE_GET_SEG(ss) -__DEFINE_SET_SEG(fs) -__DEFINE_SET_SEG(gs) +#define W32S_APP2WINE(addr) ((addr)? (DWORD)(addr) + W32S_offset : 0) +#define W32S_WINE2APP(addr) ((addr)? (DWORD)(addr) - W32S_offset : 0) + +#define FIRST_LDT_ENTRY_TO_ALLOC 17 + +#define IS_SELECTOR_FREE(sel) (!(wine_ldt_copy.flags[LOWORD(sel) >> 3] & WINE_LDT_FLAGS_ALLOCATED)) + +/* Determine if sel is a system selector (i.e. not managed by Wine) */ +#define IS_SELECTOR_SYSTEM(sel) \ + (!((sel) & 4) || ((LOWORD(sel) >> 3) < FIRST_LDT_ENTRY_TO_ALLOC)) +#define IS_SELECTOR_32BIT(sel) \ + (IS_SELECTOR_SYSTEM(sel) || (wine_ldt_copy.flags[LOWORD(sel) >> 3] & WINE_LDT_FLAGS_32BIT)) #endif /* __WINE_SELECTORS_H */ diff --git a/misc/lstr.c b/misc/lstr.c index 5e2e87d2483..5b674dbbd70 100644 --- a/misc/lstr.c +++ b/misc/lstr.c @@ -22,7 +22,6 @@ #include "wine/unicode.h" #include "winnls.h" #include "heap.h" -#include "ldt.h" #include "debugtools.h" DEFAULT_DEBUG_CHANNEL(resource); diff --git a/msdos/dosaspi.c b/msdos/dosaspi.c index 7d784bcef55..dc457a99a0a 100644 --- a/msdos/dosaspi.c +++ b/msdos/dosaspi.c @@ -5,7 +5,6 @@ #include "wine/winaspi.h" #include "heap.h" #include "debugtools.h" -#include "selectors.h" #include "miscemu.h" /* DOSMEM_* */ #include "callback.h" #include "winerror.h" diff --git a/msdos/int25.c b/msdos/int25.c index fd030acba7f..24022ca674a 100644 --- a/msdos/int25.c +++ b/msdos/int25.c @@ -7,7 +7,6 @@ #include #include #include "msdos.h" -#include "ldt.h" #include "miscemu.h" #include "drive.h" #include "debugtools.h" diff --git a/msdos/int26.c b/msdos/int26.c index 794aa40d87b..df861df449e 100644 --- a/msdos/int26.c +++ b/msdos/int26.c @@ -6,7 +6,6 @@ #include #include #include "msdos.h" -#include "ldt.h" #include "miscemu.h" #include "drive.h" #include "debugtools.h" diff --git a/objects/gdiobj.c b/objects/gdiobj.c index f84ad5f39c3..057eda0920b 100644 --- a/objects/gdiobj.c +++ b/objects/gdiobj.c @@ -19,6 +19,7 @@ #include "brush.h" #include "font.h" #include "heap.h" +#include "local.h" #include "options.h" #include "palette.h" #include "pen.h" diff --git a/relay32/builtin32.c b/relay32/builtin32.c index 8b9d9745d0b..41dcdae3853 100644 --- a/relay32/builtin32.c +++ b/relay32/builtin32.c @@ -21,7 +21,6 @@ #include "windef.h" #include "wine/winbase16.h" #include "wine/library.h" -#include "global.h" #include "module.h" #include "file.h" #include "heap.h" diff --git a/relay32/relay386.c b/relay32/relay386.c index 8851b123102..16519366f35 100644 --- a/relay32/relay386.c +++ b/relay32/relay386.c @@ -11,7 +11,6 @@ #include "config.h" #include "winnt.h" -#include "selectors.h" #include "stackframe.h" #include "syslevel.h" #include "module.h" diff --git a/relay32/snoop.c b/relay32/snoop.c index 80f96aa04f7..bf6f13bd3fc 100644 --- a/relay32/snoop.c +++ b/relay32/snoop.c @@ -13,7 +13,6 @@ #include "winnt.h" #include "heap.h" #include "snoop.h" -#include "selectors.h" #include "stackframe.h" #include "debugtools.h" #include "wine/exception.h" diff --git a/scheduler/process.c b/scheduler/process.c index c14a9f58d2d..4f573705ff4 100644 --- a/scheduler/process.c +++ b/scheduler/process.c @@ -18,10 +18,8 @@ #include "drive.h" #include "module.h" #include "file.h" -#include "global.h" #include "heap.h" #include "task.h" -#include "ldt.h" #include "thread.h" #include "winerror.h" #include "server.h" diff --git a/scheduler/syslevel.c b/scheduler/syslevel.c index 1b544c1f35a..4de5e79e710 100644 --- a/scheduler/syslevel.c +++ b/scheduler/syslevel.c @@ -9,7 +9,6 @@ #include "ntddk.h" #include "syslevel.h" #include "heap.h" -#include "selectors.h" #include "stackframe.h" #include "debugtools.h" diff --git a/tools/winebuild/spec16.c b/tools/winebuild/spec16.c index 68f4a70f915..a22c81cba8c 100644 --- a/tools/winebuild/spec16.c +++ b/tools/winebuild/spec16.c @@ -801,7 +801,6 @@ void BuildGlue( FILE *outfile, FILE *infile ) fprintf( outfile, "/* File generated automatically from %s; do not edit! */\n\n", input_file_name ); - fprintf( outfile, "#include \"builtin16.h\"\n" ); fprintf( outfile, "#include \"stackframe.h\"\n\n" ); fprintf( outfile, "extern WORD WINAPI wine_call_to_16_word( FARPROC16 target, INT nArgs );\n" ); diff --git a/win32/except.c b/win32/except.c index d606dd718ad..94c9aaf0064 100644 --- a/win32/except.c +++ b/win32/except.c @@ -27,7 +27,6 @@ #include "winerror.h" #include "ntddk.h" #include "wine/exception.h" -#include "selectors.h" #include "callback.h" #include "thread.h" #include "stackframe.h" diff --git a/windows/dce.c b/windows/dce.c index ad2b57faf2c..205f2c77b36 100644 --- a/windows/dce.c +++ b/windows/dce.c @@ -24,7 +24,6 @@ #include "gdi.h" #include "region.h" #include "heap.h" -#include "local.h" #include "user.h" #include "debugtools.h" #include "windef.h" diff --git a/windows/nonclient.c b/windows/nonclient.c index 54be17c9087..ff5d8006f33 100644 --- a/windows/nonclient.c +++ b/windows/nonclient.c @@ -20,7 +20,6 @@ #include "hook.h" #include "nonclient.h" #include "queue.h" -#include "selectors.h" #include "tweak.h" #include "debugtools.h" #include "options.h"