blob: 6b656de29f00d68d3ff645491e8f852be98e30c6 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu>
4 * Copyright (C) 2008-2009 PetaLogix
5 * Copyright (C) 2006 Atmark Techno, Inc.
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11
12#ifndef _UAPI_ASM_MICROBLAZE_ELF_H
13#define _UAPI_ASM_MICROBLAZE_ELF_H
14
15#include <linux/elf-em.h>
16
17/*
18 * Note there is no "official" ELF designation for Microblaze.
19 * I've snaffled the value from the microblaze binutils source code
20 * /binutils/microblaze/include/elf/microblaze.h
21 */
22#define EM_MICROBLAZE_OLD 0xbaab
23#define ELF_ARCH EM_MICROBLAZE
24
25/*
26 * This is used to ensure we don't load something for the wrong architecture.
27 */
28#define elf_check_arch(x) ((x)->e_machine == EM_MICROBLAZE \
29 || (x)->e_machine == EM_MICROBLAZE_OLD)
30
31/*
32 * These are used to set parameters in the core dumps.
33 */
34#define ELF_CLASS ELFCLASS32
35
36#ifndef __uClinux__
37
38/*
39 * ELF register definitions..
40 */
41
42#include <asm/ptrace.h>
43#include <asm/byteorder.h>
44
45#ifndef ELF_GREG_T
46#define ELF_GREG_T
47typedef unsigned long elf_greg_t;
48#endif
49
50#ifndef ELF_NGREG
51#define ELF_NGREG (sizeof(struct pt_regs) / sizeof(elf_greg_t))
52#endif
53
54#ifndef ELF_GREGSET_T
55#define ELF_GREGSET_T
56typedef elf_greg_t elf_gregset_t[ELF_NGREG];
57#endif
58
59#ifndef ELF_FPREGSET_T
60#define ELF_FPREGSET_T
61
62/* TBD */
63#define ELF_NFPREG 33 /* includes fsr */
64typedef unsigned long elf_fpreg_t;
65typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
66
67/* typedef struct user_fpu_struct elf_fpregset_t; */
68#endif
69
70/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
71 * use of this is to invoke "./ld.so someprog" to test out a new version of
72 * the loader. We need to make sure that it is out of the way of the program
73 * that it will "exec", and that there is sufficient room for the brk.
74 */
75
76#define ELF_ET_DYN_BASE (0x08000000)
77
78#ifdef __MICROBLAZEEL__
79#define ELF_DATA ELFDATA2LSB
80#else
81#define ELF_DATA ELFDATA2MSB
82#endif
83
84#define ELF_EXEC_PAGESIZE PAGE_SIZE
85
86
87#define ELF_CORE_COPY_REGS(_dest, _regs) \
88 memcpy((char *) &_dest, (char *) _regs, \
89 sizeof(struct pt_regs));
90
91/* This yields a mask that user programs can use to figure out what
92 * instruction set this CPU supports. This could be done in user space,
93 * but it's not easy, and we've already done it here.
94 */
95#define ELF_HWCAP (0)
96
97/* This yields a string that ld.so will use to load implementation
98 * specific libraries for optimization. This is more specific in
99 * intent than poking at uname or /proc/cpuinfo.
100
101 * For the moment, we have only optimizations for the Intel generations,
102 * but that could change...
103 */
104#define ELF_PLATFORM (NULL)
105
106/* Added _f parameter. Is this definition correct: TBD */
107#define ELF_PLAT_INIT(_r, _f) \
108do { \
109 _r->r0 = _r->r1 = _r->r2 = _r->r3 = \
110 _r->r4 = _r->r5 = _r->r6 = _r->r7 = \
111 _r->r8 = _r->r9 = _r->r10 = _r->r11 = \
112 _r->r12 = _r->r13 = _r->r14 = _r->r15 = \
113 _r->r16 = _r->r17 = _r->r18 = _r->r19 = \
114 _r->r20 = _r->r21 = _r->r22 = _r->r23 = \
115 _r->r24 = _r->r25 = _r->r26 = _r->r27 = \
116 _r->r28 = _r->r29 = _r->r30 = _r->r31 = \
117 0; \
118} while (0)
119
120
121#endif /* __uClinux__ */
122
123#endif /* _UAPI_ASM_MICROBLAZE_ELF_H */