Cygwin: remove miscellaneous 32-bit code

This commit is contained in:
Ken Brown 2022-05-24 14:26:33 -04:00
parent b1e304cbd3
commit e1ce752a1d
47 changed files with 12 additions and 852 deletions

View File

@ -66,7 +66,6 @@ bool NO_COPY wsock_started;
/* LoadDLLprime is used to prime the DLL info information, providing an /* LoadDLLprime is used to prime the DLL info information, providing an
additional initialization routine to call prior to calling the first additional initialization routine to call prior to calling the first
function. */ function. */
#ifdef __x86_64__
#define LoadDLLprime(dllname, init_also, no_resolve_on_fork) __asm__ (" \n\ #define LoadDLLprime(dllname, init_also, no_resolve_on_fork) __asm__ (" \n\
.ifndef " #dllname "_primed \n\ .ifndef " #dllname "_primed \n\
.section .data_cygwin_nocopy,\"w\" \n\ .section .data_cygwin_nocopy,\"w\" \n\
@ -82,25 +81,6 @@ bool NO_COPY wsock_started;
.set " #dllname "_primed, 1 \n\ .set " #dllname "_primed, 1 \n\
.endif \n\ .endif \n\
"); ");
#else
#define LoadDLLprime(dllname, init_also, no_resolve_on_fork) __asm__ (" \n\
.ifndef " #dllname "_primed \n\
.section .data_cygwin_nocopy,\"w\" \n\
.align 4 \n\
."#dllname "_info: \n\
.long _std_dll_init \n\
.long " #no_resolve_on_fork " \n\
.long -1 \n\
.long " #init_also " \n\
.string16 \"" #dllname ".dll\" \n\
.text \n\
.set " #dllname "_primed, 1 \n\
.endif \n\
");
#endif
/* Create a "decorated" name */
#define mangle(name, n) #name "@" #n
/* Standard DLL load macro. May invoke a fatal error if the function isn't /* Standard DLL load macro. May invoke a fatal error if the function isn't
found. */ found. */
@ -112,7 +92,6 @@ bool NO_COPY wsock_started;
LoadDLLfuncEx3(name, n, dllname, notimp, err, 0) LoadDLLfuncEx3(name, n, dllname, notimp, err, 0)
/* Main DLL setup stuff. */ /* Main DLL setup stuff. */
#ifdef __x86_64__
#define LoadDLLfuncEx3(name, n, dllname, notimp, err, no_resolve_on_fork) \ #define LoadDLLfuncEx3(name, n, dllname, notimp, err, no_resolve_on_fork) \
LoadDLLprime (dllname, dll_func_load, no_resolve_on_fork) \ LoadDLLprime (dllname, dll_func_load, no_resolve_on_fork) \
__asm__ (" \n\ __asm__ (" \n\
@ -137,26 +116,6 @@ _win32_" #name ": \n\
.asciz \"" #name "\" \n\ .asciz \"" #name "\" \n\
.text \n\ .text \n\
"); ");
#else
#define LoadDLLfuncEx3(name, n, dllname, notimp, err, no_resolve_on_fork) \
LoadDLLprime (dllname, dll_func_load, no_resolve_on_fork) \
__asm__ (" \n\
.section ." #dllname "_autoload_text,\"wx\" \n\
.global _" mangle (name, n) " \n\
.global _win32_" mangle (name, n) " \n\
.align 8 \n\
_" mangle (name, n) ": \n\
_win32_" mangle (name, n) ": \n\
.byte 0xe9 \n\
.long -4 + 1f - . \n\
1:movl (2f),%eax \n\
call *(%eax) \n\
2:.long ." #dllname "_info \n\
.long (" #n "+" #notimp ") | (((" #err ") & 0xff) <<16) \n\
.asciz \"" #name "\" \n\
.text \n\
");
#endif
/* DLL loader helper functions used during initialization. */ /* DLL loader helper functions used during initialization. */
@ -172,7 +131,6 @@ extern "C" void dll_chain () __asm__ ("dll_chain");
extern "C" { extern "C" {
#ifdef __x86_64__
__asm__ (" \n\ __asm__ (" \n\
.section .rdata,\"r\" \n\ .section .rdata,\"r\" \n\
msg1: \n\ msg1: \n\
@ -234,66 +192,6 @@ dll_chain: \n\
push %rax # Restore 'return address' \n\ push %rax # Restore 'return address' \n\
jmp *%rdx # Jump to next init function \n\ jmp *%rdx # Jump to next init function \n\
"); ");
#else
__asm__ (" \n\
.text \n\
msg1: \n\
.ascii \"couldn't dynamically determine load address for '%s' (handle %p), %E\\0\"\n\
\n\
.align 32 \n\
noload: \n\
popl %edx # Get the address of the information block\n\
movl 4(%edx),%eax # Should we 'ignore' the lack \n\
test $1,%eax # of this function? \n\
jz 1f # Nope. \n\
decl %eax # Yes. This is the # of bytes + 1 \n\
popl %edx # Caller's caller \n\
addl %eax,%esp # Pop off bytes \n\
andl $0xffff0000,%eax# upper word \n\
subl %eax,%esp # adjust for possible return value \n\
pushl %eax # Save return value for later \n\
pushl %edx # Save return address for later \n\
movl $127,%eax # ERROR_PROC_NOT_FOUND \n\
pushl %eax # First argument \n\
call _SetLastError@4 # Set it \n\
popl %edx # Get back return address \n\
popl %eax # Get back return value \n\
sarl $16,%eax # return value in high order word \n\
jmp *%edx # Return \n\
1: \n\
movl (%edx),%eax # Handle value \n\
pushl 4(%eax) \n\
leal 8(%edx),%eax # Location of name of function \n\
pushl %eax \n\
pushl $msg1 # The message \n\
call _api_fatal # Print message. Never returns \n\
\n\
.globl dll_func_load \n\
dll_func_load: \n\
movl (%esp),%eax # 'Return address' contains load info \n\
addl $8,%eax # Address of name of function to load \n\
pushl %eax # Second argument \n\
movl -8(%eax),%eax # Where handle lives \n\
movl 4(%eax),%eax # Address of Handle to DLL \n\
pushl %eax # Handle to DLL \n\
call _GetProcAddress@8# Load it \n\
test %eax,%eax # Success? \n\
jne gotit # Yes \n\
jmp noload # Issue an error or return \n\
gotit: \n\
popl %edx # Pointer to 'return address' \n\
subl %edx,%eax # Make it relative \n\
addl $7,%eax # Tweak \n\
subl $12,%edx # Point to jmp \n\
movl %eax,1(%edx) # Move relative address after jump \n\
jmp *%edx # Jump to actual function \n\
\n\
.global dll_chain \n\
dll_chain: \n\
pushl %eax # Restore 'return address' \n\
jmp *%edx # Jump to next init function \n\
");
#endif
/* C representations of the two info blocks described above. /* C representations of the two info blocks described above.
FIXME: These structures confuse gdb for some reason. GDB can print FIXME: These structures confuse gdb for some reason. GDB can print
@ -311,18 +209,12 @@ struct func_info
{ {
struct dll_info *dll; struct dll_info *dll;
LONG decoration; LONG decoration;
#ifdef __x86_64__
UINT_PTR func_addr; UINT_PTR func_addr;
#endif
char name[]; char name[];
}; };
/* Mechanism for setting up info for passing to dll_chain routines. */ /* Mechanism for setting up info for passing to dll_chain routines. */
#ifdef __x86_64__
typedef __uint128_t two_addr_t; typedef __uint128_t two_addr_t;
#else
typedef __uint64_t two_addr_t;
#endif
union retchain union retchain
{ {
struct {uintptr_t high; uintptr_t low;}; struct {uintptr_t high; uintptr_t low;};
@ -354,7 +246,6 @@ dll_load (HANDLE& handle, PWCHAR name)
#define RETRY_COUNT 10 #define RETRY_COUNT 10
/* The standard DLL initialization routine. */ /* The standard DLL initialization routine. */
#ifdef __x86_64__
/* On x86_64, we need assembler wrappers for std_dll_init and wsock_init. /* On x86_64, we need assembler wrappers for std_dll_init and wsock_init.
In the x86_64 ABI it's no safe bet that frame[1] (aka 8(%rbp)) contains In the x86_64 ABI it's no safe bet that frame[1] (aka 8(%rbp)) contains
@ -396,14 +287,7 @@ INIT_WRAPPER (std_dll_init)
__attribute__ ((used, noinline)) static two_addr_t __attribute__ ((used, noinline)) static two_addr_t
std_dll_init (struct func_info *func) std_dll_init (struct func_info *func)
#else
__attribute__ ((used, noinline)) static two_addr_t
std_dll_init ()
#endif
{ {
#ifdef __i386__
struct func_info *func = (struct func_info *) __builtin_return_address (0);
#endif
struct dll_info *dll = func->dll; struct dll_info *dll = func->dll;
retchain ret; retchain ret;
@ -452,37 +336,22 @@ std_dll_init ()
ret.high = (uintptr_t) func; ret.high = (uintptr_t) func;
InterlockedDecrement (&dll->here); InterlockedDecrement (&dll->here);
#ifdef __i386__
/* Kludge alert. Redirects the return address to dll_chain. */
uintptr_t *volatile frame = (uintptr_t *) __builtin_frame_address (0);
frame[1] = (uintptr_t) dll_chain;
#endif
return ret.ll; return ret.ll;
} }
/* Initialization function for winsock stuff. */ /* Initialization function for winsock stuff. */
#ifdef __x86_64__
/* See above comment preceeding std_dll_init. */ /* See above comment preceeding std_dll_init. */
INIT_WRAPPER (wsock_init) INIT_WRAPPER (wsock_init)
__attribute__ ((used, noinline)) static two_addr_t __attribute__ ((used, noinline)) static two_addr_t
wsock_init (struct func_info *func) wsock_init (struct func_info *func)
#else
__attribute__ ((used, noinline)) static two_addr_t
wsock_init ()
#endif
{ {
/* CV 2016-03-09: Moved wsadata into wsock_init to workaround a problem /* CV 2016-03-09: Moved wsadata into wsock_init to workaround a problem
with the NO_COPY definition of wsadata and here starting with gcc-5.3.0. with the NO_COPY definition of wsadata and here starting with gcc-5.3.0.
See the git log for a description. */ See the git log for a description. */
static WSADATA NO_COPY wsadata; static WSADATA NO_COPY wsadata;
static LONG NO_COPY here = -1L; static LONG NO_COPY here = -1L;
#ifdef __i386__
struct func_info *func = (struct func_info *) __builtin_return_address (0);
#endif
struct dll_info *dll = func->dll; struct dll_info *dll = func->dll;
while (InterlockedIncrement (&here)) while (InterlockedIncrement (&here))
@ -513,15 +382,7 @@ wsock_init ()
wsock_started = 1; wsock_started = 1;
} }
} }
#ifdef __i386__
/* Kludge alert. Redirects the return address to dll_chain. */
uintptr_t *volatile frame = (uintptr_t *) __builtin_frame_address (0);
frame[1] = (uintptr_t) dll_chain;
#endif
InterlockedDecrement (&here); InterlockedDecrement (&here);
volatile retchain ret; volatile retchain ret;
/* Set "arguments for dll_chain. */ /* Set "arguments for dll_chain. */
ret.low = (uintptr_t) dll_func_load; ret.low = (uintptr_t) dll_func_load;
@ -596,10 +457,6 @@ LoadDLLfunc (VirtualAlloc2, 28, KernelBase)
LoadDLLfunc (NtMapViewOfSectionEx, 36, ntdll) LoadDLLfunc (NtMapViewOfSectionEx, 36, ntdll)
/* ldap functions are cdecl! */
#pragma push_macro ("mangle")
#undef mangle
#define mangle(name, n) #name
LoadDLLfunc (ldap_bind_s, 0, wldap32) LoadDLLfunc (ldap_bind_s, 0, wldap32)
LoadDLLfunc (ldap_count_entries, 0, wldap32) LoadDLLfunc (ldap_count_entries, 0, wldap32)
LoadDLLfunc (ldap_count_valuesW, 0, wldap32) LoadDLLfunc (ldap_count_valuesW, 0, wldap32)
@ -620,7 +477,6 @@ LoadDLLfunc (ldap_value_freeW, 0, wldap32)
LoadDLLfunc (ldap_value_free_len, 0, wldap32) LoadDLLfunc (ldap_value_free_len, 0, wldap32)
LoadDLLfunc (LdapGetLastError, 0, wldap32) LoadDLLfunc (LdapGetLastError, 0, wldap32)
LoadDLLfunc (LdapMapErrorToWin32, 0, wldap32) LoadDLLfunc (LdapMapErrorToWin32, 0, wldap32)
#pragma pop_macro ("mangle")
LoadDLLfunc (WNetCloseEnum, 4, mpr) LoadDLLfunc (WNetCloseEnum, 4, mpr)
LoadDLLfunc (WNetEnumResourceW, 16, mpr) LoadDLLfunc (WNetEnumResourceW, 16, mpr)

View File

@ -28,11 +28,7 @@ enum child_status
#define OPROC_MAGIC_MASK 0xff00ff00 #define OPROC_MAGIC_MASK 0xff00ff00
#define OPROC_MAGIC_GENERIC 0xaf00f000 #define OPROC_MAGIC_GENERIC 0xaf00f000
#ifdef __x86_64__
#define PROC_MAGIC_GENERIC 0xaf00fa64 #define PROC_MAGIC_GENERIC 0xaf00fa64
#else /*!x86_64*/
#define PROC_MAGIC_GENERIC 0xaf00fa32
#endif
#define EXEC_MAGIC_SIZE sizeof(child_info) #define EXEC_MAGIC_SIZE sizeof(child_info)

View File

@ -18,7 +18,6 @@ cpuid (uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t ain,
: "a" (ain), "c" (cin)); : "a" (ain), "c" (cin));
} }
#ifdef __x86_64__
static inline bool __attribute ((always_inline)) static inline bool __attribute ((always_inline))
can_set_flag (uint32_t long flag) can_set_flag (uint32_t long flag)
{ {
@ -39,27 +38,5 @@ can_set_flag (uint32_t long flag)
); );
return ((r1 ^ r2) & flag) != 0; return ((r1 ^ r2) & flag) != 0;
} }
#else
static inline bool __attribute ((always_inline))
can_set_flag (uint32_t flag)
{
uint32_t r1, r2;
asm volatile ("pushfl\n"
"popl %0\n"
"movl %0, %1\n"
"xorl %2, %0\n"
"pushl %0\n"
"popfl\n"
"pushfl\n"
"popl %0\n"
"pushl %1\n"
"popfl\n"
: "=&r" (r1), "=&r" (r2)
: "ir" (flag)
);
return ((r1 ^ r2) & flag) != 0;
}
#endif
#endif // !CPUID_H #endif // !CPUID_H

