|
| 1 | +From 6183b8336e29b058b63dcf97ff8214b0355f165a Mon Sep 17 00:00:00 2001 |
| 2 | +From: Corinna Vinschen < [email protected]> |
| 3 | +Date: Tue, 13 Feb 2024 16:47:51 +0100 |
| 4 | +Subject: [PATCH 53/N] Cygwin: find_fast_cwd: don't run assembler checking |
| 5 | + code on ARM64 |
| 6 | + |
| 7 | +https://cygwin.com/pipermail/cygwin/2024-February/255397.html |
| 8 | +reports a crash on ARM64 probably related to checking x86_64 |
| 9 | +code on the x86_64 emulator on AArch64. |
| 10 | + |
| 11 | +At least for testing, pull the code checking the host HW |
| 12 | +up to be called before trying to evaluate assembler code. |
| 13 | + |
| 14 | +This fixes https://github.com/git-for-windows/git/issues/4808 |
| 15 | + |
| 16 | +Backported from 4e77fa9b8b (Cygwin: find_fast_cwd: don't run assembler |
| 17 | +checking code on ARM64, 2024-02-13). |
| 18 | + |
| 19 | +Signed-off-by: Corinna Vinschen < [email protected]> |
| 20 | +Signed-off-by: Johannes Schindelin < [email protected]> |
| 21 | +--- |
| 22 | + winsup/cygwin/path.cc | 28 +++++++++++++--------------- |
| 23 | + 1 file changed, 13 insertions(+), 15 deletions(-) |
| 24 | + |
| 25 | +diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc |
| 26 | +index d06f3f0..c3623f9 100644 |
| 27 | +--- a/winsup/cygwin/path.cc |
| 28 | ++++ b/winsup/cygwin/path.cc |
| 29 | +@@ -4851,29 +4851,27 @@ find_fast_cwd_pointer () |
| 30 | + static fcwd_access_t ** |
| 31 | + find_fast_cwd () |
| 32 | + { |
| 33 | ++ USHORT emulated, hosted; |
| 34 | ++ fcwd_access_t **f_cwd_ptr; |
| 35 | ++ |
| 36 | ++ /* First check if we're running in WOW64 on ARM64 emulating AMD64. Skip |
| 37 | ++ fetching FAST_CWD pointer as long as there's no solution for finding |
| 38 | ++ it on that system. */ |
| 39 | ++ if (IsWow64Process2 (GetCurrentProcess (), &emulated, &hosted) |
| 40 | ++ && hosted == IMAGE_FILE_MACHINE_ARM64) |
| 41 | ++ return NULL; |
| 42 | ++ |
| 43 | + /* Fetch the pointer but don't set the global fast_cwd_ptr yet. First |
| 44 | + we have to make sure we know the version of the FAST_CWD structure |
| 45 | + used on the system. */ |
| 46 | +- fcwd_access_t **f_cwd_ptr = find_fast_cwd_pointer (); |
| 47 | ++ f_cwd_ptr = find_fast_cwd_pointer (); |
| 48 | + if (!f_cwd_ptr) |
| 49 | +- { |
| 50 | +- bool warn = 1; |
| 51 | +- USHORT emulated, hosted; |
| 52 | +- |
| 53 | +- /* Check if we're running in WOW64 on ARM64 emulating AMD64. Skip |
| 54 | +- warning as long as there's no solution for finding the FAST_CWD |
| 55 | +- pointer on that system. */ |
| 56 | +- if (IsWow64Process2 (GetCurrentProcess (), &emulated, &hosted) |
| 57 | +- && hosted == IMAGE_FILE_MACHINE_ARM64) |
| 58 | +- warn = 0; |
| 59 | +- |
| 60 | +- if (warn) |
| 61 | +- small_printf ("Cygwin WARNING:\n" |
| 62 | ++ small_printf ("Cygwin WARNING:\n" |
| 63 | + " Couldn't compute FAST_CWD pointer. This typically occurs if you're using\n" |
| 64 | + " an older Cygwin version on a newer Windows. Please update to the latest\n" |
| 65 | + " available Cygwin version from https://cygwin.com/. If the problem persists,\n" |
| 66 | + " please see https://cygwin.com/problems.html\n\n"); |
| 67 | +- } |
| 68 | ++ |
| 69 | + /* Eventually, after we set the version as well, set fast_cwd_ptr. */ |
| 70 | + return f_cwd_ptr; |
| 71 | + } |
0 commit comments