hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/arch/riscv/include/asm/elf.h
....@@ -1,12 +1,8 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
34 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
45 * Copyright (C) 2012 Regents of the University of California
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
106 */
117
128 #ifndef _ASM_RISCV_ELF_H
....@@ -15,9 +11,7 @@
1511 #include <uapi/asm/elf.h>
1612 #include <asm/auxvec.h>
1713 #include <asm/byteorder.h>
18
-
19
-/* TODO: Move definition into include/uapi/linux/elf-em.h */
20
-#define EM_RISCV 0xF3
14
+#include <asm/cacheinfo.h>
2115
2216 /*
2317 * These are used to set parameters in the core dumps.
....@@ -30,13 +24,7 @@
3024 #define ELF_CLASS ELFCLASS32
3125 #endif
3226
33
-#if defined(__LITTLE_ENDIAN)
3427 #define ELF_DATA ELFDATA2LSB
35
-#elif defined(__BIG_ENDIAN)
36
-#define ELF_DATA ELFDATA2MSB
37
-#else
38
-#error "Unknown endianness"
39
-#endif
4028
4129 /*
4230 * This is used to ensure we don't load something for the wrong architecture.
....@@ -69,16 +57,28 @@
6957 */
7058 #define ELF_PLATFORM (NULL)
7159
60
+#ifdef CONFIG_MMU
7261 #define ARCH_DLINFO \
7362 do { \
7463 NEW_AUX_ENT(AT_SYSINFO_EHDR, \
7564 (elf_addr_t)current->mm->context.vdso); \
65
+ NEW_AUX_ENT(AT_L1I_CACHESIZE, \
66
+ get_cache_size(1, CACHE_TYPE_INST)); \
67
+ NEW_AUX_ENT(AT_L1I_CACHEGEOMETRY, \
68
+ get_cache_geometry(1, CACHE_TYPE_INST)); \
69
+ NEW_AUX_ENT(AT_L1D_CACHESIZE, \
70
+ get_cache_size(1, CACHE_TYPE_DATA)); \
71
+ NEW_AUX_ENT(AT_L1D_CACHEGEOMETRY, \
72
+ get_cache_geometry(1, CACHE_TYPE_DATA)); \
73
+ NEW_AUX_ENT(AT_L2_CACHESIZE, \
74
+ get_cache_size(2, CACHE_TYPE_UNIFIED)); \
75
+ NEW_AUX_ENT(AT_L2_CACHEGEOMETRY, \
76
+ get_cache_geometry(2, CACHE_TYPE_UNIFIED)); \
7677 } while (0)
77
-
78
-
7978 #define ARCH_HAS_SETUP_ADDITIONAL_PAGES
8079 struct linux_binprm;
8180 extern int arch_setup_additional_pages(struct linux_binprm *bprm,
8281 int uses_interp);
82
+#endif /* CONFIG_MMU */
8383
8484 #endif /* _ASM_RISCV_ELF_H */