1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _UAPI__ALPHA_A_OUT_H__
3#define _UAPI__ALPHA_A_OUT_H__
4
5#include <linux/types.h>
6
7/*
8 * OSF/1 ECOFF header structs.  ECOFF files consist of:
9 * 	- a file header (struct filehdr),
10 *	- an a.out header (struct aouthdr),
11 *	- one or more section headers (struct scnhdr).
12 *	  The filhdr's "f_nscns" field contains the
13 *	  number of section headers.
14 */
15
16struct filehdr
17{
18	/* OSF/1 "file" header */
19	__u16 f_magic, f_nscns;
20	__u32 f_timdat;
21	__u64 f_symptr;
22	__u32 f_nsyms;
23	__u16 f_opthdr, f_flags;
24};
25
26struct aouthdr
27{
28	__u64 info;		/* after that it looks quite normal.. */
29	__u64 tsize;
30	__u64 dsize;
31	__u64 bsize;
32	__u64 entry;
33	__u64 text_start;	/* with a few additions that actually make sense */
34	__u64 data_start;
35	__u64 bss_start;
36	__u32 gprmask, fprmask;	/* bitmask of general & floating point regs used in binary */
37	__u64 gpvalue;
38};
39
40struct scnhdr
41{
42	char	s_name[8];
43	__u64	s_paddr;
44	__u64	s_vaddr;
45	__u64	s_size;
46	__u64	s_scnptr;
47	__u64	s_relptr;
48	__u64	s_lnnoptr;
49	__u16	s_nreloc;
50	__u16	s_nlnno;
51	__u32	s_flags;
52};
53
54struct exec
55{
56	/* OSF/1 "file" header */
57	struct filehdr		fh;
58	struct aouthdr		ah;
59};
60
61/*
62 * Define's so that the kernel exec code can access the a.out header
63 * fields...
64 */
65#define	a_info		ah.info
66#define	a_text		ah.tsize
67#define a_data		ah.dsize
68#define a_bss		ah.bsize
69#define a_entry		ah.entry
70#define a_textstart	ah.text_start
71#define	a_datastart	ah.data_start
72#define	a_bssstart	ah.bss_start
73#define	a_gprmask	ah.gprmask
74#define a_fprmask	ah.fprmask
75#define a_gpvalue	ah.gpvalue
76
77#define N_TXTADDR(x) ((x).a_textstart)
78#define N_DATADDR(x) ((x).a_datastart)
79#define N_BSSADDR(x) ((x).a_bssstart)
80#define N_DRSIZE(x) 0
81#define N_TRSIZE(x) 0
82#define N_SYMSIZE(x) 0
83
84#define AOUTHSZ		sizeof(struct aouthdr)
85#define SCNHSZ		sizeof(struct scnhdr)
86#define SCNROUND	16
87
88#define N_TXTOFF(x) \
89  ((long) N_MAGIC(x) == ZMAGIC ? 0 : \
90   (sizeof(struct exec) + (x).fh.f_nscns*SCNHSZ + SCNROUND - 1) & ~(SCNROUND - 1))
91
92#endif /* _UAPI__ALPHA_A_OUT_H__ */
93