2 * loader.h: prototypes for linux-user guest binary loader
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
18 #ifndef LINUX_USER_LOADER_H
19 #define LINUX_USER_LOADER_H
22 * Read a good amount of data initially, to hopefully get all the
23 * program headers loaded.
25 #define BPRM_BUF_SIZE 1024
28 * This structure is used to hold the arguments that are
29 * used when loading binaries.
32 char buf[BPRM_BUF_SIZE] __attribute__((aligned));
39 char *filename; /* Name of binary */
40 int (*core_dump)(int, const CPUArchState *); /* coredump routine */
43 void do_init_thread(struct target_pt_regs *regs, struct image_info *infop);
44 abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp,
45 abi_ulong stringp, int push_ptr);
46 int loader_exec(int fdexec, const char *filename, char **argv, char **envp,
47 struct target_pt_regs *regs, struct image_info *infop,
48 struct linux_binprm *);
50 uint32_t get_elf_eflags(int fd);
51 int load_elf_binary(struct linux_binprm *bprm, struct image_info *info);
52 int load_flt_binary(struct linux_binprm *bprm, struct image_info *info);
54 abi_long memcpy_to_target(abi_ulong dest, const void *src,
57 extern unsigned long guest_stack_size;
59 #endif /* LINUX_USER_LOADER_H */