Commit Graph

139 Commits

Author SHA1 Message Date
Alexandre Julliard b526a48a24 ntdll: Pass the stack pointer to virtual_clear_thread_stack().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-12-04 15:03:55 +01:00
Alexandre Julliard 23ec3ce2a3 ntdll: Start process execution directly at the kernel32 process entry point.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-12-04 15:03:55 +01:00
Alexandre Julliard f64d2688d2 ntdll: Move suspending a thread on startup into attach_dlls().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-12-01 20:32:12 +01:00
Alexandre Julliard 32c2cfb861 ntdll: Run the entire thread initialization code on the thread stack on x86-64.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-12-01 19:20:22 +01:00
Alexandre Julliard 70b69f3e5f ntdll: Don't return from attach_dlls on failure.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-30 19:06:44 +01:00
Alexandre Julliard 6c61ea6a13 ntdll: Suspend a thread with its start context explicitly before attaching dlls.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-30 12:15:51 +01:00
Alexandre Julliard 53e4c36ef8 ntdll: Add a platform-specific helper for starting a thread.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-29 20:15:30 +01:00
Alexandre Julliard afb16abc0f ntdll: Add a platform-specific helper for starting a process.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-29 17:18:23 +01:00
Alexandre Julliard 93eceba03e ntdll: Move freeing the thread stack to a common helper.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-29 10:43:39 +01:00
Alexandre Julliard e6f68708c5 ntdll: Set the initial process context on x86_64.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-09-19 12:24:31 +02:00
Alexandre Julliard 8c103f298b ntdll: Add support for setting a platform-specific initial context.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-09-19 12:10:14 +02:00
Alexandre Julliard 38d45cbcc8 ntdll: Mark function that are only called from assembly as hidden.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-07-25 11:48:24 +02:00
Alexandre Julliard 1522280e68 ntdll: Remove the raise_exception helper function on x86-64.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-07-20 13:30:58 +02:00
Alexandre Julliard ac6244b55a ntdll: Call NtRaiseException directly from RtlRaiseException on x86-64.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-07-20 13:00:10 +02:00
Alexandre Julliard a1b563f41c ntdll: Add support for debug registers in exceptions on x86-64.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-07-19 19:13:30 +02:00
Alexandre Julliard 9e59362ae3 ntdll: Move the plaform-specific thread data to the SystemReserved2 TEB field.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-07-19 19:13:30 +02:00
Alexandre Julliard f1ef8a4d9d ntdll: Add platform-specific versions of the thread data structure.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-07-19 19:13:29 +02:00
Alexandre Julliard ce46de5a94 ntdll: Move NtGetContextThread implementation to the platform-specific files.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-07-18 20:43:32 +02:00
Alexandre Julliard 675e8218f0 ntdll: Move NtSetContextThread implementation to the platform-specific files.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-07-18 20:43:32 +02:00
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