Skip to content

Commit 856e949

Browse files
github-cygwindscho
authored andcommitted
Cygwin: find_fast_cwd: don't run assembler checking code on ARM64
https://cygwin.com/pipermail/cygwin/2024-February/255397.html reports a crash on ARM64 probably related to checking x86_64 code on the x86_64 emulator on AArch64. At least for testing, pull the code checking the host HW up to be called before trying to evaluate assembler code. This fixes git-for-windows/git#4808 Backported from 4e77fa9 (Cygwin: find_fast_cwd: don't run assembler checking code on ARM64, 2024-02-13). Signed-off-by: Corinna Vinschen <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 905cab1 commit 856e949

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

winsup/cygwin/path.cc

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4828,29 +4828,27 @@ find_fast_cwd_pointer ()
48284828
static fcwd_access_t **
48294829
find_fast_cwd ()
48304830
{
4831+
USHORT emulated, hosted;
4832+
fcwd_access_t **f_cwd_ptr;
4833+
4834+
/* First check if we're running in WOW64 on ARM64 emulating AMD64. Skip
4835+
fetching FAST_CWD pointer as long as there's no solution for finding
4836+
it on that system. */
4837+
if (IsWow64Process2 (GetCurrentProcess (), &emulated, &hosted)
4838+
&& hosted == IMAGE_FILE_MACHINE_ARM64)
4839+
return NULL;
4840+
48314841
/* Fetch the pointer but don't set the global fast_cwd_ptr yet. First
48324842
we have to make sure we know the version of the FAST_CWD structure
48334843
used on the system. */
4834-
fcwd_access_t **f_cwd_ptr = find_fast_cwd_pointer ();
4844+
f_cwd_ptr = find_fast_cwd_pointer ();
48354845
if (!f_cwd_ptr)
4836-
{
4837-
bool warn = 1;
4838-
USHORT emulated, hosted;
4839-
4840-
/* Check if we're running in WOW64 on ARM64 emulating AMD64. Skip
4841-
warning as long as there's no solution for finding the FAST_CWD
4842-
pointer on that system. */
4843-
if (IsWow64Process2 (GetCurrentProcess (), &emulated, &hosted)
4844-
&& hosted == IMAGE_FILE_MACHINE_ARM64)
4845-
warn = 0;
4846-
4847-
if (warn)
4848-
small_printf ("Cygwin WARNING:\n"
4846+
small_printf ("Cygwin WARNING:\n"
48494847
" Couldn't compute FAST_CWD pointer. This typically occurs if you're using\n"
48504848
" an older Cygwin version on a newer Windows. Please update to the latest\n"
48514849
" available Cygwin version from https://cygwin.com/. If the problem persists,\n"
48524850
" please see https://cygwin.com/problems.html\n\n");
4853-
}
4851+
48544852
/* Eventually, after we set the version as well, set fast_cwd_ptr. */
48554853
return f_cwd_ptr;
48564854
}

0 commit comments

Comments
 (0)