Cygwin: Treat PROCESSOR_ARCHITECTURE_INTEL as running under WOW64 on ARM64

Bug in current ARM64 WOW64: GetNativeSystemInfo returns
PROCESSOR_ARCHITECTURE_INTEL rather than PROCESSOR_ARCHITECTURE_ARM64.
Provide for this.

Make code better readable.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2018-07-12 15:28:13 +02:00
parent 430b529111
commit 5ed8f2354f
1 changed files with 24 additions and 9 deletions

View File

@ -4306,19 +4306,34 @@ find_fast_cwd ()
fcwd_access_t **f_cwd_ptr = find_fast_cwd_pointer (); fcwd_access_t **f_cwd_ptr = find_fast_cwd_pointer ();
if (!f_cwd_ptr) if (!f_cwd_ptr)
{ {
bool warn = 1;
#ifndef __x86_64__ #ifndef __x86_64__
#ifndef PROCESSOR_ARCHITECTURE_ARM64 #ifndef PROCESSOR_ARCHITECTURE_ARM64
#define PROCESSOR_ARCHITECTURE_ARM64 12 #define PROCESSOR_ARCHITECTURE_ARM64 12
#endif #endif
SYSTEM_INFO si; SYSTEM_INFO si;
/* Check if we're running in WOW64 on ARM64. Skip the warning as long as /* Check if we're running in WOW64 on ARM64. Skip the warning as long as
there's no solution for finding the FAST_CWD pointer on that system. */ there's no solution for finding the FAST_CWD pointer on that system.
if (wincap.is_wow64 ()
&& (GetNativeSystemInfo (&si), 2018-07-12: Apparently current ARM64 WOW64 has a bug:
si.wProcessorArchitecture != PROCESSOR_ARCHITECTURE_ARM64)) It's GetNativeSystemInfo returns PROCESSOR_ARCHITECTURE_INTEL in
#endif wProcessorArchitecture. Since that's an invalid value (a 32 bit
small_printf ("Cygwin WARNING:\n" host system hosting a 32 bit emulator for itself?) we can use this
value as an indicator to skip the message as well. */
if (wincap.is_wow64 ())
{
GetNativeSystemInfo (&si);
if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_ARM64
|| si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
warn = 0;
}
#endif /* !__x86_64__ */
if (warn)
small_printf ("Cygwin WARNING:\n"
" Couldn't compute FAST_CWD pointer. This typically occurs if you're using\n" " Couldn't compute FAST_CWD pointer. This typically occurs if you're using\n"
" an older Cygwin version on a newer Windows. Please update to the latest\n" " an older Cygwin version on a newer Windows. Please update to the latest\n"
" available Cygwin version from https://cygwin.com/. If the problem persists,\n" " available Cygwin version from https://cygwin.com/. If the problem persists,\n"