View File

@ -257,11 +257,7 @@ cygheap_init ()
The idea is to have better matching bucket sizes (not wasting The idea is to have better matching bucket sizes (not wasting
space) without trading in performance compared to the old powers space) without trading in performance compared to the old powers
of 2 method. */ of 2 method. */
#ifdef __x86_64__
unsigned sz[2] = { 16, 24 }; /* sizeof cygheap_entry == 16 */ unsigned sz[2] = { 16, 24 }; /* sizeof cygheap_entry == 16 */
#else
unsigned sz[2] = { 8, 12 }; /* sizeof cygheap_entry == 8 */
#endif
for (unsigned b = 1; b < NBUCKETS; b++, sz[b & 1] <<= 1) for (unsigned b = 1; b < NBUCKETS; b++, sz[b & 1] <<= 1)
cygheap->bucket_val[b] = sz[b & 1]; cygheap->bucket_val[b] = sz[b & 1];
/* Default locale settings. */ /* Default locale settings. */

View File

@ -21,9 +21,7 @@ int dlmalloc_trim (size_t);
int dlmallopt (int p, int v); int dlmallopt (int p, int v);
void dlmalloc_stats (); void dlmalloc_stats ();
#ifdef __x86_64__
#define MALLOC_ALIGNMENT ((size_t)16U) #define MALLOC_ALIGNMENT ((size_t)16U)
#endif
#if defined (DLMALLOC_VERSION) /* Building malloc.cc */ #if defined (DLMALLOC_VERSION) /* Building malloc.cc */

View File

@ -147,11 +147,9 @@ _cygtls::cleanup_early (struct _reent *)
/* Do nothing */ /* Do nothing */
} }
#ifdef __x86_64__
void san::leave () void san::leave ()
{ {
/* Restore tls_pathbuf counters in case of error. */ /* Restore tls_pathbuf counters in case of error. */
_my_tls.locals.pathbufs._counters = _cnt; _my_tls.locals.pathbufs._counters = _cnt;
_my_tls.andreas = _clemente; _my_tls.andreas = _clemente;
} }
#endif

View File

@ -37,11 +37,7 @@ details. */
#include "thread.h" #include "thread.h"
#endif #endif
#ifdef __x86_64__
#pragma pack(push,8) #pragma pack(push,8)
#else
#pragma pack(push,4)
#endif
/* Defined here to support auto rebuild of tlsoffsets.h. */ /* Defined here to support auto rebuild of tlsoffsets.h. */
class tls_pathbuf class tls_pathbuf

View File

@ -390,14 +390,6 @@ check_sanity_and_sync (per_process *p)
if (p->api_major > cygwin_version.api_major) if (p->api_major > cygwin_version.api_major)
api_fatal ("cygwin DLL and APP are out of sync -- API version mismatch %u > %u", api_fatal ("cygwin DLL and APP are out of sync -- API version mismatch %u > %u",
p->api_major, cygwin_version.api_major); p->api_major, cygwin_version.api_major);
#ifdef __i386__
/* This is a kludge to work around a version of _cygwin_common_crt0
which overwrote the cxx_malloc field with the local DLL copy.
Hilarity ensues if the DLL is not loaded while the process
is forking. */
__cygwin_user_data.cxx_malloc = &default_cygwin_cxx_malloc;
#endif
} }
child_info NO_COPY *child_proc_info; child_info NO_COPY *child_proc_info;
@ -581,17 +573,10 @@ get_cygwin_startup_info ()
return res; return res;
} }
#ifdef __x86_64__
#define dll_data_start &__data_start__ #define dll_data_start &__data_start__
#define dll_data_end &__data_end__ #define dll_data_end &__data_end__
#define dll_bss_start &__bss_start__ #define dll_bss_start &__bss_start__
#define dll_bss_end &__bss_end__ #define dll_bss_end &__bss_end__
#else
#define dll_data_start &_data_start__
#define dll_data_end &_data_end__
#define dll_bss_start &_bss_start__
#define dll_bss_end &_bss_end__
#endif
void void
child_info_fork::handle_fork () child_info_fork::handle_fork ()
@ -791,10 +776,8 @@ dll_crt0_0 ()
if (!dynamically_loaded) if (!dynamically_loaded)
sigproc_init (); sigproc_init ();
#ifdef __x86_64__
/* See comment preceeding myfault_altstack_handler in exception.cc. */ /* See comment preceeding myfault_altstack_handler in exception.cc. */
AddVectoredContinueHandler (0, myfault_altstack_handler); AddVectoredContinueHandler (0, myfault_altstack_handler);
#endif
debug_printf ("finished dll_crt0_0 initialization"); debug_printf ("finished dll_crt0_0 initialization");
} }
@ -1221,7 +1204,6 @@ cygwin_atexit (void (*fn) (void))
int res; int res;
dll *d = dlls.find ((void *) _my_tls.retaddr ()); dll *d = dlls.find ((void *) _my_tls.retaddr ());
#ifdef __x86_64__
/* x86_64 DLLs created with GCC 4.8.3-3 register __gcc_deregister_frame /* x86_64 DLLs created with GCC 4.8.3-3 register __gcc_deregister_frame
as atexit function using a call to atexit, rather than __cxa_atexit. as atexit function using a call to atexit, rather than __cxa_atexit.
Due to GCC's tail call optimizing, cygwin_atexit doesn't get the correct Due to GCC's tail call optimizing, cygwin_atexit doesn't get the correct
@ -1243,7 +1225,6 @@ cygwin_atexit (void (*fn) (void))
use the statically linked atexit function though, as outlined above. */ use the statically linked atexit function though, as outlined above. */
if (!d) if (!d)
d = dlls.find ((void *) fn); d = dlls.find ((void *) fn);
#endif
res = d ? __cxa_atexit ((void (*) (void *)) fn, NULL, d->handle) : atexit (fn); res = d ? __cxa_atexit ((void (*) (void *)) fn, NULL, d->handle) : atexit (fn);
return res; return res;
} }

View File

@ -272,24 +272,6 @@ dlopen (const char *name, int flags)
break; break;
} }
#ifdef __i386__
/* Workaround for broken DLLs built against Cygwin versions 1.7.0-49
up to 1.7.0-57. They override the cxx_malloc pointer in their
DLL initialization code even if loaded dynamically. This is a
no-no since a later dlclose lets cxx_malloc point into nirvana.
The below kludge "fixes" that by reverting the original cxx_malloc
pointer after LoadLibrary. This implies that their overrides
won't be applied; that's OK. All overrides should be present at
final link time, as Windows doesn't allow undefined references;
it would actually be wrong for a dlopen'd DLL to opportunistically
override functions in a way that wasn't known then. We're not
going to try and reproduce the full ELF dynamic loader here! */
/* Store original cxx_malloc pointer. */
struct per_process_cxx_malloc *tmp_malloc;
tmp_malloc = __cygwin_user_data.cxx_malloc;
#endif
ret = (void *) LoadLibraryW (wpath); ret = (void *) LoadLibraryW (wpath);
/* reference counting */ /* reference counting */
if (ret) if (ret)
@ -299,11 +281,6 @@ dlopen (const char *name, int flags)
++d->count; ++d->count;
} }
#ifdef __i386__
/* Restore original cxx_malloc pointer. */
__cygwin_user_data.cxx_malloc = tmp_malloc;
#endif
if (ret && gmheflags) if (ret && gmheflags)
GetModuleHandleExW (gmheflags, wpath, (HMODULE *) &ret); GetModuleHandleExW (gmheflags, wpath, (HMODULE *) &ret);

View File

@ -873,17 +873,6 @@ dll_dllcrt0_1 (VOID *x)
res = (PVOID) d; res = (PVOID) d;
} }
#ifdef __i386__
/* OBSOLETE: This function is obsolete and will go away in the
future. Cygwin can now handle being loaded from a noncygwin app
using the same entry point. */
extern "C" int
dll_noncygwin_dllcrt0 (HMODULE h, per_process *p)
{
return (int) dll_dllcrt0 (h, p);
}
#endif /* __i386__ */
extern "C" void extern "C" void
cygwin_detach_dll (dll *) cygwin_detach_dll (dll *)
{ {

View File

@ -246,13 +246,6 @@ cygwin_internal (cygwin_getinfo_types t, ...)
break; break;
case CW_USER_DATA: case CW_USER_DATA:
#ifdef __i386__
/* This is a kludge to work around a version of _cygwin_common_crt0
which overwrote the cxx_malloc field with the local DLL copy.
Hilarity ensues if the DLL is not loaded like while the process
is forking. */
__cygwin_user_data.cxx_malloc = &default_cygwin_cxx_malloc;
#endif
res = (uintptr_t) &__cygwin_user_data; res = (uintptr_t) &__cygwin_user_data;
break; break;

View File

@ -1104,9 +1104,7 @@ format_proc_cpuinfo (void *, char *&destbuf)
ftcprint (features2, 12, "acc_power"); /* accum power */ ftcprint (features2, 12, "acc_power"); /* accum power */
} }
#if __x86_64__
ftuprint ("nopl"); /* NOPL (0F 1F) instructions */ ftuprint ("nopl"); /* NOPL (0F 1F) instructions */
#endif
/* cpuid 0x0000000b ecx[8:15] type */ /* cpuid 0x0000000b ecx[8:15] type */
#define BAD_TYPE 0 #define BAD_TYPE 0

View File

@ -9,13 +9,11 @@ details. */
#define __INSIDE_CYGWIN_NET__ #define __INSIDE_CYGWIN_NET__
#define USE_SYS_TYPES_FD_SET #define USE_SYS_TYPES_FD_SET
#include "winsup.h" #include "winsup.h"
#ifdef __x86_64__
/* 2014-04-24: Current Mingw headers define sockaddr_in6 using u_long (8 byte) /* 2014-04-24: Current Mingw headers define sockaddr_in6 using u_long (8 byte)
because a redefinition for LP64 systems is missing. This leads to a wrong because a redefinition for LP64 systems is missing. This leads to a wrong
definition and size of sockaddr_in6 when building with winsock headers. */ definition and size of sockaddr_in6 when building with winsock headers. */
#undef u_long #undef u_long
#define u_long __ms_u_long #define u_long __ms_u_long
#endif
#include <w32api/ws2tcpip.h> #include <w32api/ws2tcpip.h>
#include <w32api/iphlpapi.h> #include <w32api/iphlpapi.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>

View File

