hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/arch/riscv/include/asm/module.h
....@@ -6,15 +6,13 @@
66
77 #include <asm-generic/module.h>
88
9
-#define MODULE_ARCH_VERMAGIC "riscv"
10
-
119 struct module;
12
-u64 module_emit_got_entry(struct module *mod, u64 val);
13
-u64 module_emit_plt_entry(struct module *mod, u64 val);
10
+unsigned long module_emit_got_entry(struct module *mod, unsigned long val);
11
+unsigned long module_emit_plt_entry(struct module *mod, unsigned long val);
1412
1513 #ifdef CONFIG_MODULE_SECTIONS
1614 struct mod_section {
17
- struct elf64_shdr *shdr;
15
+ Elf_Shdr *shdr;
1816 int num_entries;
1917 int max_entries;
2018 };
....@@ -26,18 +24,18 @@
2624 };
2725
2826 struct got_entry {
29
- u64 symbol_addr; /* the real variable address */
27
+ unsigned long symbol_addr; /* the real variable address */
3028 };
3129
32
-static inline struct got_entry emit_got_entry(u64 val)
30
+static inline struct got_entry emit_got_entry(unsigned long val)
3331 {
3432 return (struct got_entry) {val};
3533 }
3634
37
-static inline struct got_entry *get_got_entry(u64 val,
35
+static inline struct got_entry *get_got_entry(unsigned long val,
3836 const struct mod_section *sec)
3937 {
40
- struct got_entry *got = (struct got_entry *)sec->shdr->sh_addr;
38
+ struct got_entry *got = (struct got_entry *)(sec->shdr->sh_addr);
4139 int i;
4240 for (i = 0; i < sec->num_entries; i++) {
4341 if (got[i].symbol_addr == val)
....@@ -62,7 +60,9 @@
6260 #define REG_T0 0x5
6361 #define REG_T1 0x6
6462
65
-static inline struct plt_entry emit_plt_entry(u64 val, u64 plt, u64 got_plt)
63
+static inline struct plt_entry emit_plt_entry(unsigned long val,
64
+ unsigned long plt,
65
+ unsigned long got_plt)
6666 {
6767 /*
6868 * U-Type encoding:
....@@ -76,7 +76,7 @@
7676 * +------------+------------+--------+----------+----------+
7777 *
7878 */
79
- u64 offset = got_plt - plt;
79
+ unsigned long offset = got_plt - plt;
8080 u32 hi20 = (offset + 0x800) & 0xfffff000;
8181 u32 lo12 = (offset - hi20);
8282 return (struct plt_entry) {
....@@ -86,7 +86,7 @@
8686 };
8787 }
8888
89
-static inline int get_got_plt_idx(u64 val, const struct mod_section *sec)
89
+static inline int get_got_plt_idx(unsigned long val, const struct mod_section *sec)
9090 {
9191 struct got_entry *got_plt = (struct got_entry *)sec->shdr->sh_addr;
9292 int i;
....@@ -97,9 +97,9 @@
9797 return -1;
9898 }
9999
100
-static inline struct plt_entry *get_plt_entry(u64 val,
101
- const struct mod_section *sec_plt,
102
- const struct mod_section *sec_got_plt)
100
+static inline struct plt_entry *get_plt_entry(unsigned long val,
101
+ const struct mod_section *sec_plt,
102
+ const struct mod_section *sec_got_plt)
103103 {
104104 struct plt_entry *plt = (struct plt_entry *)sec_plt->shdr->sh_addr;
105105 int got_plt_idx = get_got_plt_idx(val, sec_got_plt);