Commit Graph

220 Commits

Author SHA1 Message Date
Sebastian Lackner d2ec61105d ntdll: Do not cast unaligned pointer to M128A in set_context_reg.
GCC 7.x will assume 'val' is properly aligned when using a cast.

Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-06-05 19:48:44 +02:00
Andrew Wesie 9eecacbeb1 ntdll: Save rdi and rsi in raise_func_trampoline.
Signed-off-by: Andrew Wesie <awesie@gmail.com>
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-07 21:59:22 +01:00
Piotr Caban 67f2a1eaf9 ntdll: Don't incorrectly overwrite orig_context in call_stack_handlers.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-26 23:23:40 +09:00
Daniel Lehman 594ddb6140 ntdll: Set Rip in for longjmp in RtlRestoreContext.
Signed-off-by: Daniel Lehman <dlehman@esri.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-26 23:23:39 +09:00
Piotr Caban b4991f20cb ntdll: Remove no longer accessible TEB frames in RtlRestoreContext.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-23 14:17:31 +09:00
Piotr Caban 4af2012729 ntdll: Pass updated context inside dispatch.ContextRecord in call_stack_handlers.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-18 11:57:01 +09:00
Piotr Caban 10fa7c6e45 ntdll: Print fixme message in case of nested exception.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-18 11:56:45 +09:00
Piotr Caban b23de3cd4a ntdll: Add support for exceptions inside termination handlers in __C_specific_handler.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-18 11:56:29 +09:00
Piotr Caban 7c060d0061 ntdll: Call exception handler with correct context.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-18 11:56:16 +09:00
Piotr Caban abebb81412 ntdll: Add support for ExceptionCollidedUnwind return from exception handler.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-18 11:55:59 +09:00
Piotr Caban 66567dbdf1 ntdll: Add support for collided unwinds.
Based on work by Alexandre Julliard.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-18 11:55:16 +09:00
Daniel Lehman 0b6e5fae74 ntdll: Call __finally blocks in __C_specific_handler.
Signed-off-by: Daniel Lehman <dlehman@esri.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-10 22:22:07 +09:00
Piotr Caban 978ee87a25 ntdll: Fix KNONVOLATILE_CONTEXT_POINTERS parameter handling in RtlVirtualUnwind.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-08 18:41:30 +09:00
Ken Thomases 3d8efb2388 ntdll: For Mac 64-bit, poke NtCurrentTeb()->ThreadLocalStoragePointer to the corresponding offset from %gs.
64-bit Windows apps have hard-coded accesses to %gs:0x58 baked into them.  They
need to find the ThreadLocalStoragePointer there.

Technically, the gsbase register and the memory it points to belong to the
pthread implementation on macOS.  It's used for the pthread TLS implementation.
Slot 11 (offset 0x58) is currently used for the implementation of the ttyname()
system library function.  We do not anticipate that Wine or any of the system
libraries or frameworks it uses will call ttyname().  Furthermore, Apple has
made it so that future releases of macOS will no longer use that slot.  So, we
hijack it for our purposes.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-07-29 12:04:10 +09:00
Ken Thomases 7501942008 ntdll: For Mac 64-bit, poke the TEB address to %gs:0x30 and re-enable the inlining of NtCurrentTeb().
64-bit Windows apps have hard-coded accesses to %gs:0x30 baked into them.  They
need to find the TEB self pointer there.

