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
4 * found in the LICENSE file.
8 * NaCl Simple/secure ELF loader (NaCl SEL).
12 * Trampoline to transfer control from native client module to
13 * sel_ldr's NaClSyscallSeg residing in the same address space
16 #include "native_client/src/trusted/service_runtime/nacl_config.h"
19 * This is code, but it is not code that is actually part of the
20 * program/library being linked. Marking it as read-only data
21 * instead ensures that nothing like linker code-rewriting will
22 * be applied to this code.
26 DEFINE_GLOBAL_HIDDEN_IDENTIFIER(NaCl_trampoline_seg_code):
27 lcall $0xcafe, $0xdeadbeef /* orig-cs, thunk */
28 DEFINE_GLOBAL_HIDDEN_IDENTIFIER(NaCl_tramp_cseg_patch):
30 DEFINE_GLOBAL_HIDDEN_IDENTIFIER(NaCl_trampoline_seg_end):
33 DEFINE_GLOBAL_HIDDEN_IDENTIFIER(NaClPcrelThunk):
34 movl $0xdeadbeef, %eax /* known okay ds */
35 DEFINE_GLOBAL_HIDDEN_IDENTIFIER(NaClPcrelThunk_dseg_patch):
36 mov %ax, %ds /* disable data sandbox for this thread */
37 movl $0xdeadbeef, %ecx /* nacl_user */
38 DEFINE_GLOBAL_HIDDEN_IDENTIFIER(NaClPcrelThunk_globals_patch):
40 * This is a regular PC-relative jump. The displacement will be
41 * patched in. Using an explicit opcode with the largest possible
42 * displacement here rather than "jmp" ensures that no too-clever
43 * assembler or linker could ever produce a different opcode with a
44 * smaller displacement.
46 .byte 0xe9, 0xff, 0xff, 0xff, 0x7f
47 DEFINE_GLOBAL_HIDDEN_IDENTIFIER(NaClPcrelThunk_end):