Re: [PATCH 0/4] find_fast_cwd_pointer rewrite

2025-03-26 Thread Jeremy Drake via Cygwin-patches
> If I would change a thing, it would only be to extend the loop condition > to include `&& ud_insn_mnemonic (&ud_obj) != UD_Iret`, so as to avoid > running outside the function. Yes, I was thinking about this after I sent the patches: terminate the loop(s) if it hits a `ret` or possibly an uncond

Re: [PATCH 2/4] Cygwin: vendor libudis86 1.7.2

2025-03-26 Thread Jeremy Drake via Cygwin-patches
On Mon, 24 Mar 2025, Corinna Vinschen wrote: > Hi Jeremy, > > On Mar 21 16:47, Jeremy Drake via Cygwin-patches wrote: > > From: Jeremy Drake > > > > This does not include the source files responsible for generating AT&T- > > or Intel-syntax assembly output, and ifdefs out the large table of > > o

Re: [PATCH 0/4] find_fast_cwd_pointer rewrite

2025-03-26 Thread Johannes Schindelin
Hi Jeremy, first of all: thank you for doing this! I had planned on investing some time to figure out a "cheap" way to determine opcode lengths and skip uninteresting ones, and it would invariably have been a lot hackier than the solution you came up with, and I would probably have taken six month

[PATCH v2 1/5] Cygwin: factor out find_fast_cwd_pointer to arch-specific file.

2025-03-26 Thread Jeremy Drake via Cygwin-patches
From: Jeremy Drake This is in preparation for rewriting it using udis86, and adding an implementation for aarch64 hosts. Signed-off-by: Jeremy Drake --- winsup/cygwin/Makefile.am | 1 + winsup/cygwin/path.cc | 122 +-- winsup/cygwin/x86_64/fa

[PATCH v2 0/5] find_fast_cwd_pointer rewrite

2025-03-26 Thread Jeremy Drake via Cygwin-patches
v2 splits the vendoring of libudis86 into importing the original files and then patching them (and adding them to Makefile.am at that point). It also has both x86_64 and aarch64 implementations exit loops on rets or unconditional jumps. Jeremy Drake (5): Cygwin: factor out find_fast_cwd_pointer

[PATCH v2 3/5] Cygwin: patch libudis86 to build as part of Cygwin

2025-03-26 Thread Jeremy Drake via Cygwin-patches
From: Jeremy Drake This ifdefs out the large table of opcode strings (and the function that references it) since we're only interested in walking machine code, not generating disassembly, and makes a couple of other tables "const" so that they end up in .rdata instead of .data. Signed-off-by: Je

[PATCH v2 4/5] Cygwin: use udis86 to find fast cwd pointer on x64

2025-03-26 Thread Jeremy Drake via Cygwin-patches
From: Jeremy Drake This makes find_fast_cwd_pointer more resiliant in the face of changes to the generated code in ntdll. Signed-off-by: Jeremy Drake --- winsup/cygwin/x86_64/fastcwd_x86_64.cc | 204 +++-- 1 file changed, 124 insertions(+), 80 deletions(-) diff --git a/win

[PATCH v2 5/5] Cygwin: add find_fast_cwd_pointer_aarch64.

2025-03-26 Thread Jeremy Drake via Cygwin-patches
From: Jeremy Drake This works for aarch64 hosts when the target is aarch64, x86_64, or i686, with only a small #if block in one function that needs to care. Signed-off-by: Jeremy Drake --- winsup/cygwin/Makefile.am| 1 + winsup/cygwin/fastcwd_aarch64.cc | 203

Re: [PATCH] Cygwin: thread: Allow fast_mutex to be acquired multiple times.

2025-03-26 Thread Corinna Vinschen
Hi Takashi, On Mar 26 18:14, Takashi Yano wrote: > Hi Corinna, > > On Mon, 24 Mar 2025 16:35:08 +0100 > Corinna Vinschen wrote: > > On Mar 24 22:05, Takashi Yano wrote: > > > Hi Corinna, > > > > > > On Mon, 24 Mar 2025 11:57:06 +0100 > > > Corinna Vinschen wrote: > > > > I wonder if we shouldn't

Re: [PATCH] Cygwin: thread: Allow fast_mutex to be acquired multiple times.

2025-03-26 Thread Takashi Yano
Hi Corinna, On Mon, 24 Mar 2025 16:35:08 +0100 Corinna Vinschen wrote: > On Mar 24 22:05, Takashi Yano wrote: > > Hi Corinna, > > > > On Mon, 24 Mar 2025 11:57:06 +0100 > > Corinna Vinschen wrote: > > > On Mar 24 14:53, Takashi Yano wrote: > > > > Previously, the fast_mutex defined in thread.h co

Re: [PATCH] Cygwin: thread: Allow fast_mutex to be acquired multiple times.

2025-03-26 Thread Takashi Yano
On Wed, 26 Mar 2025 18:14:04 +0900 Takashi Yanowrote: > Hi Corinna, > > On Mon, 24 Mar 2025 16:35:08 +0100 > Corinna Vinschen wrote: > > On Mar 24 22:05, Takashi Yano wrote: > > > Hi Corinna, > > > > > > On Mon, 24 Mar 2025 11:57:06 +0100 > > > Corinna Vinschen wrote: > > > > On Mar 24 14:53, Tak

Re: [PATCH v2] Cygwin: signal: Copy context to alternate stack in the SA_ONSTACK case

2025-03-26 Thread Corinna Vinschen
On Mar 25 21:54, Takashi Yano wrote: > After the commit 0210c77311ae, the context passed to signal handler > cannot be accessed from the signal handler that uses alternate stack. > This is because the context locally copied is on the stack that is > different area from the signal handler uses. With