Commit Graph

107 Commits

Author SHA1 Message Date
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