Commit Graph

131 Commits

Author SHA1 Message Date
Brendan Shanks 57c04fd07c ntdll: Use 32-bit stack in alloc_fs_sel().
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-20 17:21:10 +02:00
Brendan Shanks a906f13f77 ntdll: Ensure CONTEXT_EX on exception stack is initialized.
On non-AVX CPUs, CONTEXT_EX is not being initialized.
In WOW64 mode, this results in invalid exception records when
dispatch_wow_exception() uses RtlCopyContext().

Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-04 10:50:33 +01:00
Damjan Jovanovic 7a6ef5c2df ntdll: Use the correct amd64 trap codes on *BSD.
Fix the *BSD trap codes on amd64 like 148120f21e
did on i386.

Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-25 20:50:49 +01:00
Jinoh Kang e60fdbf124 ntdll: Properly test for LLVM libunwind error codes.
Commit f37b953e07 (ntdll: Support both HP-UX-like libunwind and LLVM
libunwind error codes., 2021-12-10) made an unsuccessful attempt to fix
UNW_ENOINFO detection on LLVM libunwind.  It turns out that UNW_ENOINFO
is actually negative in LLVM, so there's no need to flip the sign.

Fix this by flipping the return value sign only when UNW_ENOINFO < 0
(LLVM libunwind), and then comparing it against the negated error code.
Overall, all flavours of libunwind return a negative value on error.

Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-10 22:00:17 +01:00
Jinoh Kang f37b953e07 ntdll: Support both HP-UX-like libunwind and LLVM libunwind error codes.
HP-UX libunwind uses the sign of error code to indicate whether the
operation was successful; however, LLVM always returns positive error
codes.

Normalise the sign of the error code so that it handles all flavours of
libunwind.

Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-09 18:43:51 +01:00
Jacek Caban 1facdbbdcb ntdll: Temporarily allow KeUserModeCallback calls from client stack.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-09 10:47:41 +01:00
Alexandre Julliard 0b3d65f822 ntdll: Don't restore the %fs register for exceptions happening inside system calls.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-08 15:02:58 +01:00
Paul Gofman 3f20261eaf ntdll: Set rcx on exit from syscall dispatcher on x64.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-03 19:31:55 +01:00
Alexandre Julliard e5e857c290 ntdll: Add support for dispatching exception from 32-bit code in Wow64 mode.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-01 18:13:53 +01:00
Alexandre Julliard 832724282b ntdll: Avoid including wine/port.h.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-20 16:16:07 +02:00
Jacek Caban e0a934d0ef ntdll: Handle Unix lib exception outside Unix stack.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-07 18:03:11 +02:00
Jacek Caban 2ec2e136bf ntdll: Allow Unix libraries to use exception macros.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-07 18:03:11 +02:00
Alexandre Julliard 15d5cb2256 ntdll: Copy __wine_setjmpex/longjmp implementation to avoid importing winecrt0.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-23 10:39:24 +02:00
Huw Davies dd37c3c4a0 ntdll: Remove unnecessary casts on macOS registers.
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-27 18:06:29 +02:00
Alexandre Julliard ff04d8a4c2 ntdll: Move the syscall dispatcher implementation to the platform-specific files.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-26 11:25:38 +02:00
Alexandre Julliard 847db3c1d3 ntdll: Store the syscall table in the syscall frame on all platforms.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-26 10:47:38 +02:00
Alexandre Julliard 77f5e2963f ntdll: Store the syscall flags in the syscall frame on all platforms.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-26 10:47:38 +02:00
Alexandre Julliard 6da06c1541 ntdll: Fix floating point exception codes in Wow64 mode.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-20 11:33:46 +02:00
Alexandre Julliard 2736fabc58 ntdll: Don't handle breakpoint interrupts in Wow64 mode.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-20 11:33:32 +02:00
Alexandre Julliard 8a8889340f ntdll: Fix exception information for SSE floating point faults.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-20 11:32:17 +02:00
Alexandre Julliard 94f63ea23f ntdll: Add support for user callbacks.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-17 18:16:43 +02:00
Alexandre Julliard daa1886a2c ntdll: Add a stub for NtCallbackReturn().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-17 11:52:35 +02:00
Zebediah Figura 7c10730e04 ntdll: Make alloc_fs_sel() a hidden symbol.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-13 11:36:33 +02:00
Alexandre Julliard e30f091f3b wow64cpu: Restore the full 32-bit context when changed externally.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-04 14:27:24 +02:00
Alexandre Julliard 44de9743bf ntdll: Store the 32-bit PEB in the process initial 32-bit context.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-04 12:43:07 +02:00
Zebediah Figura dae60a374e ntdll: Use a separate +unwind debug channel for unwinding on x86-64.
Constant spam from unwinding routines makes +seh logs hard to read, especially
for programs that throw a lot of exceptions as part of normal execution. Since
unwind information is rarely useful, don't display it unless specifically
requested.

