Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "LinuxPerf"
uuid = "b4c46c6c-4fb0-484d-a11a-41bc3392d094"
version = "0.4.2"
version = "0.4.3"

[deps]
PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
Expand Down
20 changes: 20 additions & 0 deletions src/LinuxPerf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,26 @@ function Base.show(io::IO, e::EventType)
end
end

# To support a new architecture, look for the code corresponding to the `perf_event_open`
# syscall in https://gpages.juszkiewicz.com.pl/syscalls-table/syscalls.html
const SYS_perf_event_open = if Sys.ARCH === :x86_64
# See also https://github.com/torvalds/linux/blob/b62cef9a5c673f1b8083159f5dc03c1c5daced2f/arch/x86/entry/syscalls/syscall_64.tbl
Clong(298)
elseif Sys.ARCH === :i686
# See also https://github.com/torvalds/linux/blob/b62cef9a5c673f1b8083159f5dc03c1c5daced2f/arch/x86/entry/syscalls/syscall_32.tbl
Clong(336)
elseif Sys.ARCH === :aarch64
# See also https://arm64.syscall.sh/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and risc use the generic syscall table in the kernel btw

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did find https://github.com/torvalds/linux/blob/b62cef9a5c673f1b8083159f5dc03c1c5daced2f/arch/arm64/tools/syscall_64.tbl (while I didn't find any symlink at all for riscv64), I was a bit hesitant to link here a generic table, but I guess that's what it is. Ok, I'll update the reference later.

Clong(241)
elseif Sys.ARCH === :arm
# See also https://github.com/torvalds/linux/blob/b62cef9a5c673f1b8083159f5dc03c1c5daced2f/arch/arm/tools/syscall.tbl
Clong(364)
elseif Sys.ARCH === :powerpc64le || Sys.ARCH === :ppc64le
# See also https://github.com/torvalds/linux/blob/b62cef9a5c673f1b8083159f5dc03c1c5daced2f/arch/powerpc/kernel/syscalls/syscall.tbl
Clong(319)
elseif Sys.ARCH === :riscv64 || Sys.ARCH === :rv64
# See also https://jborza.com/post/2021-05-11-riscv-linux-syscalls/
Clong(241)
else
Clong(-1) # sentinel for unknown syscall ID
end
Expand Down Expand Up @@ -340,16 +350,26 @@ function Base.show(io::IO, g::EventGroup)
print(io, "\t", g.event_types[end], ")")
end

# To support a new architecture, look for the code corresponding to the `prctl` syscall in
# https://gpages.juszkiewicz.com.pl/syscalls-table/syscalls.html
const SYS_prctl = if Sys.ARCH === :x86_64
# See also https://github.com/torvalds/linux/blob/b62cef9a5c673f1b8083159f5dc03c1c5daced2f/arch/x86/entry/syscalls/syscall_64.tbl
Clong(157)
elseif Sys.ARCH === :i686
# See also https://github.com/torvalds/linux/blob/b62cef9a5c673f1b8083159f5dc03c1c5daced2f/arch/x86/entry/syscalls/syscall_32.tbl
Clong(172)
elseif Sys.ARCH === :aarch64
# See also https://arm64.syscall.sh/
Clong(167)
elseif Sys.ARCH === :arm
# See also https://github.com/torvalds/linux/blob/b62cef9a5c673f1b8083159f5dc03c1c5daced2f/arch/arm/tools/syscall.tbl
Clong(172)
elseif Sys.ARCH === :powerpc64le || Sys.ARCH === :ppc64le
# See also https://github.com/torvalds/linux/blob/b62cef9a5c673f1b8083159f5dc03c1c5daced2f/arch/powerpc/kernel/syscalls/syscall.tbl
Clong(171)
elseif Sys.ARCH === :riscv64 || Sys.ARCH === :rv64
# See also https://jborza.com/post/2021-05-11-riscv-linux-syscalls/
Clong(167)
else
Clong(-1) # sentinel for unknown syscall ID
end
Expand Down