| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /* | 7 /* |
| 8 * The MacOS assembler has a macro facility that is pretty close | 8 * The MacOS assembler has a macro facility that is pretty close |
| 9 * to GNU as macros, but not quite the same. | 9 * to GNU as macros, but not quite the same. |
| 10 */ | 10 */ |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 * 0x08 -0x10 rdx | 207 * 0x08 -0x10 rdx |
| 208 * 0x04 -0x14 rsi | 208 * 0x04 -0x14 rsi |
| 209 * 0x00 -0x18 rdi | 209 * 0x00 -0x18 rdi |
| 210 */ | 210 */ |
| 211 | 211 |
| 212 DEFINE_GLOBAL_HIDDEN_IDENTIFIER(NaClGetTlsFastPath): | 212 DEFINE_GLOBAL_HIDDEN_IDENTIFIER(NaClGetTlsFastPath): |
| 213 get_tls | 213 get_tls |
| 214 leaq IDENTIFIER(nacl_tls)(%rip), %rdx | 214 leaq IDENTIFIER(nacl_tls)(%rip), %rdx |
| 215 leaq (%rdx,%rax,4), %rdx | 215 leaq (%rdx,%rax,4), %rdx |
| 216 movl 0x0(%rdx), %eax | 216 movl 0x0(%rdx), %eax |
| 217 xorl %edx, %edx /* do not leak nacl_tls[thread_id] address */ | |
| 218 /* sandbox the return, straight off the untrusted stack */ | 217 /* sandbox the return, straight off the untrusted stack */ |
| 219 movq 0x8(%rsp), %rcx | 218 movq 0x8(%rsp), %rcx |
| 220 addq $0x10, %rsp | 219 addq $0x10, %rsp |
| 221 addl $31, %ecx | 220 addl $31, %ecx |
| 222 andl $0xffffffe0, %ecx | 221 andl $0xffffffe0, %ecx |
| 223 addq %r15, %rcx | 222 addq %r15, %rcx |
| 223 /* |
| 224 * Set %rdx to zero so that we do not leak nacl_tls[thread_id] |
| 225 * address. This also resets flags. Resetting flags to fixed |
| 226 * values by doing this last simplifies testing that we do not |
| 227 * leak any information via flags. |
| 228 */ |
| 229 xorl %edx, %edx |
| 224 jmp *%rcx | 230 jmp *%rcx |
| OLD | NEW |