1 // SPDX-License-Identifier: GPL-2.0
5 #include <internal/lib.h> // page_size
11 int arch__fix_module_text_start(u64
*start
, u64
*size
, const char *name
)
16 snprintf(path
, PATH_MAX
, "module/%.*s/sections/.text",
17 (int)strlen(name
) - 2, name
+ 1);
18 if (sysfs__read_ull(path
, (unsigned long long *)start
) < 0) {
19 pr_debug2("Using module %s start:%#lx\n", path
, m_start
);
22 /* Successful read of the modules segment text start address.
23 * Calculate difference between module start address
24 * in memory and module text segment start address.
25 * For example module load address is 0x3ff8011b000
26 * (from /proc/modules) and module text segment start
27 * address is 0x3ff8011b870 (from file above).
29 * Adjust the module size and subtract the GOT table
30 * size located at the beginning of the module.
32 *size
-= (*start
- m_start
);
38 /* On s390 kernel text segment start is located at very low memory addresses,
39 * for example 0x10000. Modules are located at very high memory addresses,
40 * for example 0x3ff xxxx xxxx. The gap between end of kernel text segment
41 * and beginning of first module's text segment is very big.
42 * Therefore do not fill this gap and do not assign it to the kernel dso map.
44 void arch__symbols__fixup_end(struct symbol
*p
, struct symbol
*c
)
46 if (strchr(p
->name
, '[') == NULL
&& strchr(c
->name
, '['))
47 /* Last kernel symbol mapped to end of page */
48 p
->end
= roundup(p
->end
, page_size
);
51 pr_debug4("%s sym:%s end:%#lx\n", __func__
, p
->name
, p
->end
);