@ -12,7 +12,6 @@
#define USE_SYS_TYPES_FD_SET #define USE_SYS_TYPES_FD_SET
#include "winsup.h" #include "winsup.h"
#ifdef __x86_64__
/* 2014-04-24: Current Mingw headers define sockaddr_in6 using u_long (8 byte) /* 2014-04-24: Current Mingw headers define sockaddr_in6 using u_long (8 byte)
because a redefinition for LP64 systems is missing. This leads to a wrong because a redefinition for LP64 systems is missing. This leads to a wrong
definition and size of sockaddr_in6 when building with winsock headers. definition and size of sockaddr_in6 when building with winsock headers.
@ -20,7 +19,6 @@
function calls. */ function calls. */
#undef u_long #undef u_long
#define u_long __ms_u_long #define u_long __ms_u_long
#endif
#include <w32api/ws2tcpip.h> #include <w32api/ws2tcpip.h>
#include <w32api/mswsock.h> #include <w32api/mswsock.h>
#include <w32api/mstcpip.h> #include <w32api/mstcpip.h>
@ -696,13 +694,8 @@ fhandler_socket_wsock::set_socket_handle (SOCKET sock, int af, int type,
debug_printf ("Reset SIO_UDP_CONNRESET: WinSock error %u", debug_printf ("Reset SIO_UDP_CONNRESET: WinSock error %u",
WSAGetLastError ()); WSAGetLastError ());
} }
#ifdef __x86_64__
rmem () = 212992; rmem () = 212992;
wmem () = 212992; wmem () = 212992;
#else
rmem () = 64512;
wmem () = 64512;
#endif
return 0; return 0;
} }
@ -1147,12 +1140,8 @@ fhandler_socket_inet::recv_internal (LPWSAMSG wsamsg, bool use_recvmsg)
if ((wsamsg->dwFlags & MSG_OOB) || oobinline) if ((wsamsg->dwFlags & MSG_OOB) || oobinline)
{ {
u_long atmark = 0; u_long atmark = 0;
#ifdef __x86_64__
/* SIOCATMARK = _IOR('s',7,u_long) */ /* SIOCATMARK = _IOR('s',7,u_long) */
int err = ::ioctlsocket (get_socket (), _IOR('s',7,u_long), &atmark); int err = ::ioctlsocket (get_socket (), _IOR('s',7,u_long), &atmark);
#else
int err = ::ioctlsocket (get_socket (), SIOCATMARK, &atmark);
#endif
if (err) if (err)
{ {
set_winsock_errno (); set_winsock_errno ();
@ -1276,7 +1265,6 @@ fhandler_socket_wsock::recvfrom (void *in_ptr, size_t len, int flags,
{ {
char *ptr = (char *) in_ptr; char *ptr = (char *) in_ptr;
#ifdef __x86_64__
/* size_t is 64 bit, but the len member in WSABUF is 32 bit. /* size_t is 64 bit, but the len member in WSABUF is 32 bit.
Split buffer if necessary. */ Split buffer if necessary. */
DWORD bufcnt = len / UINT32_MAX + ((!len || (len % UINT32_MAX)) ? 1 : 0); DWORD bufcnt = len / UINT32_MAX + ((!len || (len % UINT32_MAX)) ? 1 : 0);
@ -1293,13 +1281,6 @@ fhandler_socket_wsock::recvfrom (void *in_ptr, size_t len, int flags,
len -= wsaptr->len; len -= wsaptr->len;
ptr += wsaptr->len; ptr += wsaptr->len;
} }
#else
WSABUF wsabuf = { len, ptr };
WSAMSG wsamsg = { from, from && fromlen ? *fromlen : 0,
&wsabuf, 1,
{ 0, NULL},
(DWORD) flags };
#endif
ssize_t ret = recv_internal (&wsamsg, false); ssize_t ret = recv_internal (&wsamsg, false);
if (fromlen) if (fromlen)
*fromlen = wsamsg.namelen; *fromlen = wsamsg.namelen;
@ -1371,7 +1352,6 @@ fhandler_socket_wsock::read (void *in_ptr, size_t& len)
{ {
char *ptr = (char *) in_ptr; char *ptr = (char *) in_ptr;
#ifdef __x86_64__
/* size_t is 64 bit, but the len member in WSABUF is 32 bit. /* size_t is 64 bit, but the len member in WSABUF is 32 bit.
Split buffer if necessary. */ Split buffer if necessary. */
DWORD bufcnt = len / UINT32_MAX + ((!len || (len % UINT32_MAX)) ? 1 : 0); DWORD bufcnt = len / UINT32_MAX + ((!len || (len % UINT32_MAX)) ? 1 : 0);
@ -1385,11 +1365,6 @@ fhandler_socket_wsock::read (void *in_ptr, size_t& len)
len -= wsaptr->len; len -= wsaptr->len;
ptr += wsaptr->len; ptr += wsaptr->len;
} }
#else
WSABUF wsabuf = { len, ptr };
WSAMSG wsamsg = { NULL, 0, &wsabuf, 1, { 0, NULL }, 0 };
#endif
len = recv_internal (&wsamsg, false); len = recv_internal (&wsamsg, false);
} }
@ -1539,7 +1514,6 @@ fhandler_socket_inet::sendto (const void *in_ptr, size_t len, int flags,
if (to && get_inet_addr_inet (to, tolen, &sst, &tolen) == SOCKET_ERROR) if (to && get_inet_addr_inet (to, tolen, &sst, &tolen) == SOCKET_ERROR)
return SOCKET_ERROR; return SOCKET_ERROR;
#ifdef __x86_64__
/* size_t is 64 bit, but the len member in WSABUF is 32 bit. /* size_t is 64 bit, but the len member in WSABUF is 32 bit.
Split buffer if necessary. */ Split buffer if necessary. */
DWORD bufcnt = len / UINT32_MAX + ((!len || (len % UINT32_MAX)) ? 1 : 0); DWORD bufcnt = len / UINT32_MAX + ((!len || (len % UINT32_MAX)) ? 1 : 0);
@ -1556,13 +1530,6 @@ fhandler_socket_inet::sendto (const void *in_ptr, size_t len, int flags,
len -= wsaptr->len; len -= wsaptr->len;
ptr += wsaptr->len; ptr += wsaptr->len;
} }
#else
WSABUF wsabuf = { len, ptr };
WSAMSG wsamsg = { to ? (struct sockaddr *) &sst : NULL, tolen,
&wsabuf, 1,
{ 0, NULL},
0 };
#endif
return send_internal (&wsamsg, flags); return send_internal (&wsamsg, flags);
} }
@ -1690,7 +1657,6 @@ fhandler_socket_wsock::write (const void *in_ptr, size_t len)
{ {
char *ptr = (char *) in_ptr; char *ptr = (char *) in_ptr;
#ifdef __x86_64__
/* size_t is 64 bit, but the len member in WSABUF is 32 bit. /* size_t is 64 bit, but the len member in WSABUF is 32 bit.
Split buffer if necessary. */ Split buffer if necessary. */
DWORD bufcnt = len / UINT32_MAX + ((!len || (len % UINT32_MAX)) ? 1 : 0); DWORD bufcnt = len / UINT32_MAX + ((!len || (len % UINT32_MAX)) ? 1 : 0);
@ -1704,10 +1670,6 @@ fhandler_socket_wsock::write (const void *in_ptr, size_t len)
len -= wsaptr->len; len -= wsaptr->len;
ptr += wsaptr->len; ptr += wsaptr->len;
} }
#else
WSABUF wsabuf = { len, ptr };
WSAMSG wsamsg = { NULL, 0, &wsabuf, 1, { 0, NULL }, 0 };
#endif
return send_internal (&wsamsg, 0); return send_internal (&wsamsg, 0);
} }
@ -2395,9 +2357,7 @@ fhandler_socket_wsock::ioctl (unsigned int cmd, void *p)
and BSD systems defined as int pointer, so the applications will and BSD systems defined as int pointer, so the applications will
use a type of the expected size. Hopefully. */ use a type of the expected size. Hopefully. */
case FIOASYNC: case FIOASYNC:
#ifdef __x86_64__
case _IOW('f', 125, u_long): case _IOW('f', 125, u_long):
#endif
res = WSAAsyncSelect (get_socket (), winmsg, WM_ASYNCIO, res = WSAAsyncSelect (get_socket (), winmsg, WM_ASYNCIO,
*(int *) p ? ASYNC_MASK : 0); *(int *) p ? ASYNC_MASK : 0);
syscall_printf ("Async I/O on socket %s", syscall_printf ("Async I/O on socket %s",
@ -2408,9 +2368,7 @@ fhandler_socket_wsock::ioctl (unsigned int cmd, void *p)
WSAEventSelect (get_socket (), wsock_evt, EVENT_MASK); WSAEventSelect (get_socket (), wsock_evt, EVENT_MASK);
break; break;
case FIONREAD: case FIONREAD:
#ifdef __x86_64__
case _IOR('f', 127, u_long): case _IOR('f', 127, u_long):
#endif
/* Make sure to use the Winsock definition of FIONREAD. */ /* Make sure to use the Winsock definition of FIONREAD. */
res = ::ioctlsocket (get_socket (), _IOR('f', 127, u_long), (u_long *) p); res = ::ioctlsocket (get_socket (), _IOR('f', 127, u_long), (u_long *) p);
if (res == SOCKET_ERROR) if (res == SOCKET_ERROR)
@ -2420,11 +2378,9 @@ fhandler_socket_wsock::ioctl (unsigned int cmd, void *p)
case SIOCATMARK: case SIOCATMARK:
/* Sockets are always non-blocking internally. So we just note the /* Sockets are always non-blocking internally. So we just note the
state here. */ state here. */
#ifdef __x86_64__
/* Convert the different idea of u_long in the definition of cmd. */ /* Convert the different idea of u_long in the definition of cmd. */
if (((cmd >> 16) & IOCPARM_MASK) == sizeof (unsigned long)) if (((cmd >> 16) & IOCPARM_MASK) == sizeof (unsigned long))
cmd = (cmd & ~(IOCPARM_MASK << 16)) | (sizeof (u_long) << 16); cmd = (cmd & ~(IOCPARM_MASK << 16)) | (sizeof (u_long) << 16);
#endif
if (cmd == FIONBIO) if (cmd == FIONBIO)
{ {
syscall_printf ("socket is now %sblocking", syscall_printf ("socket is now %sblocking",
@ -2437,14 +2393,9 @@ fhandler_socket_wsock::ioctl (unsigned int cmd, void *p)
/* In winsock, the return value of SIOCATMARK is FALSE if /* In winsock, the return value of SIOCATMARK is FALSE if
OOB data exists, TRUE otherwise. This is almost opposite OOB data exists, TRUE otherwise. This is almost opposite
to expectation. */ to expectation. */
#ifdef __x86_64__
/* SIOCATMARK = _IOR('s',7,u_long) */ /* SIOCATMARK = _IOR('s',7,u_long) */
if (cmd == _IOR('s',7,u_long) && !res) if (cmd == _IOR('s',7,u_long) && !res)
*(u_long *)p = !*(u_long *)p; *(u_long *)p = !*(u_long *)p;
#else
if (cmd == SIOCATMARK && !res)
*(u_long *)p = !*(u_long *)p;
#endif
break; break;
default: default:
res = fhandler_socket::ioctl (cmd, p); res = fhandler_socket::ioctl (cmd, p);

View File

@ -12,7 +12,6 @@
#define USE_SYS_TYPES_FD_SET #define USE_SYS_TYPES_FD_SET
#include "winsup.h" #include "winsup.h"
#ifdef __x86_64__
/* 2014-04-24: Current Mingw headers define sockaddr_in6 using u_long (8 byte) /* 2014-04-24: Current Mingw headers define sockaddr_in6 using u_long (8 byte)
because a redefinition for LP64 systems is missing. This leads to a wrong because a redefinition for LP64 systems is missing. This leads to a wrong
definition and size of sockaddr_in6 when building with winsock headers. definition and size of sockaddr_in6 when building with winsock headers.
@ -20,7 +19,6 @@
function calls. */ function calls. */
#undef u_long #undef u_long
#define u_long __ms_u_long #define u_long __ms_u_long
#endif
#include "ntsecapi.h" #include "ntsecapi.h"
#include <w32api/ws2tcpip.h> #include <w32api/ws2tcpip.h>
#include <w32api/mswsock.h> #include <w32api/mswsock.h>
@ -1341,7 +1339,6 @@ fhandler_socket_local::sendto (const void *in_ptr, size_t len, int flags,
if (to && get_inet_addr_local (to, tolen, &sst, &tolen) == SOCKET_ERROR) if (to && get_inet_addr_local (to, tolen, &sst, &tolen) == SOCKET_ERROR)
return SOCKET_ERROR; return SOCKET_ERROR;
#ifdef __x86_64__
/* size_t is 64 bit, but the len member in WSABUF is 32 bit. /* size_t is 64 bit, but the len member in WSABUF is 32 bit.
Split buffer if necessary. */ Split buffer if necessary. */
DWORD bufcnt = len / UINT32_MAX + ((!len || (len % UINT32_MAX)) ? 1 : 0); DWORD bufcnt = len / UINT32_MAX + ((!len || (len % UINT32_MAX)) ? 1 : 0);
@ -1358,13 +1355,6 @@ fhandler_socket_local::sendto (const void *in_ptr, size_t len, int flags,
len -= wsaptr->len; len -= wsaptr->len;
ptr += wsaptr->len; ptr += wsaptr->len;
} }
#else
WSABUF wsabuf = { len, ptr };
WSAMSG wsamsg = { to ? (struct sockaddr *) &sst : NULL, tolen,
&wsabuf, 1,
{ 0, NULL},
0 };
#endif
return send_internal (&wsamsg, flags); return send_internal (&wsamsg, flags);
} }

View File

@ -2247,14 +2247,10 @@ fhandler_socket_unix::ioctl (unsigned int cmd, void *p)
switch (cmd) switch (cmd)
{ {
case FIOASYNC: case FIOASYNC:
#ifdef __x86_64__
case _IOW('f', 125, int): case _IOW('f', 125, int):
#endif
break; break;
case FIONREAD: case FIONREAD:
#ifdef __x86_64__
case _IOR('f', 127, int): case _IOR('f', 127, int):
#endif
case FIONBIO: case FIONBIO:
{ {
const bool was_nonblocking = is_nonblocking (); const bool was_nonblocking = is_nonblocking ();

View File

@ -626,11 +626,7 @@ dofork (void **proc, bool *with_forkables)
ischild = !!setjmp (grouped.ch.jmp); ischild = !!setjmp (grouped.ch.jmp);
volatile char * volatile stackp; volatile char * volatile stackp;
#ifdef __x86_64__
__asm__ volatile ("movq %%rsp,%0": "=r" (stackp)); __asm__ volatile ("movq %%rsp,%0": "=r" (stackp));
#else
__asm__ volatile ("movl %%esp,%0": "=r" (stackp));
#endif
if (!ischild) if (!ischild)
res = grouped.parent (stackp); res = grouped.parent (stackp);

View File

@ -8,7 +8,6 @@ details. */
/* From the GCC source file libgcc/unwind-seh.c. */ /* From the GCC source file libgcc/unwind-seh.c. */
#ifdef __x86_64__
#define STATUS_USER_DEFINED (1U << 29) #define STATUS_USER_DEFINED (1U << 29)
#define GCC_MAGIC (('G' << 16) | ('C' << 8) | 'C') #define GCC_MAGIC (('G' << 16) | ('C' << 8) | 'C')
#define GCC_EXCEPTION(TYPE) \ #define GCC_EXCEPTION(TYPE) \
@ -16,4 +15,3 @@ details. */
#define STATUS_GCC_THROW GCC_EXCEPTION (0) #define STATUS_GCC_THROW GCC_EXCEPTION (0)
#define STATUS_GCC_UNWIND GCC_EXCEPTION (1) #define STATUS_GCC_UNWIND GCC_EXCEPTION (1)
#define STATUS_GCC_FORCED GCC_EXCEPTION (2) #define STATUS_GCC_FORCED GCC_EXCEPTION (2)
#endif

View File

@ -29,7 +29,6 @@ static ptrdiff_t page_const;
static uintptr_t static uintptr_t
eval_start_address () eval_start_address ()
{ {
#ifdef __x86_64__
/* On 64 bit, we choose a fixed address outside the 32 bit area. The /* On 64 bit, we choose a fixed address outside the 32 bit area. The
executable starts at 0x1:00400000L, the Cygwin DLL starts at executable starts at 0x1:00400000L, the Cygwin DLL starts at
0x1:80040000L, other rebased DLLs are located in the region from 0x1:80040000L, other rebased DLLs are located in the region from
@ -38,38 +37,6 @@ eval_start_address ()
are located in the region from 0x6:00000000L up to 0x8:00000000L. are located in the region from 0x6:00000000L up to 0x8:00000000L.
So the heap starts at 0x8:00000000L. */ So the heap starts at 0x8:00000000L. */
uintptr_t start_address = 0x800000000L; uintptr_t start_address = 0x800000000L;
#else
/* Windows performs heap ASLR. This spoils the entire region below
0x20000000 for us, because that region is used by Windows to randomize
heap and stack addresses. Therefore we put our heap into a safe region
starting at 0x20000000. This should work right from the start in 99%
of the cases. */
uintptr_t start_address = 0x20000000L;
MEMORY_BASIC_INFORMATION mbi;
if (VirtualQuery ((void *) 0xbf000000L, &mbi, sizeof mbi))
{
/* However, if we're running on a /3GB enabled 32 bit system or on
a 64 bit system, and the executable is large address aware, then
we know that we have spare 1 Gig (32 bit) or even 2 Gigs (64 bit)
virtual address space. This memory region is practically unused
by Windows, only PEB and TEBs are allocated top-down here.
We used to use the current TEB address as very simple test that
this is a large address aware executable, but that fails on W10
WOW64 because the main TEB is apparently commited in the lower
2 Gigs these days.
The above test for address 0xbf000000 is supposed to make sure
that we really have 3GB on a 32 bit system. Windows supports
smaller large address regions, but then it's not that interesting
for us to use it for the heap. If the region is big enough, the
heap gets allocated at its start. What we get are 0.999 or 1.999
Gigs of free contiguous memory for heap, thread stacks, and shared
memory regions. */
start_address = 0x80000000L;
}
#endif
return start_address; return start_address;
} }
@ -83,27 +50,18 @@ eval_initial_heap_size ()
dosheader = (PIMAGE_DOS_HEADER) GetModuleHandle (NULL); dosheader = (PIMAGE_DOS_HEADER) GetModuleHandle (NULL);
ntheader = (PIMAGE_NT_HEADERS) ((PBYTE) dosheader + dosheader->e_lfanew); ntheader = (PIMAGE_NT_HEADERS) ((PBYTE) dosheader + dosheader->e_lfanew);
/* LoaderFlags is an obsolete DWORD member of the PE/COFF file header. /* LoaderFlags is an obsolete DWORD member of the PE/COFF file header.
It's value is ignored by the loader, so we're free to use it for Its value is ignored by the loader, so we're free to use it for
Cygwin. If it's 0, we default to the usual 384 Megs on 32 bit and Cygwin. If it's 0, we default to 512. Otherwise, we use it as
512 on 64 bit. Otherwise, we use it as the default initial heap size the default initial heap size in megabyte. Valid values are
in megabyte. Valid values are between 4 and 2048/8388608 Megs. */ between 4 and 8388608 Megs. */
size = ntheader->OptionalHeader.LoaderFlags; size = ntheader->OptionalHeader.LoaderFlags;
#ifdef __x86_64__
if (size == 0) if (size == 0)
size = 512; size = 512;
else if (size < 4) else if (size < 4)
size = 4; size = 4;
else if (size > 8388608) else if (size > 8388608)
size = 8388608; size = 8388608;
#else
if (size == 0)
size = 384;
else if (size < 4)
size = 4;
else if (size > 2048)
size = 2048;
#endif
return size << 20; return size << 20;
} }

View File

@ -72,11 +72,7 @@ rvadelta (PIMAGE_NT_HEADERS pnt, DWORD import_rva, DWORD &max_size)
static void * static void *
putmem (PIMAGE_THUNK_DATA pi, const void *hookfn) putmem (PIMAGE_THUNK_DATA pi, const void *hookfn)
{ {
#ifdef __x86_64__
#define THUNK_FUNC_TYPE ULONGLONG #define THUNK_FUNC_TYPE ULONGLONG
#else
#define THUNK_FUNC_TYPE DWORD
#endif
DWORD ofl; DWORD ofl;
if (!VirtualProtect (pi, sizeof (THUNK_FUNC_TYPE), PAGE_READWRITE, &ofl) ) if (!VirtualProtect (pi, sizeof (THUNK_FUNC_TYPE), PAGE_READWRITE, &ofl) )
@ -282,14 +278,7 @@ find_first_notloaded_dll (path_conv& pc)
bool is_64bit; bool is_64bit;
pExeNTHdr = PEHeaderFromHModule (hm, is_64bit); pExeNTHdr = PEHeaderFromHModule (hm, is_64bit);
if (!pExeNTHdr) if (!pExeNTHdr || !is_64bit)
goto out;
#ifdef __x86_64__
if (!is_64bit)
#else
if (is_64bit)
#endif
goto out; goto out;
importRVA = pExeNTHdr->OptionalHeader.DataDirectory importRVA = pExeNTHdr->OptionalHeader.DataDirectory
@ -349,17 +338,9 @@ hook_or_detect_cygwin (const char *name, const void *fn, WORD& subsys, HANDLE h)
bool is_64bit; bool is_64bit;
PIMAGE_NT_HEADERS pExeNTHdr = PEHeaderFromHModule (hm, is_64bit); PIMAGE_NT_HEADERS pExeNTHdr = PEHeaderFromHModule (hm, is_64bit);
if (!pExeNTHdr)
return NULL;
/* Shortcut. We don't have to do anything further from here, if the /* Shortcut. We don't have to do anything further from here, if the
executable's architecture doesn't match, unless we want to support executable's architecture doesn't match. */
a mix of 32 and 64 bit Cygwin at one point. */ if (!pExeNTHdr || !is_64bit)
#ifdef __x86_64__
if (!is_64bit)
#else
if (is_64bit)
#endif
return NULL; return NULL;
DWORD importRVA, importRVASize; DWORD importRVA, importRVASize;

View File

@ -391,9 +391,6 @@ typedef struct
uint32_t bsize; /* uninitialized data " " */ uint32_t bsize; /* uninitialized data " " */
uint32_t entry; /* entry pt. */ uint32_t entry; /* entry pt. */
uint32_t text_start; /* base of text used for this file */ uint32_t text_start; /* base of text used for this file */
#ifdef __i386__
uint32_t data_start; /* base of all data used for this file */
#endif
/* NT extra fields; see internal.h for descriptions */ /* NT extra fields; see internal.h for descriptions */
uintptr_t ImageBase; uintptr_t ImageBase;
@ -424,11 +421,7 @@ typedef struct
#undef AOUTSZ #undef AOUTSZ
#ifdef __x86_64__
#define AOUTSZ (AOUTHDRSZ + 212) #define AOUTSZ (AOUTHDRSZ + 212)
#else
#define AOUTSZ (AOUTHDRSZ + 196)
#endif
#undef E_FILNMLEN #undef E_FILNMLEN
#define E_FILNMLEN 18 /* # characters in a file name */ #define E_FILNMLEN 18 /* # characters in a file name */

View File

@ -9,10 +9,6 @@ details. */
#ifndef __ASM_BITSPERLONG_H #ifndef __ASM_BITSPERLONG_H
#define __ASM_BITSPERLONG_H #define __ASM_BITSPERLONG_H
#ifdef __x86_64__
#define __BITS_PER_LONG 64 #define __BITS_PER_LONG 64
#else
#define __BITS_PER_LONG 32
#endif
#endif /* __ASM_BITSPERLONG_H */ #endif /* __ASM_BITSPERLONG_H */

View File

@ -2,10 +2,8 @@
#ifndef _WORDSIZE_H #ifndef _WORDSIZE_H
#define _WORDSIZE_H 1 #define _WORDSIZE_H 1
#ifdef __x86_64__
# define __WORDSIZE 64 # define __WORDSIZE 64
# define __WORDSIZE_COMPAT32 1 # define __WORDSIZE_COMPAT32 1
#else
# define __WORDSIZE 32
#endif
#endif /*_WORDSIZE_H*/ #endif /*_WORDSIZE_H*/

View File

@ -36,21 +36,12 @@ __attribute__((__gnu_inline__))
extern inline struct _reent *__getreent (void) extern inline struct _reent *__getreent (void)
{ {
register char *ret; register char *ret;
#ifdef __x86_64__
__asm __volatile__ ("movq %%gs:8,%0" : "=r" (ret)); __asm __volatile__ ("movq %%gs:8,%0" : "=r" (ret));
#else
__asm __volatile__ ("movl %%fs:4,%0" : "=r" (ret));
#endif
return (struct _reent *) (ret - __CYGTLS_PADSIZE__); return (struct _reent *) (ret - __CYGTLS_PADSIZE__);
} }
#endif /* _LIBC || __INSIDE_CYGWIN__ */ #endif /* _LIBC || __INSIDE_CYGWIN__ */
#ifdef __x86_64__ #define _SYMSTR(x) #x
# define __SYMBOL_PREFIX
#else
# define __SYMBOL_PREFIX "_"
#endif
#define _SYMSTR(x) __SYMBOL_PREFIX #x
#define __FILENAME_MAX__ 4096 /* Keep in sync with PATH_MAX in limits.h. */ #define __FILENAME_MAX__ 4096 /* Keep in sync with PATH_MAX in limits.h. */

View File

@ -19,7 +19,6 @@ extern "C" {
Define a struct __mcontext, which should be identical in layout to the Win32 Define a struct __mcontext, which should be identical in layout to the Win32
API type CONTEXT with the addition of oldmask and cr2 fields at the end. API type CONTEXT with the addition of oldmask and cr2 fields at the end.
*/ */
#ifdef __x86_64__
struct _uc_fpxreg { struct _uc_fpxreg {
__uint16_t significand[4]; __uint16_t significand[4];
@ -98,67 +97,9 @@ struct __attribute__ ((__aligned__ (16))) __mcontext
__uint64_t cr2; __uint64_t cr2;
}; };
#else /* !x86_64 */
struct _uc_fpreg
{
__uint16_t significand[4];
__uint16_t exponent;
};
struct _fpstate
{
__uint32_t cw;
__uint32_t sw;
__uint32_t tag;
__uint32_t ipoff;
__uint32_t cssel;
__uint32_t dataoff;
__uint32_t datasel;
struct _uc_fpreg _st[8];
__uint32_t nxst;
};
struct __mcontext
{
__uint32_t ctxflags;
__uint32_t dr0;
__uint32_t dr1;
__uint32_t dr2;
__uint32_t dr3;
__uint32_t dr6;
__uint32_t dr7;
struct _fpstate fpstate;
__uint32_t gs;
__uint32_t fs;
__uint32_t es;
__uint32_t ds;
__uint32_t edi;
__uint32_t esi;
__uint32_t ebx;
__uint32_t edx;
__uint32_t ecx;
__uint32_t eax;
__uint32_t ebp;
__uint32_t eip;
__uint32_t cs;
__uint32_t eflags;
__uint32_t esp;
__uint32_t ss;
__uint32_t reserved[128];
__uint32_t oldmask;
__uint32_t cr2;
};
#endif /* !x86_64 */
/* Needed for GDB. It only compiles in the context copy code if this macro is /* Needed for GDB. It only compiles in the context copy code if this macro is
defined. This is not sizeof(CONTEXT) due to historical accidents. */ defined. This is not sizeof(CONTEXT) due to historical accidents. */
#ifdef __x86_64__
#define __COPY_CONTEXT_SIZE 816 #define __COPY_CONTEXT_SIZE 816
#else
#define __COPY_CONTEXT_SIZE 204
#endif
typedef union sigval typedef union sigval
{ {

View File

@ -330,11 +330,7 @@ struct per_process
DWORD api_minor; /* linked with */ DWORD api_minor; /* linked with */
/* For future expansion, so apps won't have to be relinked if we /* For future expansion, so apps won't have to be relinked if we
add an item. */ add an item. */
#ifdef __x86_64__
DWORD_PTR unused2[4]; DWORD_PTR unused2[4];
#else
DWORD_PTR unused2[2];
#endif
int (*posix_memalign)(void **, size_t, size_t); int (*posix_memalign)(void **, size_t, size_t);

View File

@ -15,9 +15,6 @@
#define __DIRENT_VERSION 2 #define __DIRENT_VERSION 2
#ifdef __i386__
#pragma pack(push,4)
#endif
#define _DIRENT_HAVE_D_TYPE #define _DIRENT_HAVE_D_TYPE
struct dirent struct dirent
{ {
@ -28,21 +25,11 @@ struct dirent
__uint32_t __d_internal1; __uint32_t __d_internal1;
char d_name[NAME_MAX + 1]; char d_name[NAME_MAX + 1];
}; };
#ifdef __i386__
#pragma pack(pop)
#endif
#define d_fileno d_ino /* BSD compatible definition */ #define d_fileno d_ino /* BSD compatible definition */
#ifdef __x86_64__
#define __DIRENT_COOKIE 0xcdcd8484 #define __DIRENT_COOKIE 0xcdcd8484
#else
#define __DIRENT_COOKIE 0xdede4242
#endif
#ifdef __i386__
#pragma pack(push,4)
#endif
typedef struct __DIR typedef struct __DIR
{ {
/* This is first to set alignment in non _LIBC case. */ /* This is first to set alignment in non _LIBC case. */
@ -56,9 +43,6 @@ typedef struct __DIR
void *__fh; void *__fh;
unsigned __flags; unsigned __flags;
} DIR; } DIR;
#ifdef __i386__
#pragma pack(pop)
#endif
#if __BSD_VISIBLE #if __BSD_VISIBLE
#ifdef _DIRENT_HAVE_D_TYPE #ifdef _DIRENT_HAVE_D_TYPE

View File

@ -19,9 +19,6 @@ unsigned threadfunc_ix[8];
static bool dll_finished_loading; static bool dll_finished_loading;
#define OLDFUNC_OFFSET -1 #define OLDFUNC_OFFSET -1
#ifdef __i386__
__attribute__ ((force_align_arg_pointer))
#endif
static void WINAPI static void WINAPI
threadfunc_fe (VOID *arg) threadfunc_fe (VOID *arg)
{ {

View File

@ -14,17 +14,10 @@ details. */
unnecessarily. */ unnecessarily. */
#define WEAK __attribute__ ((weak)) #define WEAK __attribute__ ((weak))
#ifdef __x86_64__
#define REAL_ZNWX "__real__Znwm" #define REAL_ZNWX "__real__Znwm"
#define REAL_ZNAX "__real__Znam" #define REAL_ZNAX "__real__Znam"
#define REAL_ZNWX_NOTHROW_T "__real__ZnwmRKSt9nothrow_t" #define REAL_ZNWX_NOTHROW_T "__real__ZnwmRKSt9nothrow_t"
#define REAL_ZNAX_NOTHROW_T "__real__ZnamRKSt9nothrow_t" #define REAL_ZNAX_NOTHROW_T "__real__ZnamRKSt9nothrow_t"
#else
#define REAL_ZNWX "___real__Znwj"
#define REAL_ZNAX "___real__Znaj"
#define REAL_ZNWX_NOTHROW_T "___real__ZnwjRKSt9nothrow_t"
#define REAL_ZNAX_NOTHROW_T "___real__ZnajRKSt9nothrow_t"
#endif
#define REAL_ZDLPV _SYMSTR (__real__ZdlPv) #define REAL_ZDLPV _SYMSTR (__real__ZdlPv)
#define REAL_ZDAPV _SYMSTR (__real__ZdaPv) #define REAL_ZDAPV _SYMSTR (__real__ZdaPv)
#define REAL_ZDLPV_NOTHROW_T _SYMSTR (__real__ZdlPvRKSt9nothrow_t) #define REAL_ZDLPV_NOTHROW_T _SYMSTR (__real__ZdlPvRKSt9nothrow_t)
@ -65,12 +58,8 @@ int _fmode;
extern char __RUNTIME_PSEUDO_RELOC_LIST__; extern char __RUNTIME_PSEUDO_RELOC_LIST__;
extern char __RUNTIME_PSEUDO_RELOC_LIST_END__; extern char __RUNTIME_PSEUDO_RELOC_LIST_END__;
#ifdef __x86_64__
extern char __image_base__; extern char __image_base__;
#define _image_base__ __image_base__ #define _image_base__ __image_base__
#else
extern char _image_base__;
#endif
struct per_process_cxx_malloc __cygwin_cxx_malloc = struct per_process_cxx_malloc __cygwin_cxx_malloc =
{ {

View File

@ -20,17 +20,10 @@ details. */
around the standard C++ memory management operators; these are the wrappers, around the standard C++ memory management operators; these are the wrappers,
but we want the compiler to know they are the malloc operators and not have but we want the compiler to know they are the malloc operators and not have
it think they're just any old function matching 'extern "C" _wrap_*'. */ it think they're just any old function matching 'extern "C" _wrap_*'. */
#ifdef __x86_64__
#define MANGLED_ZNWX "__wrap__Znwm" #define MANGLED_ZNWX "__wrap__Znwm"
#define MANGLED_ZNAX "__wrap__Znam" #define MANGLED_ZNAX "__wrap__Znam"
#define MANGLED_ZNWX_NOTHROW_T "__wrap__ZnwmRKSt9nothrow_t" #define MANGLED_ZNWX_NOTHROW_T "__wrap__ZnwmRKSt9nothrow_t"
#define MANGLED_ZNAX_NOTHROW_T "__wrap__ZnamRKSt9nothrow_t" #define MANGLED_ZNAX_NOTHROW_T "__wrap__ZnamRKSt9nothrow_t"
#else
#define MANGLED_ZNWX "___wrap__Znwj"
#define MANGLED_ZNAX "___wrap__Znaj"
#define MANGLED_ZNWX_NOTHROW_T "___wrap__ZnwjRKSt9nothrow_t"
#define MANGLED_ZNAX_NOTHROW_T "___wrap__ZnajRKSt9nothrow_t"
#endif
extern void *operator new(std::size_t sz) noexcept (false) extern void *operator new(std::size_t sz) noexcept (false)
__asm__ (MANGLED_ZNWX); __asm__ (MANGLED_ZNWX);

View File

@ -334,12 +334,8 @@ __import_address (void *imp)
if (*((uint16_t *) imp) == 0x25ff) if (*((uint16_t *) imp) == 0x25ff)
{ {
const char *ptr = (const char *) imp; const char *ptr = (const char *) imp;
#ifdef __x86_64__
const uintptr_t *jmpto = (uintptr_t *) const uintptr_t *jmpto = (uintptr_t *)
(ptr + 6 + *(int32_t *)(ptr + 2)); (ptr + 6 + *(int32_t *)(ptr + 2));
#else
const uintptr_t *jmpto = (uintptr_t *) *((uintptr_t *) (ptr + 2));
#endif
return (void *) *jmpto; return (void *) *jmpto;
} }
} }
@ -417,41 +413,6 @@ pthread_wrapper (PVOID arg)
/* Initialize new _cygtls. */ /* Initialize new _cygtls. */
_my_tls.init_thread (wrapper_arg.stackbase - __CYGTLS_PADSIZE__, _my_tls.init_thread (wrapper_arg.stackbase - __CYGTLS_PADSIZE__,
(DWORD (*)(void*, void*)) wrapper_arg.func); (DWORD (*)(void*, void*)) wrapper_arg.func);
#ifdef __i386__
/* Copy exception list over to new stack. I'm not quite sure how the
exception list is extended by Windows itself. What's clear is that it
always grows downwards and that it starts right at the stackbase.
Therefore we first count the number of exception records and place
the copy at the stackbase, too, so there's still a lot of room to
extend the list up to where our _cygtls region starts. */
_exception_list *old_start = (_exception_list *) teb->Tib.ExceptionList;
unsigned count = 0;
teb->Tib.ExceptionList = NULL;
for (_exception_list *e_ptr = old_start;
e_ptr && e_ptr != (_exception_list *) -1;
e_ptr = e_ptr->prev)
++count;
if (count)
{
_exception_list *new_start = (_exception_list *) wrapper_arg.stackbase
- count;
teb->Tib.ExceptionList = (struct _EXCEPTION_REGISTRATION_RECORD *)
new_start;
while (true)
{
new_start->handler = old_start->handler;
if (old_start->prev == (_exception_list *) -1)
{
new_start->prev = (_exception_list *) -1;
break;
}
new_start->prev = new_start + 1;
new_start = new_start->prev;
old_start = old_start->prev;
}
}
#endif
#ifdef __x86_64__
__asm__ ("\n\ __asm__ ("\n\
leaq %[WRAPPER_ARG], %%rbx # Load &wrapper_arg into rbx \n\ leaq %[WRAPPER_ARG], %%rbx # Load &wrapper_arg into rbx \n\
movq (%%rbx), %%r12 # Load thread func into r12 \n\ movq (%%rbx), %%r12 # Load thread func into r12 \n\
@ -475,44 +436,11 @@ pthread_wrapper (PVOID arg)
call *%%r12 # Call thread func \n" call *%%r12 # Call thread func \n"
: : [WRAPPER_ARG] "o" (wrapper_arg), : : [WRAPPER_ARG] "o" (wrapper_arg),
[CYGTLS] "i" (__CYGTLS_PADSIZE__)); [CYGTLS] "i" (__CYGTLS_PADSIZE__));
#else
__asm__ ("\n\
leal %[WRAPPER_ARG], %%ebx # Load &wrapper_arg into ebx \n\
movl (%%ebx), %%eax # Load thread func into eax \n\
movl 4(%%ebx), %%ecx # Load thread arg into ecx \n\
movl 8(%%ebx), %%edx # Load stackaddr into edx \n\
movl 12(%%ebx), %%ebx # Load stackbase into ebx \n\
subl %[CYGTLS], %%ebx # Subtract __CYGTLS_PADSIZE__ \n\
subl $4, %%ebx # Subtract another 4 bytes \n\
movl %%ebx, %%esp # Set esp \n\
xorl %%ebp, %%ebp # Set ebp to 0 \n\
# Make gcc 3.x happy and align the stack so that it is \n\
# 16 byte aligned right before the final call opcode. \n\
andl $-16, %%esp # 16 byte align \n\
addl $-12, %%esp # 12 bytes + 4 byte arg = 16 \n\
# Now we moved to the new stack. Save thread func address \n\
# and thread arg on new stack \n\
pushl %%ecx # Push thread arg onto stack \n\
pushl %%eax # Push thread func onto stack \n\
# Now it's safe to release the OS stack. \n\
pushl $0x8000 # dwFreeType: MEM_RELEASE \n\
pushl $0x0 # dwSize: 0 \n\
pushl %%edx # lpAddress: stackaddr \n\
call _VirtualFree@12 # Shoot \n\
# All set. We can pop the thread function address from \n\
# the stack and call it. The thread arg is still on the \n\
# stack in the expected spot. \n\
popl %%eax # Pop thread_func address \n\
call *%%eax # Call thread func \n"
: : [WRAPPER_ARG] "o" (wrapper_arg),
[CYGTLS] "i" (__CYGTLS_PADSIZE__));
#endif
/* pthread::thread_init_wrapper calls pthread::exit, which /* pthread::thread_init_wrapper calls pthread::exit, which
in turn calls ExitThread, so we should never arrive here. */ in turn calls ExitThread, so we should never arrive here. */
api_fatal ("Dumb thinko in pthread handling. Whip the developer."); api_fatal ("Dumb thinko in pthread handling. Whip the developer.");
} }
#ifdef __x86_64__
/* The memory region used for thread stacks. The memory layout is outlined /* The memory region used for thread stacks. The memory layout is outlined
in heap.cc, function eval_start_address(). */ in heap.cc, function eval_start_address(). */
#define THREAD_STORAGE_LOW 0x600000000L #define THREAD_STORAGE_LOW 0x600000000L
@ -665,7 +593,6 @@ create_new_main_thread_stack (PVOID &allocationbase)
NtCurrentTeb()->Tib.StackLimit = stacklimit; NtCurrentTeb()->Tib.StackLimit = stacklimit;
return ((PBYTE) allocationbase + stacksize - 16); return ((PBYTE) allocationbase + stacksize - 16);
} }
#endif
HANDLE WINAPI HANDLE WINAPI
CygwinCreateThread (LPTHREAD_START_ROUTINE thread_func, PVOID thread_arg, CygwinCreateThread (LPTHREAD_START_ROUTINE thread_func, PVOID thread_arg,
@ -710,17 +637,7 @@ CygwinCreateThread (LPTHREAD_START_ROUTINE thread_func, PVOID thread_arg,
real_stacksize = roundup2 (real_stacksize, real_stacksize = roundup2 (real_stacksize,
wincap.allocation_granularity ()); wincap.allocation_granularity ());
/* Reserve stack. */ /* Reserve stack. */
#ifdef __x86_64__
real_stackaddr = thr_alloc.alloc (real_stacksize); real_stackaddr = thr_alloc.alloc (real_stacksize);
#else
/* FIXME? If the TOP_DOWN method tends to collide too much with
other stuff, we should provide our own mechanism to find a
suitable place for the stack. Top down from the start of
the Cygwin DLL comes to mind. */
real_stackaddr = VirtualAlloc (NULL, real_stacksize,
MEM_RESERVE | MEM_TOP_DOWN,
PAGE_READWRITE);
#endif
if (!real_stackaddr) if (!real_stackaddr)
return NULL; return NULL;
/* Set up committed region. We set up the stack like the OS does, /* Set up committed region. We set up the stack like the OS does,
@ -781,7 +698,6 @@ err:
return thread; return thread;
} }
#ifdef __x86_64__
/* These functions are almost verbatim FreeBSD code (even if the header of /* These functions are almost verbatim FreeBSD code (even if the header of
one file mentiones NetBSD), just wrapped in the minimum required code to one file mentiones NetBSD), just wrapped in the minimum required code to
make them work with the MS AMD64 ABI. make them work with the MS AMD64 ABI.
@ -984,8 +900,6 @@ wmempcpy: \n\
.seh_endproc \n\ .seh_endproc \n\
"); ");
#endif
/* Signal the thread name to any attached debugger /* Signal the thread name to any attached debugger
(See "How to: Set a Thread Name in Native Code" (See "How to: Set a Thread Name in Native Code"
@ -1004,18 +918,8 @@ SetThreadName(DWORD dwThreadID, const char* threadName)
0x1000, /* type, must be 0x1000 */ 0x1000, /* type, must be 0x1000 */
(ULONG_PTR) threadName, /* pointer to threadname */ (ULONG_PTR) threadName, /* pointer to threadname */
dwThreadID, /* thread ID (+ flags on x86_64) */ dwThreadID, /* thread ID (+ flags on x86_64) */
#ifdef _X86_
0, /* flags, must be zero */
#endif
}; };
#ifdef _X86_
/* On x86, for __try/__except to work, we must ensure our exception handler is
installed, which may not be the case if this is being called during early
initialization. */
exception protect;
#endif
__try __try
{ {
RaiseException (MS_VC_EXCEPTION, 0, sizeof (info) / sizeof (ULONG_PTR), RaiseException (MS_VC_EXCEPTION, 0, sizeof (info) / sizeof (ULONG_PTR),

View File

@ -108,9 +108,7 @@ ssize_t check_iovec (const struct iovec *, int, bool);
#define check_iovec_for_read(a, b) check_iovec ((a), (b), false) #define check_iovec_for_read(a, b) check_iovec ((a), (b), false)
#define check_iovec_for_write(a, b) check_iovec ((a), (b), true) #define check_iovec_for_write(a, b) check_iovec ((a), (b), true)
#ifdef __x86_64__
extern PVOID create_new_main_thread_stack (PVOID &allocationbase); extern PVOID create_new_main_thread_stack (PVOID &allocationbase);
#endif
extern "C" DWORD WINAPI pthread_wrapper (PVOID arg); extern "C" DWORD WINAPI pthread_wrapper (PVOID arg);
extern "C" HANDLE WINAPI CygwinCreateThread (LPTHREAD_START_ROUTINE thread_func, extern "C" HANDLE WINAPI CygwinCreateThread (LPTHREAD_START_ROUTINE thread_func,

View File

@ -196,7 +196,6 @@ MapView (HANDLE h, void *addr, size_t len, DWORD openflags,
SIZE_T viewsize = len; SIZE_T viewsize = len;
ULONG alloc_type = MEM_TOP_DOWN; ULONG alloc_type = MEM_TOP_DOWN;
#ifdef __x86_64__
/* Don't call NtMapViewOfSectionEx during fork. It requires autoloading /* Don't call NtMapViewOfSectionEx during fork. It requires autoloading
a function under loader lock (STATUS_DLL_INIT_FAILED). */ a function under loader lock (STATUS_DLL_INIT_FAILED). */
if (!from_fixup_after_fork && wincap.has_extended_mem_api ()) if (!from_fixup_after_fork && wincap.has_extended_mem_api ())
@ -232,7 +231,6 @@ MapView (HANDLE h, void *addr, size_t len, DWORD openflags,
base, status, h, addr, off, viewsize, alloc_type, protect); base, status, h, addr, off, viewsize, alloc_type, protect);
return base; return base;
} }
#endif
/* Try mapping using the given address first, even if it's NULL. /* Try mapping using the given address first, even if it's NULL.
If it failed, and addr was not NULL and flags is not MAP_FIXED, If it failed, and addr was not NULL and flags is not MAP_FIXED,
@ -1063,40 +1061,8 @@ go_ahead:
} }
orig_len = roundup2 (orig_len, pagesize); orig_len = roundup2 (orig_len, pagesize);
#ifdef __x86_64__
if (!wincap.has_extended_mem_api ()) if (!wincap.has_extended_mem_api ())
addr = mmap_alloc.alloc (addr, orig_len ?: len, fixed (flags)); addr = mmap_alloc.alloc (addr, orig_len ?: len, fixed (flags));
#else
if (orig_len)
{
/* If the requested length is bigger than the file size, we try to
allocate an area of the full size first. This area is immediately
deallocated and the address we got is used as base address for the
subsequent real mappings. This ensures that we have enough space
for the whole thing. */
PVOID newaddr = VirtualAlloc (addr, orig_len, MEM_TOP_DOWN | MEM_RESERVE,
PAGE_READWRITE);
if (!newaddr)
{
/* If addr is not NULL, but MAP_FIXED isn't given, allow the OS
to choose. */
if (addr && !fixed (flags))
newaddr = VirtualAlloc (NULL, orig_len, MEM_TOP_DOWN | MEM_RESERVE,
PAGE_READWRITE);
if (!newaddr)
{
__seterrno ();
goto out_with_unlock;
}
}
if (!VirtualFree (newaddr, 0, MEM_RELEASE))
{
__seterrno ();
goto out_with_unlock;
}
addr = newaddr;
}
#endif
base = mmap_worker (map_list, fh, (caddr_t) addr, len, prot, flags, fd, off, base = mmap_worker (map_list, fh, (caddr_t) addr, len, prot, flags, fd, off,
&st); &st);
@ -1600,7 +1566,6 @@ fhandler_dev_zero::mmap (caddr_t *addr, size_t len, int prot,
DWORD protect = gen_protect (prot, flags); DWORD protect = gen_protect (prot, flags);
DWORD alloc_type = MEM_TOP_DOWN | MEM_RESERVE DWORD alloc_type = MEM_TOP_DOWN | MEM_RESERVE
| (noreserve (flags) ? 0 : MEM_COMMIT); | (noreserve (flags) ? 0 : MEM_COMMIT);
#ifdef __x86_64__
if (wincap.has_extended_mem_api ()) if (wincap.has_extended_mem_api ())
{ {
static const MEM_ADDRESS_REQUIREMENTS mmap_req = { static const MEM_ADDRESS_REQUIREMENTS mmap_req = {
@ -1621,7 +1586,6 @@ fhandler_dev_zero::mmap (caddr_t *addr, size_t len, int prot,
protect, &mmap_ext, 1); protect, &mmap_ext, 1);
} }
else else
#endif
{ {
base = VirtualAlloc (*addr, len, alloc_type, protect); base = VirtualAlloc (*addr, len, alloc_type, protect);
if (!base && addr && !fixed (flags)) if (!base && addr && !fixed (flags))

View File

@ -1,5 +1,3 @@
#ifdef __x86_64__
#include "winsup.h" #include "winsup.h"
#include "mmap_alloc.h" #include "mmap_alloc.h"
#include <sys/param.h> #include <sys/param.h>
@ -78,5 +76,3 @@ mmap_allocator::alloc (PVOID in_addr, SIZE_T in_size, bool fixed)
} }
mmap_allocator mmap_alloc; /* Inherited by forked child. */ mmap_allocator mmap_alloc; /* Inherited by forked child. */
#endif

View File

@ -1,5 +1,3 @@
#ifdef __x86_64__
/* The memory region used for memory maps */ /* The memory region used for memory maps */
#define MMAP_STORAGE_LOW 0x001000000000L /* Leave 32 Gigs for heap. */ #define MMAP_STORAGE_LOW 0x001000000000L /* Leave 32 Gigs for heap. */
/* Up to Win 8 only supporting 44 bit address space, starting with Win 8.1 /* Up to Win 8 only supporting 44 bit address space, starting with Win 8.1
@ -17,5 +15,3 @@ public:
}; };
extern mmap_allocator mmap_alloc; extern mmap_allocator mmap_alloc;
#endif

View File

@ -12,13 +12,11 @@ details. */
#define USE_SYS_TYPES_FD_SET #define USE_SYS_TYPES_FD_SET
#define __WSA_ERR_MACROS_DEFINED #define __WSA_ERR_MACROS_DEFINED
#include "winsup.h" #include "winsup.h"
#ifdef __x86_64__
/* 2014-04-24: Current Mingw headers define sockaddr_in6 using u_long (8 byte) /* 2014-04-24: Current Mingw headers define sockaddr_in6 using u_long (8 byte)
because a redefinition for LP64 systems is missing. This leads to a wrong because a redefinition for LP64 systems is missing. This leads to a wrong
definition and size of sockaddr_in6 when building with winsock headers. */ definition and size of sockaddr_in6 when building with winsock headers. */
#undef u_long #undef u_long
#define u_long __ms_u_long #define u_long __ms_u_long
#endif
#include <w32api/ws2tcpip.h> #include <w32api/ws2tcpip.h>
#include <w32api/mswsock.h> #include <w32api/mswsock.h>
#include <w32api/iphlpapi.h> #include <w32api/iphlpapi.h>
@ -290,7 +288,6 @@ realloc_ent (int sz, hostent *)
The 'unionent' struct is a union of all of the currently used The 'unionent' struct is a union of all of the currently used
*ent structure. */ *ent structure. */
#ifdef __x86_64__
/* For some baffling reason, somebody at Microsoft decided that it would be /* For some baffling reason, somebody at Microsoft decided that it would be
a good idea to exchange the s_port and s_proto members in the servent a good idea to exchange the s_port and s_proto members in the servent
structure. */ structure. */
@ -302,9 +299,6 @@ struct win64_servent
short s_port; short s_port;
}; };
#define WIN_SERVENT(x) ((win64_servent *)(x)) #define WIN_SERVENT(x) ((win64_servent *)(x))
#else
#define WIN_SERVENT(x) ((servent *)(x))
#endif
#ifdef DEBUGGING #ifdef DEBUGGING
static void * static void *
@ -3078,11 +3072,9 @@ cygwin_getaddrinfo (const char *hostname, const char *servname,
/* sizeof addrinfo == sizeof addrinfoW */ /* sizeof addrinfo == sizeof addrinfoW */
memcpy (&whints, hints, sizeof whints); memcpy (&whints, hints, sizeof whints);
whints.ai_flags &= ~AI_IDN_MASK; whints.ai_flags &= ~AI_IDN_MASK;
#ifdef __x86_64__
/* ai_addrlen is socklen_t (4 bytes) in POSIX but size_t (8 bytes) in /* ai_addrlen is socklen_t (4 bytes) in POSIX but size_t (8 bytes) in
Winsock. Sert upper 4 bytes explicitely to 0 to avoid EAI_FAIL. */ Winsock. Sert upper 4 bytes explicitely to 0 to avoid EAI_FAIL. */
whints.ai_addrlen &= UINT32_MAX; whints.ai_addrlen &= UINT32_MAX;
#endif
/* On Windows, the default behaviour is as if AI_ADDRCONFIG is set, /* On Windows, the default behaviour is as if AI_ADDRCONFIG is set,
apparently for performance reasons. To get the POSIX default apparently for performance reasons. To get the POSIX default
behaviour, the AI_ALL flag has to be set. */ behaviour, the AI_ALL flag has to be set. */

View File

@ -1377,7 +1377,6 @@ typedef enum _SECTION_INHERIT
typedef VOID (APIENTRY *PTIMER_APC_ROUTINE)(PVOID, ULONG, ULONG); typedef VOID (APIENTRY *PTIMER_APC_ROUTINE)(PVOID, ULONG, ULONG);
#ifdef __x86_64__
typedef struct _SCOPE_TABLE typedef struct _SCOPE_TABLE
{ {
ULONG Count; ULONG Count;
@ -1389,7 +1388,6 @@ typedef struct _SCOPE_TABLE
ULONG JumpTarget; ULONG JumpTarget;
} ScopeRecord[1]; } ScopeRecord[1];
} SCOPE_TABLE, *PSCOPE_TABLE; } SCOPE_TABLE, *PSCOPE_TABLE;
#endif
#ifdef __cplusplus #ifdef __cplusplus
/* This is the mapping of the KUSER_SHARED_DATA structure into the user /* This is the mapping of the KUSER_SHARED_DATA structure into the user

View File

@ -4489,8 +4489,6 @@ fcwd_access_t::SetVersionFromPointer (PBYTE buf_p, bool is_buffer)
it's not exported from the DLL, unfortunately. Therefore we have to it's not exported from the DLL, unfortunately. Therefore we have to
use some knowledge to figure out the address. */ use some knowledge to figure out the address. */
#ifdef __x86_64__
#define peek32(x) (*(int32_t *)(x)) #define peek32(x) (*(int32_t *)(x))
static fcwd_access_t ** static fcwd_access_t **
@ -4588,106 +4586,6 @@ find_fast_cwd_pointer ()
/* Compute address of the fcwd_access_t ** pointer. */ /* Compute address of the fcwd_access_t ** pointer. */
return (fcwd_access_t **) (testrbx + peek32 (movrbx + 3)); return (fcwd_access_t **) (testrbx + peek32 (movrbx + 3));
} }
#else
#define peek32(x) (*(uint32_t *)(x))
static fcwd_access_t **
find_fast_cwd_pointer ()
{
/* Fetch entry points of relevant functions in ntdll.dll. */
HMODULE ntdll = GetModuleHandle ("ntdll.dll");
if (!ntdll)
return NULL;
const uint8_t *get_dir = (const uint8_t *)
GetProcAddress (ntdll, "RtlGetCurrentDirectory_U");
const uint8_t *ent_crit = (const uint8_t *)
GetProcAddress (ntdll, "RtlEnterCriticalSection");
if (!get_dir || !ent_crit)
return NULL;
/* Search first relative call instruction in RtlGetCurrentDirectory_U. */
const uint8_t *rcall = (const uint8_t *) memchr (get_dir, 0xe8, 64);
if (!rcall)
return NULL;
/* Fetch offset from instruction and compute address of called function.
This function actually fetches the current FAST_CWD instance and
performs some other actions, not important to us. */
ptrdiff_t offset = (ptrdiff_t) peek32 (rcall + 1);
const uint8_t *use_cwd = rcall + 5 + offset;
/* Find first `push %edi' instruction. */
const uint8_t *pushedi = (const uint8_t *) memchr (use_cwd, 0x57, 32);
if (!pushedi)
return NULL;
/* ...which should be followed by `mov crit-sect-addr,%edi' then
`push %edi', or by just a single `push crit-sect-addr'. */
const uint8_t *movedi = pushedi + 1;
const uint8_t *mov_pfast_cwd;
if (movedi[0] == 0x8b && movedi[1] == 0xff) /* mov %edi,%edi -> W8 */
{
/* Windows 8 does not call RtlEnterCriticalSection. The code manipulates
the FastPebLock manually, probably because RtlEnterCriticalSection has
been converted to an inline function.
Next we search for a `mov some address,%eax'. This address points
to the LockCount member of the FastPebLock structure, so the address
is equal to FastPebLock + 4. */
const uint8_t *moveax = (const uint8_t *) memchr (movedi, 0xb8, 16);
if (!moveax)
return NULL;
offset = (ptrdiff_t) peek32 (moveax + 1) - 4;
/* Compare the address with the known PEB lock as stored in the PEB. */
if ((PRTL_CRITICAL_SECTION) offset != NtCurrentTeb ()->Peb->FastPebLock)
return NULL;
/* Now search for the mov instruction fetching the address of the global
PFAST_CWD *. */
mov_pfast_cwd = moveax;
do
{
mov_pfast_cwd = (const uint8_t *) memchr (++mov_pfast_cwd, 0x8b, 48);
}
while (mov_pfast_cwd && mov_pfast_cwd[1] != 0x1d
&& (mov_pfast_cwd - moveax) < 48);
if (!mov_pfast_cwd || mov_pfast_cwd[1] != 0x1d)
return NULL;
}
else
{
if (movedi[0] == 0xbf && movedi[5] == 0x57)
rcall = movedi + 6;
else if (movedi[0] == 0x68)
rcall = movedi + 5;
else if (movedi[0] == 0x88 && movedi[4] == 0x83 && movedi[7] == 0x68)
{
/* Windows 8.1 Preview: The `mov lock_addr,%edi' is actually a
`mov %cl,15(%esp), followed by an `or #-1,%ebx, followed by a
`push lock_addr'. */
movedi += 7;
rcall = movedi + 5;
}
else
return NULL;
/* Compare the address used for the critical section with the known
PEB lock as stored in the PEB. */
if ((PRTL_CRITICAL_SECTION) peek32 (movedi + 1)
!= NtCurrentTeb ()->Peb->FastPebLock)
return NULL;
/* To check we are seeing the right code, we check our expectation that
the next instruction is a relative call into RtlEnterCriticalSection. */
if (rcall[0] != 0xe8)
return NULL;
/* Check that this is a relative call to RtlEnterCriticalSection. */
offset = (ptrdiff_t) peek32 (rcall + 1);
if (rcall + 5 + offset != ent_crit)
return NULL;
mov_pfast_cwd = rcall + 5;
}
/* After locking the critical section, the code should read the global
PFAST_CWD * pointer that is guarded by that critical section. */
if (mov_pfast_cwd[0] != 0x8b)
return NULL;
return (fcwd_access_t **) peek32 (mov_pfast_cwd + 2);
}
#endif
static fcwd_access_t ** static fcwd_access_t **
find_fast_cwd () find_fast_cwd ()

View File

@ -19,11 +19,7 @@ extern struct per_process __cygwin_user_data;
/* We use the following to test that sizeof hasn't changed. When adding /* We use the following to test that sizeof hasn't changed. When adding
or deleting members, insert fillers or use the reserved entries. or deleting members, insert fillers or use the reserved entries.
Do not change this value. */ Do not change this value. */
#ifdef __x86_64__
#define SIZEOF_PER_PROCESS (41 * 8) #define SIZEOF_PER_PROCESS (41 * 8)
#else
#define SIZEOF_PER_PROCESS (42 * 4)
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -222,11 +222,7 @@ shmat (int shmid, const void *shmaddr, int shmflg)
} }
NTSTATUS status; NTSTATUS status;
SIZE_T viewsize = ssh_entry->size; SIZE_T viewsize = ssh_entry->size;
#ifdef __x86_64__
vm_object_t ptr = mmap_alloc.alloc (NULL, viewsize, false); vm_object_t ptr = mmap_alloc.alloc (NULL, viewsize, false);
#else
vm_object_t ptr = NULL;
#endif
ULONG access = (shmflg & SHM_RDONLY) ? PAGE_READONLY : PAGE_READWRITE; ULONG access = (shmflg & SHM_RDONLY) ? PAGE_READONLY : PAGE_READWRITE;
status = NtMapViewOfSection (ssh_entry->hdl, NtCurrentProcess (), &ptr, 0, status = NtMapViewOfSection (ssh_entry->hdl, NtCurrentProcess (), &ptr, 0,

View File

@ -50,13 +50,8 @@ char NO_COPY myself_nowait_dummy[1] = {'0'};
This class can allocate memory. But there's no need to free it This class can allocate memory. But there's no need to free it
because only one instance of the class is created per process. */ because only one instance of the class is created per process. */
class child_procs { class child_procs {
#ifdef __i386__
static const int _NPROCS = 256;
static const int _NPROCS_2 = 1023;
#else
static const int _NPROCS = 1024; static const int _NPROCS = 1024;
static const int _NPROCS_2 = 4095; static const int _NPROCS_2 = 4095;
#endif
int _count; int _count;
uint8_t _procs[_NPROCS * sizeof (pinfo)] __attribute__ ((__aligned__)); uint8_t _procs[_NPROCS * sizeof (pinfo)] __attribute__ ((__aligned__));
pinfo *_procs_2; pinfo *_procs_2;

View File

@ -219,37 +219,29 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap)
break; break;
case 'R': case 'R':
{ {
#ifdef __x86_64__
if (l_opt) if (l_opt)
Rval = va_arg (ap, int64_t); Rval = va_arg (ap, int64_t);
else else
#endif
Rval = va_arg (ap, int32_t); Rval = va_arg (ap, int32_t);
dst = __rn (dst, 10, addsign, Rval, len, pad, LMASK); dst = __rn (dst, 10, addsign, Rval, len, pad, LMASK);
} }
break; break;
case 'd': case 'd':
base = 10; base = 10;
#ifdef __x86_64__
if (l_opt) if (l_opt)
goto gen_decimalLL; goto gen_decimalLL;
#endif
goto gen_decimal; goto gen_decimal;
case 'u': case 'u':
base = 10; base = 10;
addsign = 0; addsign = 0;
#ifdef __x86_64__
if (l_opt) if (l_opt)
goto gen_decimalLL; goto gen_decimalLL;
#endif
goto gen_decimal; goto gen_decimal;
case 'o': case 'o':
base = 8; base = 8;
addsign = 0; addsign = 0;
#ifdef __x86_64__
if (l_opt) if (l_opt)
goto gen_decimalLL; goto gen_decimalLL;
#endif
goto gen_decimal; goto gen_decimal;
case 'y': case 'y':
*dst++ = '0'; *dst++ = '0';
@ -258,10 +250,8 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap)
case 'x': case 'x':
base = 16; base = 16;
addsign = 0; addsign = 0;
#ifdef __x86_64__
if (l_opt) if (l_opt)
goto gen_decimalLL; goto gen_decimalLL;
#endif
gen_decimal: gen_decimal:
dst = rnarg (dst, h_opt * base, addsign, len, pad); dst = rnarg (dst, h_opt * base, addsign, len, pad);
break; break;
@ -289,11 +279,7 @@ gen_decimalLL:
case 'p': case 'p':
*dst++ = '0'; *dst++ = '0';
*dst++ = 'x'; *dst++ = 'x';
#ifdef __x86_64__
dst = rnargLL (dst, h_opt * 16, 0, len, pad); dst = rnargLL (dst, h_opt * 16, 0, len, pad);
#else
dst = rnarg (dst, h_opt * 16, 0, len, pad);
#endif
break; break;
case '.': case '.':
n = strtol (fmt, (char **) &fmt, 10); n = strtol (fmt, (char **) &fmt, 10);
@ -503,9 +489,7 @@ __small_vswprintf (PWCHAR dst, const WCHAR *fmt, va_list ap)
while (*fmt) while (*fmt)
{ {
unsigned int n = 0x7fff; unsigned int n = 0x7fff;
#ifdef __x86_64__
bool l_opt = false; bool l_opt = false;
#endif
/* set to -1 on '_', indicates upper (1)/lower(-1) case */ /* set to -1 on '_', indicates upper (1)/lower(-1) case */
int h_opt = 1; int h_opt = 1;
if (*fmt != L'%') if (*fmt != L'%')
@ -543,9 +527,7 @@ __small_vswprintf (PWCHAR dst, const WCHAR *fmt, va_list ap)
len = len * 10 + (c - L'0'); len = len * 10 + (c - L'0');
continue; continue;
case L'l': case L'l':
#ifdef __x86_64__
l_opt = true; l_opt = true;
#endif
continue; continue;
case '_': case '_':
h_opt = -1; h_opt = -1;
@ -560,37 +542,29 @@ __small_vswprintf (PWCHAR dst, const WCHAR *fmt, va_list ap)
break; break;
case 'R': case 'R':
{ {
#ifdef __x86_64__
if (l_opt) if (l_opt)
Rval = va_arg (ap, int64_t); Rval = va_arg (ap, int64_t);
else else
#endif
Rval = va_arg (ap, int32_t); Rval = va_arg (ap, int32_t);
dst = __wrn (dst, 10, addsign, Rval, len, pad, LMASK); dst = __wrn (dst, 10, addsign, Rval, len, pad, LMASK);
} }
break; break;
case L'd': case L'd':
base = 10; base = 10;
#ifdef __x86_64__
if (l_opt) if (l_opt)
goto gen_decimalLL; goto gen_decimalLL;
#endif
goto gen_decimal; goto gen_decimal;
case 'u': case 'u':
base = 10; base = 10;
addsign = 0; addsign = 0;
#ifdef __x86_64__
if (l_opt) if (l_opt)
goto gen_decimalLL; goto gen_decimalLL;
#endif
goto gen_decimal; goto gen_decimal;
case 'o': case 'o':
base = 8; base = 8;
addsign = 0; addsign = 0;
#ifdef __x86_64__
if (l_opt) if (l_opt)
goto gen_decimalLL; goto gen_decimalLL;
#endif
goto gen_decimal; goto gen_decimal;
case 'y': case 'y':
*dst++ = '0'; *dst++ = '0';
@ -599,10 +573,8 @@ __small_vswprintf (PWCHAR dst, const WCHAR *fmt, va_list ap)
case 'x': case 'x':
base = 16; base = 16;
addsign = 0; addsign = 0;
#ifdef __x86_64__
if (l_opt) if (l_opt)
goto gen_decimalLL; goto gen_decimalLL;
#endif
gen_decimal: gen_decimal:
dst = wrnarg (dst, h_opt * base, addsign, len, pad); dst = wrnarg (dst, h_opt * base, addsign, len, pad);
break; break;
@ -630,11 +602,7 @@ gen_decimalLL:
case L'p': case L'p':
*dst++ = L'0'; *dst++ = L'0';
*dst++ = L'x'; *dst++ = L'x';
#ifdef __x86_64__
dst = wrnargLL (dst, h_opt * 16, 0, len, pad); dst = wrnargLL (dst, h_opt * 16, 0, len, pad);
#else
dst = wrnarg (dst, h_opt * 16, 0, len, pad);
#endif
break; break;
case L'P': case L'P':
RtlInitUnicodeString (us = &uw, global_progname); RtlInitUnicodeString (us = &uw, global_progname);

View File

@ -19,7 +19,7 @@ struct sigdesc
const char *str; const char *str;
}; };
#define __signals_common \ #define __signals \
_s(SIGHUP, "Hangup"), /* 1 */ \ _s(SIGHUP, "Hangup"), /* 1 */ \
_s(SIGINT, "Interrupt"), /* 2 */ \ _s(SIGINT, "Interrupt"), /* 2 */ \
_s(SIGQUIT, "Quit"), /* 3 */ \ _s(SIGQUIT, "Quit"), /* 3 */ \
@ -54,11 +54,7 @@ struct sigdesc
_s2(SIGPWR, "Power failure", /* 29 */ \ _s2(SIGPWR, "Power failure", /* 29 */ \
SIGLOST, "Resource lost"), \ SIGLOST, "Resource lost"), \
_s(SIGUSR1, "User defined signal 1"), /* 30 */ \ _s(SIGUSR1, "User defined signal 1"), /* 30 */ \
_s(SIGUSR2, "User defined signal 2"), /* 31 */ _s(SIGUSR2, "User defined signal 2"), /* 31 */ \
#ifdef __x86_64__
# define __signals \
__signals_common \
_s(SIGRTMIN, "Real-time signal 0"), /* 32 */ \ _s(SIGRTMIN, "Real-time signal 0"), /* 32 */ \
_s(SIGRTMIN + 1, "Real-time signal 1"), /* 33 */ \ _s(SIGRTMIN + 1, "Real-time signal 1"), /* 33 */ \
_s(SIGRTMIN + 2, "Real-time signal 2"), /* 34 */ \ _s(SIGRTMIN + 2, "Real-time signal 2"), /* 34 */ \
@ -92,12 +88,6 @@ struct sigdesc
_s(SIGRTMIN + 30, "Real-time signal 30"), /* 62 */ \ _s(SIGRTMIN + 30, "Real-time signal 30"), /* 62 */ \
_s(SIGRTMIN + 31, "Real-time signal 31"), /* 63 */ \ _s(SIGRTMIN + 31, "Real-time signal 31"), /* 63 */ \
_s(SIGRTMAX, "Real-time signal 32") /* 64 */ _s(SIGRTMAX, "Real-time signal 32") /* 64 */
#else
# define __signals \
__signals_common \
_s2(SIGRTMIN, "Real-time signal 0", /* 32 */ \
SIGRTMAX, "Real-time signal 0")
#endif
#define _s(n, s) #n #define _s(n, s) #n
#define _s2(n, s, n1, s1) #n #define _s2(n, s, n1, s1) #n

View File

@ -664,7 +664,6 @@ static struct
{0, NULL}, /* _CS_POSIX_V6_ILP32_OFF32_LDFLAGS */ {0, NULL}, /* _CS_POSIX_V6_ILP32_OFF32_LDFLAGS */
{0, NULL}, /* _CS_POSIX_V6_ILP32_OFF32_LIBS */ {0, NULL}, /* _CS_POSIX_V6_ILP32_OFF32_LIBS */
{0, NULL}, /* _CS_XBS5_ILP32_OFF32_LINTFLAGS */ {0, NULL}, /* _CS_XBS5_ILP32_OFF32_LINTFLAGS */
#ifdef __x86_64__
{0, NULL}, /* _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS */ {0, NULL}, /* _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS */
{0, NULL}, /* _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS */ {0, NULL}, /* _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS */
{0, NULL}, /* _CS_POSIX_V6_ILP32_OFFBIG_LIBS */ {0, NULL}, /* _CS_POSIX_V6_ILP32_OFFBIG_LIBS */
@ -678,21 +677,6 @@ static struct
{ls ("")}, /* _CS_POSIX_V6_LPBIG_OFFBIG_LIBS */ {ls ("")}, /* _CS_POSIX_V6_LPBIG_OFFBIG_LIBS */
{ls ("")}, /* _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS */ {ls ("")}, /* _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS */
{ls ("POSIX_V6_LP64_OFF64")}, /* _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS */ {ls ("POSIX_V6_LP64_OFF64")}, /* _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS */
#else
{ls ("")}, /* _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS */
{ls ("")}, /* _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS */
{ls ("")}, /* _CS_POSIX_V6_ILP32_OFFBIG_LIBS */
{ls ("")}, /* _CS_XBS5_ILP32_OFFBIG_LINTFLAGS */
{0, NULL}, /* _CS_POSIX_V6_LP64_OFF64_CFLAGS */
{0, NULL}, /* _CS_POSIX_V6_LP64_OFF64_LDFLAGS */
{0, NULL}, /* _CS_POSIX_V6_LP64_OFF64_LIBS */
{0, NULL}, /* _CS_XBS5_LP64_OFF64_LINTFLAGS */
{0, NULL}, /* _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS */
{0, NULL}, /* _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS */
{0, NULL}, /* _CS_POSIX_V6_LPBIG_OFFBIG_LIBS */
{0, NULL}, /* _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS */
{ls ("POSIX_V6_ILP32_OFFBIG")}, /* _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS */
#endif
{ls ("")}, /* _CS_POSIX_V7_THREADS_CFLAGS */ {ls ("")}, /* _CS_POSIX_V7_THREADS_CFLAGS */
{ls ("")}, /* _CS_POSIX_V7_THREADS_LDFLAGS */ {ls ("")}, /* _CS_POSIX_V7_THREADS_LDFLAGS */
{ls ("POSIXLY_CORRECT=1")}, /* _CS_V7_ENV */ {ls ("POSIXLY_CORRECT=1")}, /* _CS_V7_ENV */

View File

@ -630,11 +630,7 @@ pthread::cancel ()
threadlist_t *tl_entry = cygheap->find_tls (cygtls); threadlist_t *tl_entry = cygheap->find_tls (cygtls);
if (!cygtls->inside_kernel (&context)) if (!cygtls->inside_kernel (&context))
{ {
#ifdef __x86_64__
context.Rip = (ULONG_PTR) pthread::static_cancel_self; context.Rip = (ULONG_PTR) pthread::static_cancel_self;
#else
context.Eip = (DWORD) pthread::static_cancel_self;
#endif
SetThreadContext (win32_obj_id, &context); SetThreadContext (win32_obj_id, &context);
} }
cygheap->unlock_tls (tl_entry); cygheap->unlock_tls (tl_entry);

View File

@ -73,9 +73,7 @@ public:
{ {
return ((wincaps *) this->caps)->def_guard_pages * page_size (); return ((wincaps *) this->caps)->def_guard_pages * page_size ();
} }
#ifdef __x86_64__
intptr_t IMPLEMENT (mmap_storage_high) intptr_t IMPLEMENT (mmap_storage_high)
#endif
bool IMPLEMENT (is_server) bool IMPLEMENT (is_server)
bool IMPLEMENT (needs_query_information) bool IMPLEMENT (needs_query_information)
bool IMPLEMENT (has_precise_system_time) bool IMPLEMENT (has_precise_system_time)

View File

@ -156,11 +156,6 @@ extern "C" PVOID dll_dllcrt0 (HMODULE, per_process *);
extern "C" void _pei386_runtime_relocator (per_process *); extern "C" void _pei386_runtime_relocator (per_process *);
#ifdef __i386__
/* dynamically loaded dll initialization for non-cygwin apps */
extern "C" int dll_noncygwin_dllcrt0 (HMODULE, per_process *);
#endif /* __i386__ */
void do_exit (int) __attribute__ ((noreturn)); void do_exit (int) __attribute__ ((noreturn));
/* libstdc++ malloc operator wrapper support. */ /* libstdc++ malloc operator wrapper support. */
@ -259,12 +254,7 @@ extern inline bool flush_file_buffers (HANDLE h)
#define NO_R ~(S_IRUSR | S_IRGRP | S_IROTH) #define NO_R ~(S_IRUSR | S_IRGRP | S_IROTH)
#define NO_X ~(S_IXUSR | S_IXGRP | S_IXOTH) #define NO_X ~(S_IXUSR | S_IXGRP | S_IXOTH)
#ifdef __x86_64__
extern "C" char __data_start__, __data_end__, __bss_start__, __bss_end__; extern "C" char __data_start__, __data_end__, __bss_start__, __bss_end__;
#else
extern "C" char _data_start__, _data_end__, _bss_start__, _bss_end__;
#endif
extern "C" void (*__CTOR_LIST__) (void); extern "C" void (*__CTOR_LIST__) (void);
extern "C" void (*__DTOR_LIST__) (void); extern "C" void (*__DTOR_LIST__) (void);