-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf tools: Build programs to copy 32-bit compatibility
perf tools copy VDSO out of memory. However, on 64-bit machines there may be 32-bit compatibility VDOs also. To copy those requires separate 32-bit executables. This patch adds to the build additional programs perf-read-vdso32 and perf-read-vdsox32 for 32-bit and x32 respectively. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com>, Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1414061124-26830-15-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
- Loading branch information
Adrian Hunter
authored and
Arnaldo Carvalho de Melo
committed
Oct 29, 2014
1 parent
42634bc
commit e477f3f
Showing
8 changed files
with
149 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
int main(void) | ||
{ | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include <stdio.h> | ||
#include <string.h> | ||
|
||
#define VDSO__MAP_NAME "[vdso]" | ||
|
||
/* | ||
* Include definition of find_vdso_map() also used in util/vdso.c for | ||
* building perf. | ||
*/ | ||
#include "util/find-vdso-map.c" | ||
|
||
int main(void) | ||
{ | ||
void *start, *end; | ||
size_t size, written; | ||
|
||
if (find_vdso_map(&start, &end)) | ||
return 1; | ||
|
||
size = end - start; | ||
|
||
while (size) { | ||
written = fwrite(start, 1, size, stdout); | ||
if (!written) | ||
return 1; | ||
start += written; | ||
size -= written; | ||
} | ||
|
||
if (fflush(stdout)) | ||
return 1; | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
static int find_vdso_map(void **start, void **end) | ||
{ | ||
FILE *maps; | ||
char line[128]; | ||
int found = 0; | ||
|
||
maps = fopen("/proc/self/maps", "r"); | ||
if (!maps) { | ||
fprintf(stderr, "vdso: cannot open maps\n"); | ||
return -1; | ||
} | ||
|
||
while (!found && fgets(line, sizeof(line), maps)) { | ||
int m = -1; | ||
|
||
/* We care only about private r-x mappings. */ | ||
if (2 != sscanf(line, "%p-%p r-xp %*x %*x:%*x %*u %n", | ||
start, end, &m)) | ||
continue; | ||
if (m < 0) | ||
continue; | ||
|
||
if (!strncmp(&line[m], VDSO__MAP_NAME, | ||
sizeof(VDSO__MAP_NAME) - 1)) | ||
found = 1; | ||
} | ||
|
||
fclose(maps); | ||
return !found; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters