Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 223031
b: refs/heads/master
c: d214afb
h: refs/heads/master
i:
  223029: e46c7ba
  223027: 5ed3222
  223023: 074d0d3
v: v3
  • Loading branch information
Ming Lei authored and Arnaldo Carvalho de Melo committed Nov 30, 2010
1 parent b121151 commit efef491
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8a9533123f43f2cdb3eb601c17ff2ad336882eff
refs/heads/master: d214afbd81405d4da2c5745fe867e6b313fd4178
43 changes: 42 additions & 1 deletion trunk/tools/perf/util/symbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -2131,14 +2131,55 @@ static struct dso *machine__create_kernel(struct machine *self)
return kernel;
}

struct process_args {
u64 start;
};

static int symbol__in_kernel(void *arg, const char *name,
char type __used, u64 start)
{
struct process_args *args = arg;

if (strchr(name, '['))
return 0;

args->start = start;
return 1;
}

/* Figure out the start address of kernel map from /proc/kallsyms */
static u64 machine__get_kernel_start_addr(struct machine *machine)
{
const char *filename;
char path[PATH_MAX];
struct process_args args;

if (machine__is_host(machine)) {
filename = "/proc/kallsyms";
} else {
if (machine__is_default_guest(machine))
filename = (char *)symbol_conf.default_guest_kallsyms;
else {
sprintf(path, "%s/proc/kallsyms", machine->root_dir);
filename = path;
}
}

if (kallsyms__parse(filename, &args, symbol__in_kernel) <= 0)
return 0;

return args.start;
}

int __machine__create_kernel_maps(struct machine *self, struct dso *kernel)
{
enum map_type type;
u64 start = machine__get_kernel_start_addr(self);

for (type = 0; type < MAP__NR_TYPES; ++type) {
struct kmap *kmap;

self->vmlinux_maps[type] = map__new2(0, kernel, type);
self->vmlinux_maps[type] = map__new2(start, kernel, type);
if (self->vmlinux_maps[type] == NULL)
return -1;

Expand Down

0 comments on commit efef491

Please sign in to comment.