Alexandre Julliard : loader: Setup the TLS register on x86-64 for stack protector checks.
Alexandre Julliard
julliard at winehq.org
Tue Dec 21 14:32:21 CST 2010
Module: wine
Branch: master
Commit: 7e112c29173c5b8766542fcfec46e43e99e0c4fe
URL: http://source.winehq.org/git/wine.git/?a=commit;h=7e112c29173c5b8766542fcfec46e43e99e0c4fe
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Dec 21 19:38:27 2010 +0100
loader: Setup the TLS register on x86-64 for stack protector checks.
---
loader/preloader.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/loader/preloader.c b/loader/preloader.c
index 4344a16..e1c2276 100644
--- a/loader/preloader.c
+++ b/loader/preloader.c
@@ -344,6 +344,8 @@ static inline int wld_prctl( int code, long arg )
#elif defined(__x86_64__)
+void *thread_data[256];
+
/*
* The _start function is the entry and exit point of this program
*
@@ -355,8 +357,12 @@ extern char _end[];
__ASM_GLOBAL_FUNC(_start,
"movq %rsp,%rax\n\t"
"leaq -144(%rsp),%rsp\n\t" /* allocate some space for extra aux values */
+ "movq %rax,(%rsp)\n\t" /* orig stack pointer */
+ "movq $thread_data,%rsi\n\t"
+ "movq $0x1002,%rdi\n\t" /* ARCH_SET_FS */
+ "movq $158,%rax\n\t" /* SYS_arch_prctl */
+ "syscall\n\t"
"movq %rsp,%rdi\n\t" /* ptr to orig stack pointer */
- "movq %rax,(%rdi)\n\t" /* orig stack pointer */
"call wld_start\n\t"
"movq (%rsp),%rsp\n\t" /* new stack pointer */
"pushq %rax\n\t" /* ELF interpreter entry point */
More information about the wine-cvs
mailing list