bpf: Fix pt_regs for aarch64 (again)

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
pull/310/head
Dave Tucker 2 years ago
parent 1d06b41e57
commit 7f6da53c34

@ -135,14 +135,14 @@ impl<T> FromPtRegs for *const T {
impl<T> FromPtRegs for *const T { impl<T> FromPtRegs for *const T {
fn from_argument(ctx: &pt_regs, n: usize) -> Option<Self> { fn from_argument(ctx: &pt_regs, n: usize) -> Option<Self> {
if n <= 7 { if n <= 7 {
Some(ctx.regs.regs[n] as *const _) Some(ctx.regs[n] as *const _)
} else { } else {
None None
} }
} }
fn from_retval(ctx: &pt_regs) -> Option<Self> { fn from_retval(ctx: &pt_regs) -> Option<Self> {
Some(ctx.regs.regs[0] as *const _) Some(ctx.regs[0] as *const _)
} }
} }
@ -184,14 +184,14 @@ impl<T> FromPtRegs for *mut T {
impl<T> FromPtRegs for *mut T { impl<T> FromPtRegs for *mut T {
fn from_argument(ctx: &pt_regs, n: usize) -> Option<Self> { fn from_argument(ctx: &pt_regs, n: usize) -> Option<Self> {
if n <= 7 { if n <= 7 {
Some(ctx.regs.regs[n] as *mut _) Some(ctx.regs[n] as *mut _)
} else { } else {
None None
} }
} }
fn from_retval(ctx: &pt_regs) -> Option<Self> { fn from_retval(ctx: &pt_regs) -> Option<Self> {
Some(ctx.regs.regs[0] as *mut _) Some(ctx.regs[0] as *mut _)
} }
} }
@ -236,14 +236,14 @@ macro_rules! impl_from_pt_regs {
impl FromPtRegs for $type { impl FromPtRegs for $type {
fn from_argument(ctx: &pt_regs, n: usize) -> Option<Self> { fn from_argument(ctx: &pt_regs, n: usize) -> Option<Self> {
if n <= 7 { if n <= 7 {
Some(ctx.regs.regs[n] as *const $type as _) Some(ctx.regs[n] as *const $type as _)
} else { } else {
None None
} }
} }
fn from_retval(ctx: &pt_regs) -> Option<Self> { fn from_retval(ctx: &pt_regs) -> Option<Self> {
Some(ctx.regs.regs[0] as *const $type as _) Some(ctx.regs[0] as *const $type as _)
} }
} }
}; };

Loading…
Cancel
Save