aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/machine.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/machine.c')
-rw-r--r--tools/perf/util/machine.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 37f8dc557ec0..e00daf0d2bde 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -32,6 +32,7 @@ int machine__init(struct machine *machine, const char *root_dir, pid_t pid)
32 machine->symbol_filter = NULL; 32 machine->symbol_filter = NULL;
33 machine->id_hdr_size = 0; 33 machine->id_hdr_size = 0;
34 machine->comm_exec = false; 34 machine->comm_exec = false;
35 machine->kernel_start = 0;
35 36
36 machine->root_dir = strdup(root_dir); 37 machine->root_dir = strdup(root_dir);
37 if (machine->root_dir == NULL) 38 if (machine->root_dir == NULL)
@@ -1559,3 +1560,25 @@ int machine__set_current_tid(struct machine *machine, int cpu, pid_t pid,
1559 1560
1560 return 0; 1561 return 0;
1561} 1562}
1563
1564int machine__get_kernel_start(struct machine *machine)
1565{
1566 struct map *map = machine__kernel_map(machine, MAP__FUNCTION);
1567 int err = 0;
1568
1569 /*
1570 * The only addresses above 2^63 are kernel addresses of a 64-bit
1571 * kernel. Note that addresses are unsigned so that on a 32-bit system
1572 * all addresses including kernel addresses are less than 2^32. In
1573 * that case (32-bit system), if the kernel mapping is unknown, all
1574 * addresses will be assumed to be in user space - see
1575 * machine__kernel_ip().
1576 */
1577 machine->kernel_start = 1ULL << 63;
1578 if (map) {
1579 err = map__load(map, machine->symbol_filter);
1580 if (map->start)
1581 machine->kernel_start = map->start;
1582 }
1583 return err;
1584}