Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bcc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
bcc
Commits
e0f2cd19
Commit
e0f2cd19
authored
May 02, 2016
by
4ast
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #520 from rnav/powerpc-support-v2
Powerpc support v2
parents
8216464e
0301dda8
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
29 additions
and
3 deletions
+29
-3
src/cc/CMakeLists.txt
src/cc/CMakeLists.txt
+1
-1
src/cc/frontends/clang/b_frontend_action.cc
src/cc/frontends/clang/b_frontend_action.cc
+6
-0
src/cc/frontends/clang/loader.cc
src/cc/frontends/clang/loader.cc
+4
-0
src/cc/libbpf.c
src/cc/libbpf.c
+4
-0
tests/cc/test_c_api.cc
tests/cc/test_c_api.cc
+2
-2
tests/python/test_trace2.py
tests/python/test_trace2.py
+4
-0
tests/python/test_trace3.c
tests/python/test_trace3.c
+8
-0
No files found.
src/cc/CMakeLists.txt
View file @
e0f2cd19
...
...
@@ -44,7 +44,7 @@ set_target_properties(bcc-static PROPERTIES OUTPUT_NAME bcc)
# BPF is still experimental otherwise it should be available
#llvm_map_components_to_libnames(llvm_libs bpf mcjit irreader passes)
llvm_map_components_to_libnames
(
llvm_libs bitwriter bpfcodegen irreader linker
mcjit objcarcopts option passes
x86
codegen
)
mcjit objcarcopts option passes
native
codegen
)
llvm_expand_dependencies
(
expanded_libs
${
llvm_libs
}
)
# order is important
...
...
src/cc/frontends/clang/b_frontend_action.cc
View file @
e0f2cd19
...
...
@@ -35,8 +35,14 @@ namespace ebpf {
const
char
*
calling_conv_regs_x86
[]
=
{
"di"
,
"si"
,
"dx"
,
"cx"
,
"r8"
,
"r9"
};
const
char
*
calling_conv_regs_ppc
[]
=
{
"gpr[3]"
,
"gpr[4]"
,
"gpr[5]"
,
"gpr[6]"
,
"gpr[7]"
,
"gpr[8]"
};
// todo: support more archs
#if defined(__powerpc__)
const
char
**
calling_conv_regs
=
calling_conv_regs_ppc
;
#else
const
char
**
calling_conv_regs
=
calling_conv_regs_x86
;
#endif
using
std
::
map
;
using
std
::
set
;
...
...
src/cc/frontends/clang/loader.cc
View file @
e0f2cd19
...
...
@@ -128,7 +128,11 @@ int ClangLoader::parse(unique_ptr<llvm::Module> *mod, unique_ptr<vector<TableDes
DiagnosticsEngine
diags
(
DiagID
,
&*
diag_opts
,
diag_client
);
// set up the command line argument wrapper
#if defined(__powerpc64__)
driver
::
Driver
drv
(
""
,
"ppc64le-unknown-linux-gnu"
,
diags
);
#else
driver
::
Driver
drv
(
""
,
"x86_64-unknown-linux-gnu"
,
diags
);
#endif
drv
.
setTitle
(
"bcc-clang-driver"
);
drv
.
setCheckInputsExist
(
false
);
...
...
src/cc/libbpf.c
View file @
e0f2cd19
...
...
@@ -39,8 +39,12 @@
// TODO: remove these defines when linux-libc-dev exports them properly
#ifndef __NR_bpf
#if defined(__powerpc64__)
#define __NR_bpf 361
#else
#define __NR_bpf 321
#endif
#endif
#ifndef SO_ATTACH_BPF
#define SO_ATTACH_BPF 50
...
...
tests/cc/test_c_api.cc
View file @
e0f2cd19
...
...
@@ -43,8 +43,8 @@ TEST_CASE("binary resolution with `which`", "[c_api]") {
static
void
_test_ksym
(
const
char
*
sym
,
uint64_t
addr
,
void
*
_
)
{
if
(
!
strcmp
(
sym
,
"startup_64"
))
{
REQUIRE
(
addr
==
0xffffffff81000000ull
);
}
else
if
(
!
strcmp
(
sym
,
"
__per_cpu_start
"
))
REQUIRE
(
addr
==
0x
0
);
}
else
if
(
!
strcmp
(
sym
,
"
system_reset_pSeries
"
))
REQUIRE
(
addr
==
0x
c000000000000100ull
);
}
TEST_CASE
(
"list all kernel symbols"
,
"[c_api]"
)
{
...
...
tests/python/test_trace2.py
View file @
e0f2cd19
...
...
@@ -15,7 +15,11 @@ struct Counters { u64 stat1; };
BPF_TABLE("hash", struct Ptr, struct Counters, stats, 1024);
int count_sched(struct pt_regs *ctx) {
#if defined(__powerpc__)
struct Ptr key = {.ptr=ctx->gpr[3]};
#else
struct Ptr key = {.ptr=ctx->bx};
#endif
struct Counters zleaf = {0};
stats.lookup_or_init(&key, &zleaf)->stat1++;
return 0;
...
...
tests/python/test_trace3.c
View file @
e0f2cd19
...
...
@@ -28,14 +28,22 @@ static u32 log2l(u64 v) {
}
int
probe_blk_start_request
(
struct
pt_regs
*
ctx
)
{
#if defined(__powerpc__)
struct
Request
rq
=
{.
rq
=
ctx
->
gpr
[
3
]};
#else
struct
Request
rq
=
{.
rq
=
ctx
->
di
};
#endif
struct
Time
tm
=
{.
start
=
bpf_ktime_get_ns
()};
requests
.
update
(
&
rq
,
&
tm
);
return
0
;
}
int
probe_blk_update_request
(
struct
pt_regs
*
ctx
)
{
#if defined(__powerpc__)
struct
Request
rq
=
{.
rq
=
ctx
->
gpr
[
3
]};
#else
struct
Request
rq
=
{.
rq
=
ctx
->
di
};
#endif
struct
Time
*
tm
=
requests
.
lookup
(
&
rq
);
if
(
!
tm
)
return
0
;
u64
delta
=
bpf_ktime_get_ns
()
-
tm
->
start
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment