[PATCH v2 0/1] MR11677: msvcrt: Introduce asm wrapper for _isatty on x64.
-- v2: msvcrt: Introduce asm wrapper for _isatty on x64. https://gitlab.winehq.org/wine/wine/-/merge_requests/11677
From: Paul Gofman <pgofman@codeweavers.com> Allows Ruby runtime to find internal ioinfo structure and fixes fatal error on runtime initialization. --- dlls/msvcrt/file.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index a095a4f8b0a..71972540c13 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -44,6 +44,7 @@ #include "mtdll.h" #include "wine/asm.h" #include "wine/debug.h" +#include "wine/asm.h" WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); @@ -855,12 +856,25 @@ static int msvcrt_flush_buffer(FILE* file) /********************************************************************* * _isatty (MSVCRT.@) */ -int CDECL _isatty(int fd) +int CDECL MSVCRT__isatty(int fd) { TRACE(":fd (%d)\n",fd); return get_ioinfo_nolock(fd)->wxflag & WX_TTY; } +#if defined(__x86_64__) && !defined(__arm64ec__) +__ASM_GLOBAL_FUNC( _isatty, + "jmp " __ASM_NAME("MSVCRT__isatty") "\n\t" + /* These instructions are needed for Ruby runtime to find internal pioinfo address. */ + "lea MSVCRT___pioinfo(%rip),%rdx\n\t" + "addq $0,%rsp\n\t" + "ret" ) +#else +int CDECL _isatty(int fd) +{ + return MSVCRT__isatty(fd); +} +#endif /* INTERNAL: Allocate stdio file buffer */ static BOOL msvcrt_alloc_buffer(FILE* file) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11677
v2: - just jump to implementation and keep artificial code completely separate. Also this way .seh info is not needed. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11677#note_149078
This merge request was approved by Piotr Caban. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11677
participants (3)
-
Paul Gofman -
Paul Gofman (@gofman) -
Piotr Caban (@piotr)