Skip to content

Commit b879775

Browse files
github-cygwinlazka
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 e72880f commit b879775

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
@@ -4825,29 +4825,27 @@ find_fast_cwd_pointer ()
48254825
static fcwd_access_t **
48264826
find_fast_cwd ()
48274827
{
4828+
USHORT emulated, hosted;
4829+
fcwd_access_t **f_cwd_ptr;
4830+
4831+
/* First check if we're running in WOW64 on ARM64 emulating AMD64. Skip
4832+
fetching FAST_CWD pointer as long as there's no solution for finding
4833+
it on that system. */
4834+
if (IsWow64Process2 (GetCurrentProcess (), &emulated, &hosted)
4835+
&& hosted == IMAGE_FILE_MACHINE_ARM64)
4836+
return NULL;
4837+
48284838
/* Fetch the pointer but don't set the global fast_cwd_ptr yet. First
48294839
we have to make sure we know the version of the FAST_CWD structure
48304840
used on the system. */
4831-
fcwd_access_t **f_cwd_ptr = find_fast_cwd_pointer ();
4841+
f_cwd_ptr = find_fast_cwd_pointer ();
48324842
if (!f_cwd_ptr)
4833-
{
4834-
bool warn = 1;
4835-
USHORT emulated, hosted;
4836-
4837-
/* Check if we're running in WOW64 on ARM64 emulating AMD64. Skip
4838-
warning as long as there's no solution for finding the FAST_CWD
4839-
pointer on that system. */
4840-
if (IsWow64Process2 (GetCurrentProcess (), &emulated, &hosted)
4841-
&& hosted == IMAGE_FILE_MACHINE_ARM64)
4842-
warn = 0;
4843-
4844-
if (warn)
4845-
small_printf ("Cygwin WARNING:\n"
4843+
small_printf ("Cygwin WARNING:\n"
48464844
" Couldn't compute FAST_CWD pointer. This typically occurs if you're using\n"
48474845
" an older Cygwin version on a newer Windows. Please update to the latest\n"
48484846
" available Cygwin version from https://cygwin.com/. If the problem persists,\n"
48494847
" please see https://cygwin.com/problems.html\n\n");
4850-
}
4848+
48514849
/* Eventually, after we set the version as well, set fast_cwd_ptr. */
48524850
return f_cwd_ptr;
48534851
}

0 commit comments

Comments
 (0)