Skip to content

Commit 6183b83

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 7913a41 commit 6183b83

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
@@ -4851,29 +4851,27 @@ find_fast_cwd_pointer ()
48514851
static fcwd_access_t **
48524852
find_fast_cwd ()
48534853
{
4854+
USHORT emulated, hosted;
4855+
fcwd_access_t **f_cwd_ptr;
4856+
4857+
/* First check if we're running in WOW64 on ARM64 emulating AMD64. Skip
4858+
fetching FAST_CWD pointer as long as there's no solution for finding
4859+
it on that system. */
4860+
if (IsWow64Process2 (GetCurrentProcess (), &emulated, &hosted)
4861+
&& hosted == IMAGE_FILE_MACHINE_ARM64)
4862+
return NULL;
4863+
48544864
/* Fetch the pointer but don't set the global fast_cwd_ptr yet. First
48554865
we have to make sure we know the version of the FAST_CWD structure
48564866
used on the system. */
4857-
fcwd_access_t **f_cwd_ptr = find_fast_cwd_pointer ();
4867+
f_cwd_ptr = find_fast_cwd_pointer ();
48584868
if (!f_cwd_ptr)
4859-
{
4860-
bool warn = 1;
4861-
USHORT emulated, hosted;
4862-
4863-
/* Check if we're running in WOW64 on ARM64 emulating AMD64. Skip
4864-
warning as long as there's no solution for finding the FAST_CWD
4865-
pointer on that system. */
4866-
if (IsWow64Process2 (GetCurrentProcess (), &emulated, &hosted)
4867-
&& hosted == IMAGE_FILE_MACHINE_ARM64)
4868-
warn = 0;
4869-
4870-
if (warn)
4871-
small_printf ("Cygwin WARNING:\n"
4869+
small_printf ("Cygwin WARNING:\n"
48724870
" Couldn't compute FAST_CWD pointer. This typically occurs if you're using\n"
48734871
" an older Cygwin version on a newer Windows. Please update to the latest\n"
48744872
" available Cygwin version from https://cygwin.com/. If the problem persists,\n"
48754873
" please see https://cygwin.com/problems.html\n\n");
4876-
}
4874+
48774875
/* Eventually, after we set the version as well, set fast_cwd_ptr. */
48784876
return f_cwd_ptr;
48794877
}

0 commit comments

Comments
 (0)