1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /* FDPIC ELF load map
3  *
4  * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
5  * Written by David Howells (dhowells@redhat.com)
6  */
7 
8 #ifndef _LINUX_ELF_FDPIC_H
9 #define _LINUX_ELF_FDPIC_H
10 
11 #include <uapi/linux/elf-fdpic.h>
12 
13 /*
14  * binfmt binary parameters structure
15  */
16 struct elf_fdpic_params {
17 	struct elfhdr			hdr;		/* ref copy of ELF header */
18 	struct elf_phdr			*phdrs;		/* ref copy of PT_PHDR table */
19 	struct elf32_fdpic_loadmap	*loadmap;	/* loadmap to be passed to userspace */
20 	unsigned long			elfhdr_addr;	/* mapped ELF header user address */
21 	unsigned long			ph_addr;	/* mapped PT_PHDR user address */
22 	unsigned long			map_addr;	/* mapped loadmap user address */
23 	unsigned long			entry_addr;	/* mapped entry user address */
24 	unsigned long			stack_size;	/* stack size requested (PT_GNU_STACK) */
25 	unsigned long			dynamic_addr;	/* mapped PT_DYNAMIC user address */
26 	unsigned long			load_addr;	/* user address at which to map binary */
27 	unsigned long			flags;
28 #define ELF_FDPIC_FLAG_ARRANGEMENT	0x0000000f	/* PT_LOAD arrangement flags */
29 #define ELF_FDPIC_FLAG_INDEPENDENT	0x00000000	/* PT_LOADs can be put anywhere */
30 #define ELF_FDPIC_FLAG_HONOURVADDR	0x00000001	/* PT_LOAD.vaddr must be honoured */
31 #define ELF_FDPIC_FLAG_CONSTDISP	0x00000002	/* PT_LOADs require constant
32 							 * displacement */
33 #define ELF_FDPIC_FLAG_CONTIGUOUS	0x00000003	/* PT_LOADs should be contiguous */
34 #define ELF_FDPIC_FLAG_EXEC_STACK	0x00000010	/* T if stack to be executable */
35 #define ELF_FDPIC_FLAG_NOEXEC_STACK	0x00000020	/* T if stack not to be executable */
36 #define ELF_FDPIC_FLAG_EXECUTABLE	0x00000040	/* T if this object is the executable */
37 #define ELF_FDPIC_FLAG_PRESENT		0x80000000	/* T if this object is present */
38 };
39 
40 #ifdef CONFIG_MMU
41 extern void elf_fdpic_arch_lay_out_mm(struct elf_fdpic_params *exec_params,
42 				      struct elf_fdpic_params *interp_params,
43 				      unsigned long *start_stack,
44 				      unsigned long *start_brk);
45 #endif
46 
47 #endif /* _LINUX_ELF_FDPIC_H */
48