Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
1
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
ea49e01
Documentation
LICENSES
arch
block
certs
crypto
drivers
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
accounting
arch
bpf
build
cgroup
crypto
debugging
firewire
firmware
gpio
hv
iio
include
io_uring
kvm
laptop
leds
lib
memory-model
nfsd
objtool
pci
pcmcia
perf
Documentation
arch
alpha
arc
arm
arm64
csky
mips
nds32
parisc
powerpc
s390
sh
sparc
x86
annotate
entry
include
tests
util
Build
archinsn.c
auxtrace.c
dwarf-regs.c
event.c
group.c
header.c
intel-bts.c
intel-pt.c
kvm-stat.c
machine.c
perf_regs.c
pmu.c
tsc.c
unwind-libdw.c
unwind-libunwind.c
Build
Makefile
xtensa
Build
common.c
common.h
bench
examples
include
jvmti
lib
pmu-events
python
scripts
tests
trace
ui
util
.gitignore
Build
CREDITS
MANIFEST
Makefile
Makefile.config
Makefile.perf
builtin-annotate.c
builtin-bench.c
builtin-buildid-cache.c
builtin-buildid-list.c
builtin-c2c.c
builtin-config.c
builtin-data.c
builtin-diff.c
builtin-evlist.c
builtin-ftrace.c
builtin-help.c
builtin-inject.c
builtin-kallsyms.c
builtin-kmem.c
builtin-kvm.c
builtin-list.c
builtin-lock.c
builtin-mem.c
builtin-probe.c
builtin-record.c
builtin-report.c
builtin-sched.c
builtin-script.c
builtin-stat.c
builtin-timechart.c
builtin-top.c
builtin-trace.c
builtin-version.c
builtin.h
check-headers.sh
command-list.txt
design.txt
perf-archive.sh
perf-completion.sh
perf-read-vdso.c
perf-sys.h
perf-with-kcore.sh
perf.c
perf.h
power
scripts
spi
testing
thermal
time
usb
virtio
vm
wmi
Makefile
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
Breadcrumbs
linux
/
tools
/
perf
/
arch
/
x86
/
util
/
machine.c
Copy path
Blame
Blame
Latest commit
History
History
105 lines (82 loc) · 2.18 KB
Breadcrumbs
linux
/
tools
/
perf
/
arch
/
x86
/
util
/
machine.c
Top
File metadata and controls
Code
Blame
105 lines (82 loc) · 2.18 KB
Raw
// SPDX-License-Identifier: GPL-2.0 #include <linux/types.h> #include <linux/string.h> #include <limits.h> #include <stdlib.h> #include "../../util/util.h" // page_size #include "../../util/machine.h" #include "../../util/map.h" #include "../../util/symbol.h" #include <linux/ctype.h> #include <symbol/kallsyms.h> #if defined(__x86_64__) struct extra_kernel_map_info { int cnt; int max_cnt; struct extra_kernel_map *maps; bool get_entry_trampolines; u64 entry_trampoline; }; static int add_extra_kernel_map(struct extra_kernel_map_info *mi, u64 start, u64 end, u64 pgoff, const char *name) { if (mi->cnt >= mi->max_cnt) { void *buf; size_t sz; mi->max_cnt = mi->max_cnt ? mi->max_cnt * 2 : 32; sz = sizeof(struct extra_kernel_map) * mi->max_cnt; buf = realloc(mi->maps, sz); if (!buf) return -1; mi->maps = buf; } mi->maps[mi->cnt].start = start; mi->maps[mi->cnt].end = end; mi->maps[mi->cnt].pgoff = pgoff; strlcpy(mi->maps[mi->cnt].name, name, KMAP_NAME_LEN); mi->cnt += 1; return 0; } static int find_extra_kernel_maps(void *arg, const char *name, char type, u64 start) { struct extra_kernel_map_info *mi = arg; if (!mi->entry_trampoline && kallsyms2elf_binding(type) == STB_GLOBAL && !strcmp(name, "_entry_trampoline")) { mi->entry_trampoline = start; return 0; } if (is_entry_trampoline(name)) { u64 end = start + page_size; return add_extra_kernel_map(mi, start, end, 0, name); } return 0; } int machine__create_extra_kernel_maps(struct machine *machine, struct dso *kernel) { struct extra_kernel_map_info mi = { .cnt = 0, }; char filename[PATH_MAX]; int ret; int i; machine__get_kallsyms_filename(machine, filename, PATH_MAX); if (symbol__restricted_filename(filename, "/proc/kallsyms")) return 0; ret = kallsyms__parse(filename, &mi, find_extra_kernel_maps); if (ret) goto out_free; if (!mi.entry_trampoline) goto out_free; for (i = 0; i < mi.cnt; i++) { struct extra_kernel_map *xm = &mi.maps[i]; xm->pgoff = mi.entry_trampoline; ret = machine__create_extra_kernel_map(machine, kernel, xm); if (ret) goto out_free; } machine->trampolines_mapped = mi.cnt; out_free: free(mi.maps); return ret; } #endif
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
You can’t perform that action at this time.