Technically, the gsbase register and the memory it points to belong to the
pthread implementation on macOS.  It's used for the pthread TLS implementation.
However, study of the sources and experimentation reveal that TLS slot 6
(offset 0x30) is not currently used.  Furthermore, Apple has promised to not
use that slot in the future.  So, we hijack it for our purposes.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-07-28 21:38:01 +09:00
Piotr Caban 4c50ef6995 ntdll: Add RtlRestoreContext implementation.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-07-06 11:49:33 +09:00
Sebastian Lackner d25ae3ca25 ntdll: Handle stack guard pages on x86_64.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-04-15 17:56:59 +09:00
Sebastian Lackner d4ab672cf5 ntdll: Fix off-by-one errors in __wine_set_signal_handler.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-03-28 18:41:00 +09:00
Sebastian Lackner 123185c3a2 ntdll: Set correct number of arguments for breakpoint exceptions.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-02-19 11:20:12 +09:00
Sebastian Lackner d0cc0dd69f ntdll: Fix up instruction pointer in context for EXCEPTION_BREAKPOINT on x86_64.
Similar to eab168cf9e for x86.

Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-02-19 11:20:08 +09:00
Sebastian Lackner e1d68b2e16 ntdll: Implement handling of int $0x2d for x86_64.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-02-19 00:49:12 +09:00
Sebastian Lackner 897ac569c8 ntdll: Check ContextFlags before restoring registers on x86_64.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-01-06 15:50:30 +01:00
Sebastian Lackner cbb5705216 ntdll: Use wrapper function for consolidate callback on x86_64.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-10-21 19:19:08 +09:00
Francois Gouget 93a7845ae8 ntdll: Use #ifdef to check for potentially undefined macros. 2015-08-07 23:44:30 +09:00
Ken Thomases 82dd799d52 ntdll: Add partial support for version 3 of DWARF CIEs which are generated by Clang/LLVM. 2015-06-05 18:40:39 +09:00
Ken Thomases bbcfa6b4ee ntdll: Add support for using libunwind to unwind the stack for x86_64.
On OS X, Apple uses compact unwind info in preference to DWARF unwind info.
2015-06-05 15:08:02 +09:00
Sebastian Lackner 33c3990e4d ntdll: Fix various bugs RtlUnwindEx on x86_64. 2015-04-03 17:07:36 +09:00
Sebastian Lackner 6bec132c7a ntdll: Try to handle write-watches while we're on the signal stack. 2015-02-27 14:59:08 +09:00
Charles Davis 97bda9a05f ntdll: Support 64-bit Mac OS. 2015-02-06 22:35:17 +09:00
Alexandre Julliard d7f6f8ee6c ntdll: Define arch_prctl since it is missing on Android. 2014-07-24 20:44:50 +02:00
Alexandre Julliard 8d817997ce configure: Add a check for sys/ucontext.h and include it where appropriate. 2014-07-23 19:06:58 +02:00
Sebastian Lackner dd0e9fe91e ntdll/tests: Fix exception test failures on x86_64. 2014-06-11 19:15:01 +02:00
Akihiro Sagawa e67f84122d ntdll: Add %gs support for NetBSD. 2014-04-14 20:19:01 +02:00
Sebastian Lackner 4d8edf7612 ntdll: Implement RtlInstallFunctionTableCallback on x86_64. 2014-04-08 19:23:14 +02:00
Sebastian Lackner 98307b22fb ntdll: Implement RtlAddFunctionTable / RtlDeleteFunctionTable for x86_64. 2014-04-08 18:28:31 +02:00
Sebastian Lackner a71d1e389f ntdll: Unify exception function lookup on x86_64. 2014-04-08 18:28:30 +02:00
Frédéric Delanoy 416930d498 ntdll: Use BOOL type where appropriate. 2013-11-04 11:03:43 +01:00
Alexandre Julliard c2d7347e2a ntdll: Silence some printf format warnings. 2013-08-20 20:52:17 +02:00
Dmitry Timoshkov 10476af626 include: Make KNONVOLATILE_CONTEXT_POINTERS match PSDK definition. 2013-04-30 11:47:05 +02:00
Alexandre Julliard bb23d63663 ntdll: Export _local_unwind. 2012-05-29 21:33:45 +02:00
Alexandre Julliard 3d4a73e601 ntdll: Add a __chkstk entry point for x86_64. 2012-04-02 12:46:40 +02:00
Alexandre Julliard a777676bc4 ntdll: Also call the unwind handler for the target frame. 2012-03-30 14:42:55 +02:00
Alexandre Julliard c0610daf77 ntdll: Properly follow jumps when checking a function epilog. 2012-03-15 20:29:23 +01:00
Alexandre Julliard b663a6dea4 ntdll: Add support for jump instructions in function epilogs. 2012-03-12 19:18:37 +01:00
Alexandre Julliard 34c875bf8b ntdll: Add support for rep;ret instruction in function epilogs. 2012-03-12 18:59:51 +01:00
Alexandre Julliard e562623a15 ntdll: Add support for the special STATUS_UNWIND_CONSOLIDATE exception code. 2012-03-12 16:04:49 +01:00
Alexandre Julliard f996c89274 ntdll: Trace the exception extra information also in RtlUnwindEx. 2012-03-12 16:04:44 +01:00
Alexandre Julliard 2bce0c698e ntdll: Set the TARGET_UNWIND flag when calling the unwind handler for the target frame. 2012-03-12 13:04:37 +01:00
Alexandre Julliard 7c36b51aaf ntdll: Restore the original context for the last frame instead of the result of the unwind handler. 2012-03-12 13:04:36 +01:00
Alexandre Julliard de9330cbcb ntdll: Use the context argument as working variable instead of making a copy in RtlUnwindEx. 2012-03-12 13:04:35 +01:00
William Panlener f6dae487aa ntdll: Use success return values for stubs. 2012-02-16 11:57:12 +01:00
Alexandre Julliard 10dcc85de0 ntdll: Add support for longjmp in RtlUnwindEx. 2011-02-01 18:14:09 +01:00
Alexandre Julliard 672a084584 ntdll: Implement RtlRaiseException for x86_64 directly instead of using the winebuild-generated code. 2011-01-27 14:12:41 +01:00
Alexandre Julliard 1e6ff42d03 ntdll: Implement set_cpu_context for x86_64 directly instead of using the winebuild-generated code. 2011-01-27 14:12:41 +01:00
Alexandre Julliard 33e6238f04 ntdll: Avoid copying and restoring the context in RtlCaptureContext for x86_64. 2011-01-27 14:12:23 +01:00
Alexandre Julliard aa4ad6d766 ntdll: Capture the context inside RtlUnwindEx instead of assuming it's already initialized. 2011-01-27 14:10:34 +01:00
Alexandre Julliard 2e81ba5f4f include: Add a prototype for RtlUnwindEx on x86_64. 2011-01-27 14:10:31 +01:00
Austin English 9832bd6c54 ntdll: Add missing checks for FreeBSD_kernel. 2011-01-17 14:27:38 +01:00
Alexandre Julliard 8b54390686 ntdll: Fix the initial FPU control word on 64-bit. 2010-06-21 11:49:25 +02:00
Henri Verbeet 772a5c7c09 ntdll: The FPU control word for newly created threads is 0x27f.
This fixes a regression introduced by
e6611e22fb.
2010-06-17 11:50:23 +02:00
Austin English da77e7456b ntdll: Add signal context function definitions for FreeBSD. 2010-06-01 11:04:01 +02:00
Austin English 40b3d2ed13 ntdll: Add %gs support for FreeBSD. 2010-05-24 11:32:40 +02:00
Alexandre Julliard 39d54523a3 ntdll: Preserve registers in call_thread_entry_point on x86_64. 2010-05-16 12:34:07 +02:00
Alexandre Julliard bc3ae58f1d ntdll: Add support for saving/restoring CFA frame state. 2010-05-04 13:14:43 +02:00
Alexandre Julliard 281f701880 ntdll: Make cfi annotations optional for x86_64. 2010-04-12 12:38:27 +02:00
Alexandre Julliard 9e6903c4b3 ntdll: Restructure x86_64 exception processing to treat all functions with missing exception data as leaf functions. 2010-04-09 13:15:41 +02:00
Eric Pouech 2bebb68a0b ntdll: On x86_64 systems (as on i386 ones), hw breakpoints must generate a EXCEPTION_SINGLE_STEP exception. 2010-04-07 13:50:39 +02:00
Eric Pouech 27fb22637a ntdll: Notify valgrind for stack management while in exception. 2010-02-23 12:06:47 +01:00
Alexandre Julliard 866db819b8 ntdll: Add stubs for RtlAddFunctionTable and RtlDeleteFunctionTable. 2009-12-04 14:34:45 +01:00
Alexandre Julliard d4f1fffacc ntdll: Moved the TEB allocation routines to the platform-specific files. 2009-11-19 12:25:52 +01:00
Alexandre Julliard d45fca8f7c ntdll: Moved RtlCaptureStackBackTrace stub to the cpu-specific files. 2009-11-11 17:19:23 +01:00
Alexandre Julliard 905609b73b ntdll: Assume leaf function when we can't find exception information for an ELF module. 2009-10-16 13:39:15 +02:00
Alexandre Julliard 690cf4a6c8 ntdll: Use a more drastic (and simpler) method for unwinding the stack on thread exit. 2009-08-29 16:48:30 +02:00
Alexandre Julliard 8824deb6c6 ntdll: Add support for Dwarf expressions in call frame information. 2009-08-28 18:25:20 +02:00
Alexandre Julliard af22daf72b ntdll: Add support for unwinding the signal stack on x86_64. 2009-08-28 18:24:06 +02:00
Alexandre Julliard ecdcf060a5 ntdll: Unwind the stack before calling exit/abort_thread.
This prevents pthread_exit() from trying to do it and failing.
2009-08-28 12:15:07 +02:00
Alexandre Julliard 8101a2fa1e ntdll: Move the abort_thread() function to the CPU-specific files to allow redefining it. 2009-08-28 11:54:50 +02:00
Alexandre Julliard b8ae3f073b ntdll: Fix handling of the duplicate MxCsr entry in the x86_64 context. 2009-08-27 16:49:53 +02:00
Alexandre Julliard 70c39c4456 ntdll: Correctly jump to the modified context after an exception on x86_64. 2009-08-26 21:24:17 +02:00
Alexandre Julliard 0610549529 ntdll: Move all thread exit processing to exit_thread(), and make RtlExitUserThread() CPU-specific. 2009-06-18 17:06:21 +02:00
Alexandre Julliard f124c7cc38 ntdll: Simplify the thread startup routine and make it CPU-specific. 2009-06-18 17:01:44 +02:00
Alexandre Julliard 98b8160b73 ntdll: Add support for calling the TEB exception chain handlers on x86_64. 2009-06-18 15:17:26 +02:00
Alexandre Julliard c9deac1126 ntdll: Implement stack unwinding for x86_64 builtin modules based on the Dwarf data. 2009-06-18 15:17:12 +02:00
Alexandre Julliard a19db6dc11 ntdll: Handle x86_64 signals on a separate signal stack. 2009-06-16 15:27:48 +02:00
Alexandre Julliard e65ebee63f ntdll: Add appropriate stdcall decorations to assembly functions. 2009-06-15 13:42:26 +02:00
Alexandre Julliard 3aa266f8f3 ntdll: Implement RtlUnwindEx for x86_64. 2009-05-22 15:16:29 +02:00
Alexandre Julliard 2c63d1d7dd ntdll: Implement __C_specific_handler for x86_64. 2009-05-22 15:16:16 +02:00
Alexandre Julliard ad7b282439 ntdll: Initial support for dispatching exceptions to stack handlers on x86_64. 2009-05-22 12:48:05 +02:00
Alexandre Julliard 7634ce154a ntdll: Implemented RtlLookupFunctionEntry for x86_64. 2009-05-22 11:48:30 +02:00
Alexandre Julliard 6c35e3f47c ntdll: Add test cases for the returned frame value in RtlVirtualUnwind. 2009-05-20 13:33:32 +02:00
Alexandre Julliard 1d4747c35f ntdll: Add support for some function epilogs in RtlVirtualUnwind. 2009-05-20 13:32:47 +02:00
Alexandre Julliard f7b1e94f98 ntdll: Initial implementation of RtlVirtualUnwind on x86_64. 2009-05-15 20:19:28 +02:00
Alexandre Julliard 47d7702522 ntdll: Added a stub for RtlUnwindEx on x86_64. 2009-05-15 20:18:33 +02:00
Alexandre Julliard a950910eec ntdll: Save all segment registers on x86_64. Implement set_cpu_context. 2009-05-01 18:02:40 +02:00
Alexandre Julliard 9968d84973 ntdll: Use standard siginfo signal handlers on all platforms. 2009-05-01 17:57:29 +02:00
Alexandre Julliard c5a57e7d13 ntdll: Move NtRaiseException and RtlUnwind implementations to the CPU-specific files. 2009-04-30 13:23:15 +02:00
Alexandre Julliard 7f9750550a ntdll: Set the exception address to the program counter in RtlRaiseException. 2009-04-10 13:17:12 +02:00
Alexandre Julliard f4eee1c731 ntdll: Move the RtlRaiseException implementation into the respective platform-specific files. 2009-04-10 13:14:05 +02:00
Alexandre Julliard 48199d7074 ntdll: Add a raise_status function and avoid exporting __regs_RtlRaiseException. 2009-04-10 13:09:06 +02:00
Alexandre Julliard 0865c278f2 ntdll: Set the proper context flags in the signal handlers for x86_64. 2009-04-08 20:40:29 +02:00
Alexandre Julliard 5316dd011f server: Define a generic context structure instead of using the platform-specific version. 2009-04-08 19:59:23 +02:00
Alexandre Julliard 75be87dd75 ntdll: Move the copy_context function into the respective CPU-specific files. 2009-03-13 11:31:25 +01:00
Alexandre Julliard cc933f586a ntdll: Moved exit_thread and abort_thread functions to thread.c. 2009-02-20 18:07:41 +01:00
Alexandre Julliard 66255772fc ntdll: Move the CPU-specific handling of current TEB to the respective signal files. 2009-02-18 13:04:50 +01:00
Austin English 633e069c67 ntdll: Add support for NetBSD (64-bit). 2009-01-20 12:23:32 +01:00
Alexandre Julliard 14c452fe78 ntdll: Replaced get_cpu_context by RtlCaptureContext. Implemented it for x86_64. 2009-01-06 17:50:34 +01:00
Maarten Lankhorst 768160e944 ntdll: Make all exported wine functions CDECL. 2008-12-17 15:02:25 +01:00
Alexandre Julliard 50d6b7fb54 ntdll: Added stubs for RtlLookupFunctionEntry and RtlVirtualUnwind. 2008-12-08 19:29:06 +01:00
Alexandre Julliard 81b9ca5dbd ntdll: Pass the error code to VIRTUAL_HandleFault, and allow it to ignore the exception.
Also rename it to virtual_handle_fault for consistency.
2008-11-25 12:02:16 +01:00
Alexandre Julliard 531ff0be26 ntdll: Split the signal setup into process-wide and thread-specific routines. 2008-07-03 20:18:23 +02:00
Alexandre Julliard 3b244b95b2 server: Use SIGQUIT instead of SIGTERM to terminate a thread.
This allows keeping the default SIGTERM behavior of killing the whole
process.
2007-12-20 12:19:35 +01:00
Andrew Talbot 0108667754 ntdll: Replace inline static with static inline. 2007-03-17 20:03:57 +01:00
Alexandre Julliard c388c58b9f ntdll: Make the server signal mask global. 2007-01-18 12:20:56 +01:00
Joel Parker 2319999a05 Remove redundant semicolons for ANSI compatibility. 2007-01-17 11:58:15 +01:00
Jonathan Ernst 360a3f9142 Update the address of the Free Software Foundation. 2006-05-23 14:11:13 +02:00
Alexandre Julliard d2ad6f8355 ntdll: Get registers on the client side for NtGetContextThread on the current thread. 2006-04-20 15:40:28 +02:00
Robert Millan 62af0706ff ntdll: Rename i386 CPU trap codes to avoid collision with system headers. 2006-02-03 12:30:55 +01:00
Alexandre Julliard 2654be08d5 ntdll: Handle NtSetContextThread on the client side (as far as
possible) when setting the context of the current thread.
2006-01-11 20:20:32 +01:00
Alexandre Julliard 73c72390f8 Fixed Get/SetThreadContext to work properly on suspended threads.
Added a test case.
2005-11-02 20:54:12 +00:00
Alexandre Julliard ebf7a5d408 Preliminary implementation of signal handling for x86-64. 2005-09-16 19:40:52 +00:00