loader.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * loader.h: prototypes for linux-user guest binary loader
  3. *
  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.
  8. *
  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.
  13. *
  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/>.
  16. */
  17. #ifndef LINUX_USER_LOADER_H
  18. #define LINUX_USER_LOADER_H
  19. /*
  20. * Read a good amount of data initially, to hopefully get all the
  21. * program headers loaded.
  22. */
  23. #define BPRM_BUF_SIZE 1024
  24. /*
  25. * This structure is used to hold the arguments that are
  26. * used when loading binaries.
  27. */
  28. struct linux_binprm {
  29. char buf[BPRM_BUF_SIZE] __attribute__((aligned));
  30. abi_ulong p;
  31. int fd;
  32. int e_uid, e_gid;
  33. int argc, envc;
  34. char **argv;
  35. char **envp;
  36. char *filename; /* Name of binary */
  37. int (*core_dump)(int, const CPUArchState *); /* coredump routine */
  38. };
  39. void do_init_thread(struct target_pt_regs *regs, struct image_info *infop);
  40. abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp,
  41. abi_ulong stringp, int push_ptr);
  42. int loader_exec(int fdexec, const char *filename, char **argv, char **envp,
  43. struct target_pt_regs *regs, struct image_info *infop,
  44. struct linux_binprm *);
  45. uint32_t get_elf_eflags(int fd);
  46. int load_elf_binary(struct linux_binprm *bprm, struct image_info *info);
  47. int load_flt_binary(struct linux_binprm *bprm, struct image_info *info);
  48. abi_long memcpy_to_target(abi_ulong dest, const void *src,
  49. unsigned long len);
  50. extern unsigned long guest_stack_size;
  51. #endif /* LINUX_USER_LOADER_H */