mirror of https://github.com/xemu-project/xemu.git
linux-user: Split loader-related prototypes into loader.h
Split guest-binary loader prototypes out into a new header loader.h which we include only where required. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20210908154405.15417-5-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
parent
2113aed687
commit
3ad0a76928
|
@ -6,6 +6,7 @@
|
||||||
#include <sys/shm.h>
|
#include <sys/shm.h>
|
||||||
|
|
||||||
#include "qemu.h"
|
#include "qemu.h"
|
||||||
|
#include "loader.h"
|
||||||
#include "disas/disas.h"
|
#include "disas/disas.h"
|
||||||
#include "qemu/bitops.h"
|
#include "qemu/bitops.h"
|
||||||
#include "qemu/path.h"
|
#include "qemu/path.h"
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
|
|
||||||
#include "qemu.h"
|
#include "qemu.h"
|
||||||
|
#include "loader.h"
|
||||||
#include "flat.h"
|
#include "flat.h"
|
||||||
#include "target_flat.h"
|
#include "target_flat.h"
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu.h"
|
#include "qemu.h"
|
||||||
|
#include "loader.h"
|
||||||
|
|
||||||
#define NGROUPS 32
|
#define NGROUPS 32
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* loader.h: prototypes for linux-user guest binary loader
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LINUX_USER_LOADER_H
|
||||||
|
#define LINUX_USER_LOADER_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read a good amount of data initially, to hopefully get all the
|
||||||
|
* program headers loaded.
|
||||||
|
*/
|
||||||
|
#define BPRM_BUF_SIZE 1024
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This structure is used to hold the arguments that are
|
||||||
|
* used when loading binaries.
|
||||||
|
*/
|
||||||
|
struct linux_binprm {
|
||||||
|
char buf[BPRM_BUF_SIZE] __attribute__((aligned));
|
||||||
|
abi_ulong p;
|
||||||
|
int fd;
|
||||||
|
int e_uid, e_gid;
|
||||||
|
int argc, envc;
|
||||||
|
char **argv;
|
||||||
|
char **envp;
|
||||||
|
char *filename; /* Name of binary */
|
||||||
|
int (*core_dump)(int, const CPUArchState *); /* coredump routine */
|
||||||
|
};
|
||||||
|
|
||||||
|
void do_init_thread(struct target_pt_regs *regs, struct image_info *infop);
|
||||||
|
abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp,
|
||||||
|
abi_ulong stringp, int push_ptr);
|
||||||
|
int loader_exec(int fdexec, const char *filename, char **argv, char **envp,
|
||||||
|
struct target_pt_regs *regs, struct image_info *infop,
|
||||||
|
struct linux_binprm *);
|
||||||
|
|
||||||
|
uint32_t get_elf_eflags(int fd);
|
||||||
|
int load_elf_binary(struct linux_binprm *bprm, struct image_info *info);
|
||||||
|
int load_flt_binary(struct linux_binprm *bprm, struct image_info *info);
|
||||||
|
|
||||||
|
abi_long memcpy_to_target(abi_ulong dest, const void *src,
|
||||||
|
unsigned long len);
|
||||||
|
|
||||||
|
extern unsigned long guest_stack_size;
|
||||||
|
|
||||||
|
#endif /* LINUX_USER_LOADER_H */
|
|
@ -50,6 +50,7 @@
|
||||||
#include "crypto/init.h"
|
#include "crypto/init.h"
|
||||||
#include "fd-trans.h"
|
#include "fd-trans.h"
|
||||||
#include "signal-common.h"
|
#include "signal-common.h"
|
||||||
|
#include "loader.h"
|
||||||
|
|
||||||
#ifndef AT_FLAGS_PRESERVE_ARGV0
|
#ifndef AT_FLAGS_PRESERVE_ARGV0
|
||||||
#define AT_FLAGS_PRESERVE_ARGV0_BIT 0
|
#define AT_FLAGS_PRESERVE_ARGV0_BIT 0
|
||||||
|
|
|
@ -173,30 +173,6 @@ void stop_all_tasks(void);
|
||||||
extern const char *qemu_uname_release;
|
extern const char *qemu_uname_release;
|
||||||
extern unsigned long mmap_min_addr;
|
extern unsigned long mmap_min_addr;
|
||||||
|
|
||||||
/* ??? See if we can avoid exposing so much of the loader internals. */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Read a good amount of data initially, to hopefully get all the
|
|
||||||
* program headers loaded.
|
|
||||||
*/
|
|
||||||
#define BPRM_BUF_SIZE 1024
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This structure is used to hold the arguments that are
|
|
||||||
* used when loading binaries.
|
|
||||||
*/
|
|
||||||
struct linux_binprm {
|
|
||||||
char buf[BPRM_BUF_SIZE] __attribute__((aligned));
|
|
||||||
abi_ulong p;
|
|
||||||
int fd;
|
|
||||||
int e_uid, e_gid;
|
|
||||||
int argc, envc;
|
|
||||||
char **argv;
|
|
||||||
char **envp;
|
|
||||||
char *filename; /* Name of binary */
|
|
||||||
int (*core_dump)(int, const CPUArchState *); /* coredump routine */
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct IOCTLEntry IOCTLEntry;
|
typedef struct IOCTLEntry IOCTLEntry;
|
||||||
|
|
||||||
typedef abi_long do_ioctl_fn(const IOCTLEntry *ie, uint8_t *buf_temp,
|
typedef abi_long do_ioctl_fn(const IOCTLEntry *ie, uint8_t *buf_temp,
|
||||||
|
@ -217,13 +193,6 @@ extern IOCTLEntry ioctl_entries[];
|
||||||
#define IOC_W 0x0002
|
#define IOC_W 0x0002
|
||||||
#define IOC_RW (IOC_R | IOC_W)
|
#define IOC_RW (IOC_R | IOC_W)
|
||||||
|
|
||||||
void do_init_thread(struct target_pt_regs *regs, struct image_info *infop);
|
|
||||||
abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp,
|
|
||||||
abi_ulong stringp, int push_ptr);
|
|
||||||
int loader_exec(int fdexec, const char *filename, char **argv, char **envp,
|
|
||||||
struct target_pt_regs *regs, struct image_info *infop,
|
|
||||||
struct linux_binprm *);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns true if the image uses the FDPIC ABI. If this is the case,
|
* Returns true if the image uses the FDPIC ABI. If this is the case,
|
||||||
* we have to provide some information (loadmap, pt_dynamic_info) such
|
* we have to provide some information (loadmap, pt_dynamic_info) such
|
||||||
|
@ -232,12 +201,6 @@ int loader_exec(int fdexec, const char *filename, char **argv, char **envp,
|
||||||
*/
|
*/
|
||||||
int info_is_fdpic(struct image_info *info);
|
int info_is_fdpic(struct image_info *info);
|
||||||
|
|
||||||
uint32_t get_elf_eflags(int fd);
|
|
||||||
int load_elf_binary(struct linux_binprm *bprm, struct image_info *info);
|
|
||||||
int load_flt_binary(struct linux_binprm *bprm, struct image_info *info);
|
|
||||||
|
|
||||||
abi_long memcpy_to_target(abi_ulong dest, const void *src,
|
|
||||||
unsigned long len);
|
|
||||||
void target_set_brk(abi_ulong new_brk);
|
void target_set_brk(abi_ulong new_brk);
|
||||||
abi_long do_brk(abi_ulong new_brk);
|
abi_long do_brk(abi_ulong new_brk);
|
||||||
void syscall_init(void);
|
void syscall_init(void);
|
||||||
|
@ -440,9 +403,6 @@ abi_ulong mmap_find_vma(abi_ulong, abi_ulong, abi_ulong);
|
||||||
void mmap_fork_start(void);
|
void mmap_fork_start(void);
|
||||||
void mmap_fork_end(int child);
|
void mmap_fork_end(int child);
|
||||||
|
|
||||||
/* main.c */
|
|
||||||
extern unsigned long guest_stack_size;
|
|
||||||
|
|
||||||
/* user access */
|
/* user access */
|
||||||
|
|
||||||
#define VERIFY_READ PAGE_READ
|
#define VERIFY_READ PAGE_READ
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include "qemu.h"
|
#include "qemu.h"
|
||||||
#include "strace.h"
|
#include "strace.h"
|
||||||
|
#include "loader.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "signal-common.h"
|
#include "signal-common.h"
|
||||||
|
|
||||||
|
|
|
@ -129,6 +129,7 @@
|
||||||
#include "qemu.h"
|
#include "qemu.h"
|
||||||
#include "strace.h"
|
#include "strace.h"
|
||||||
#include "signal-common.h"
|
#include "signal-common.h"
|
||||||
|
#include "loader.h"
|
||||||
#include "qemu/guest-random.h"
|
#include "qemu/guest-random.h"
|
||||||
#include "qemu/selfmap.h"
|
#include "qemu/selfmap.h"
|
||||||
#include "user/syscall-trace.h"
|
#include "user/syscall-trace.h"
|
||||||
|
|
Loading…
Reference in New Issue