| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
| 3 * All rights reserved. | 3 * All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 * This code gets executed when switching from a 32-bit nacl module to | 33 * This code gets executed when switching from a 32-bit nacl module to |
| 34 * the 64-bit service. NaClSyscallSeg is the lcall target from the | 34 * the 64-bit service. NaClSyscallSeg is the lcall target from the |
| 35 * syscall trampoline code, and this code is responsible for figuring | 35 * syscall trampoline code, and this code is responsible for figuring |
| 36 * out the identity of the thread, saving the user registers, finish | 36 * out the identity of the thread, saving the user registers, finish |
| 37 * restoring the segment registers (and getting out of the sandbox), | 37 * restoring the segment registers (and getting out of the sandbox), |
| 38 * and actually invoking the C system call handler code. | 38 * and actually invoking the C system call handler code. |
| 39 */ | 39 */ |
| 40 | 40 |
| 41 #include "native_client/src/trusted/service_runtime/nacl_config.h" | 41 #include "native_client/src/trusted/service_runtime/nacl_config.h" |
| 42 | 42 |
| 43 .globl IDENTIFIER(nacl_user) | 43 .globl IDENTIFIER(NaClSyscallSeg) |
| 44 .globl IDENTIFIER(nacl_sys) | 44 HIDDEN(NaClSyscallSeg) |
| 45 | |
| 46 .globl IDENTIFIER(NaClSyscallCSegHook) | |
| 47 .globl IDENTIFIER(NaClSyscallSeg) | |
| 48 IDENTIFIER(NaClSyscallSeg): | 45 IDENTIFIER(NaClSyscallSeg): |
| 49 /* | 46 /* |
| 50 * As far as we know, glibc-derived code always explicitly clears | 47 * As far as we know, glibc-derived code always explicitly clears |
| 51 * (or sets) the direction flag, so this is an issue only for Windows. | 48 * (or sets) the direction flag, so this is an issue only for Windows. |
| 52 */ | 49 */ |
| 53 | 50 |
| 54 cld | 51 cld |
| 55 xor %eax, %eax | 52 xor %eax, %eax |
| 56 mov %gs, %ax | 53 mov %gs, %ax |
| 57 shr $3, %eax | 54 shr $3, %eax |
| (...skipping 27 matching lines...) Expand all Loading... |
| 85 mov %ecx, %ss /* disable intr */ | 82 mov %ecx, %ss /* disable intr */ |
| 86 mov %rdx, %rsp | 83 mov %rdx, %rsp |
| 87 push %rax | 84 push %rax |
| 88 call IDENTIFIER(NaClSyscallCSegHook) | 85 call IDENTIFIER(NaClSyscallCSegHook) |
| 89 /* | 86 /* |
| 90 * If stack usage in the above code changes, modify initial %esp | 87 * If stack usage in the above code changes, modify initial %esp |
| 91 * computation -- see nacl_switch_to_app.c:NaClStartThreadInApp. | 88 * computation -- see nacl_switch_to_app.c:NaClStartThreadInApp. |
| 92 */ | 89 */ |
| 93 hlt | 90 hlt |
| 94 /* noret */ | 91 /* noret */ |
| OLD | NEW |