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.
7 #include "native_client/src/trusted/service_runtime/arch/mips/sel_ldr_mips.h"
8 #include "native_client/src/trusted/service_runtime/nacl_config.h"
13 * Assembly code template.
14 * This is linked into the service runtime but is unused as code -- it is used
15 * as data to be patched into a NaCl app's address space.
17 * Trampoline to transfer control from native client module to
18 * sel_ldr's NaClSyscallSeg residing in the service runtime portion of address
19 * space. Trampolines are patched into nacl module's address space in the
20 * trampoline region. They are patched by NaClLoadTrampoline() code (sel_ldr.c).
21 * Each trampoline code segment corresponds to a system call, so the trampoline
22 * region is full of identical trampoline code segments. Service runtime
23 * distinguish which system call is requested using the address of an executed
24 * trampoline (it is saved on stack in NaClSyscallSeg()).
26 * The trampoline code should push first 4 parameters of the system call to
27 * the stack, and on top of that it should push the return address. On Mips the
28 * trampoline is too small for all this, so the only thing that trampoline does
29 * is call the function NaClSyscallSeg where the push is actually done.
32 DEFINE_GLOBAL_HIDDEN_LOCATION(NaCl_trampoline_seg_code):
37 * We don't actually load $t9 with zero, but we patch it with real address
38 * of NaClSyscallSeg during placement of trampoline code.
49 DEFINE_GLOBAL_HIDDEN_LOCATION(NaCl_trampoline_seg_end):