1// Copyright 2016 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#pragma once
6
7#pragma GCC visibility push(hidden)
8
9#include <zircon/types.h>
10#include <stddef.h>
11
12struct bootfs;
13
14// Returns the base address (p_vaddr bias).
15zx_vaddr_t elf_load_vmo(zx_handle_t log, zx_handle_t vmar, zx_handle_t vmo);
16
17// Returns the entry point address in the child, either to the named
18// executable or to the PT_INTERP file loaded instead.  If the main
19// file has a PT_INTERP, that name (with a fixed prefix applied) is
20// also found in the bootfs and loaded instead of the main
21// executable.  In that case, an extra zx_proc_args_t message is
22// sent down the to_child pipe to prime the interpreter (presumably
23// the dynamic linker) with the given log handle and a VMO for the
24// main executable and a loader-service channel, the other end of
25// which is returned here.
26zx_vaddr_t elf_load_bootfs(zx_handle_t log, struct bootfs *fs,
27                           zx_handle_t proc, zx_handle_t vmar,
28                           zx_handle_t thread,
29                           const char* filename, zx_handle_t to_child,
30                           size_t* stack_size, zx_handle_t* loader_svc);
31
32#pragma GCC visibility pop
33