fix: actually don't read the register through bpf_read

pull/21/head
EKTehtris 4 years ago
parent 6ac5e42db3
commit 94487fb5a4

@ -1,6 +1,6 @@
use core::ffi::c_void; use core::ffi::c_void;
use crate::{bindings::pt_regs, BpfContext}; use crate::{bindings::__u64, bindings::pt_regs, BpfContext};
pub struct ProbeContext { pub struct ProbeContext {
pub regs: Regs, pub regs: Regs,
@ -53,43 +53,43 @@ impl Regs {
#[cfg(any(bpf_target_arch = "x86_64", bpf_target_arch = "aarch64"))] #[cfg(any(bpf_target_arch = "x86_64", bpf_target_arch = "aarch64"))]
#[doc(alias = "PT_REGS_PARM1")] #[doc(alias = "PT_REGS_PARM1")]
/// Utility to get the First Parameter /// Utility to get the First Parameter
pub fn parm1(&self) -> Option<::aya_bpf_cty::c_ulong> { pub fn parm1(&self) -> __u64 {
unsafe { &*(self.regs) }.rdi() unsafe { &*(self.regs) }.rdi
} }
#[cfg(any(bpf_target_arch = "x86_64", bpf_target_arch = "aarch64"))] #[cfg(any(bpf_target_arch = "x86_64", bpf_target_arch = "aarch64"))]
#[doc(alias = "PT_REGS_PARM2")] #[doc(alias = "PT_REGS_PARM2")]
/// Utility to get the Second Parameter /// Utility to get the Second Parameter
pub fn parm2(&self) -> Option<::aya_bpf_cty::c_ulong> { pub fn parm2(&self) -> __u64 {
unsafe { &*(self.regs) }.rsi() unsafe { &*(self.regs) }.rsi
} }
#[cfg(any(bpf_target_arch = "x86_64", bpf_target_arch = "aarch64"))] #[cfg(any(bpf_target_arch = "x86_64", bpf_target_arch = "aarch64"))]
#[doc(alias = "PT_REGS_PARM3")] #[doc(alias = "PT_REGS_PARM3")]
/// Utility to get the Third Parameter /// Utility to get the Third Parameter
pub fn parm3(&self) -> Option<::aya_bpf_cty::c_ulong> { pub fn parm3(&self) -> __u64 {
unsafe { &*(self.regs) }.rdx() unsafe { &*(self.regs) }.rdx
} }
#[cfg(any(bpf_target_arch = "x86_64", bpf_target_arch = "aarch64"))] #[cfg(any(bpf_target_arch = "x86_64", bpf_target_arch = "aarch64"))]
#[doc(alias = "PT_REGS_PARM4")] #[doc(alias = "PT_REGS_PARM4")]
/// Utility to get the Fourth Parameter /// Utility to get the Fourth Parameter
pub fn parm4(&self) -> Option<::aya_bpf_cty::c_ulong> { pub fn parm4(&self) -> __u64 {
unsafe { &*(self.regs) }.rcx() unsafe { &*(self.regs) }.rcx
} }
#[cfg(any(bpf_target_arch = "x86_64", bpf_target_arch = "aarch64"))] #[cfg(any(bpf_target_arch = "x86_64", bpf_target_arch = "aarch64"))]
#[doc(alias = "PT_REGS_PARM5")] #[doc(alias = "PT_REGS_PARM5")]
/// Utility to get the Fifth Parameter /// Utility to get the Fifth Parameter
pub fn parm5(&self) -> Option<::aya_bpf_cty::c_ulong> { pub fn parm5(&self) -> __u64 {
unsafe { &*(self.regs) }.r8() unsafe { &*(self.regs) }.r8
} }
#[cfg(any(bpf_target_arch = "x86_64", bpf_target_arch = "aarch64"))] #[cfg(any(bpf_target_arch = "x86_64", bpf_target_arch = "aarch64"))]
#[doc(alias = "PT_REGS_PARM6")] #[doc(alias = "PT_REGS_PARM6")]
/// Utility to get the Sixth Parameter (not available for s390x) /// Utility to get the Sixth Parameter (not available for s390x)
pub fn parm6(&self) -> Option<::aya_bpf_cty::c_ulong> { pub fn parm6(&self) -> __u64 {
unsafe { &*(self.regs) }.r9() unsafe { &*(self.regs) }.r9
} }
#[cfg(any(bpf_target_arch = "x86_64", bpf_target_arch = "aarch64"))] #[cfg(any(bpf_target_arch = "x86_64", bpf_target_arch = "aarch64"))]

Loading…
Cancel
Save