Make +unwind the default channel in these files, though, since there are more
unwind messages than exception messages.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-19 12:30:48 +02:00
Alexandre Julliard 1ce08530c3 ntdll: Use the 32-bit RtlUserThreadStart as initial Eip in the 32-bit context.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-09 21:10:29 +02:00
Alexandre Julliard 37705d9ff6 ntdll: Don't restore %fs selector on nested signals.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-09 21:08:46 +02:00
Alexandre Julliard 216d241178 winebuild: Save/restore the %fs register in the syscall dispatcher on Linux.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-06 15:50:26 +02:00
Alexandre Julliard c42384b5a1 ntdll: Switch back to the pthread %fs register in signal handlers.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-06 15:50:26 +02:00
Alexandre Julliard a7b6b4f0d0 ntdll: Allocate a 32-bit %fs selector on Linux in Wow64 mode.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-06 15:50:25 +02:00
Alexandre Julliard cec3db10f4 ntdll: Store the pthread TEB value on thread init.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-06 12:31:53 +02:00
Alexandre Julliard 11d6c52f32 ntdll: Use the CPU area to get/set the Wow64 context on x86-64.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-01 12:46:00 +02:00
Alexandre Julliard 4acecd8619 ntdll: Initialize the Wow64 context on x86-64.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-01 12:46:00 +02:00
Alexandre Julliard 7404ef3ef5 ntdll: Don't rely on get_thread_context() updating the context flags.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-29 15:25:42 +02:00
Alexandre Julliard 8ac411ed6d server: Support both native and wow64 register contexts.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-27 11:42:32 +02:00
Alexandre Julliard fed7e7a78b ntdll: Simulate a syscall return when starting a thread.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-21 18:35:20 +02:00
Alexandre Julliard db26df5934 ntdll: Go through the syscall return path for syscall faults.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-21 18:35:20 +02:00
Alexandre Julliard c0012ecdd7 ntdll: Ignore faults caused by alignment check on x86-64.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-18 16:48:48 +02:00
Alexandre Julliard 0702d6b886 ntdll: Don't allow single-stepping through syscalls.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51273
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-16 15:05:24 +02:00
Alexandre Julliard a5cec4f5fb ntdll: Always use the TEB that was passed to signal_start_thread().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-14 18:32:24 +02:00
Alexandre Julliard 9a430dc6db ntdll: Also pass the TEB to signal_exit_thread().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-14 18:32:24 +02:00
Alexandre Julliard 2849ca9db4 ntdll: Move the XSTATE definitions to the platform-specific files.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-14 18:32:24 +02:00
Alexandre Julliard bcc587887a ntdll: Don't update cached registers if NtGetContextThread() fails.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-14 18:32:24 +02:00
Alexandre Julliard fa5759b9ef ntdll: Simplify the platform-specific dispatcher interface.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-11 18:45:44 +02:00
Alexandre Julliard 25b093f384 ntdll: Switch to the kernel stack for syscalls on x86-64.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-11 18:45:44 +02:00
Alexandre Julliard 1bd4473484 ntdll: Create a thread to run the ctrl-C routine instead of raising an exception.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-09 23:38:43 +02:00
Alexandre Julliard 32f1bfd0f0 ntdll: Only restore the modified parts of the syscall frame on x86-64.
Based on a patch by Jacek Caban.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-07 17:16:21 +02:00
Alexandre Julliard ba5d73d796 ntdll: Validate the extended context before modifying the other registers.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-07 13:31:19 +02:00
Alexandre Julliard e5982993ae ntdll: Get rid of signal_init_syscalls().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-02 20:16:07 +02:00