headers/vmlinux: Add more archs powerpc and arm64

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
This commit is contained in:
Jesper Dangaard Brouer
2021-06-01 17:03:21 +02:00
parent 8d44091df0
commit ff5fef3dc9
5 changed files with 104 additions and 16 deletions

View File

@@ -0,0 +1,38 @@
#ifndef __VMLINUX_ARCH_ARM64_H__
#define __VMLINUX_ARCH_ARM64_H__
#ifdef __BPF_TRACING_H__
/* Expected include <bpf/bpf_tracing.h> */
#ifndef bpf_target_defined
#warning "Tracing need __TARGET_ARCH_arm64 defined"
#endif
#endif /* __BPF_TRACING_H__ */
struct user_pt_regs {
__u64 regs[31];
__u64 sp;
__u64 pc;
__u64 pstate;
};
struct pt_regs {
union {
struct user_pt_regs user_regs;
struct {
u64 regs[31];
u64 sp;
u64 pc;
u64 pstate;
};
};
u64 orig_x0;
s32 syscallno;
u32 unused2;
u64 orig_addr_limit;
u64 pmr_save;
u64 stackframe[2];
u64 lockdep_hardirqs;
u64 exit_rcu;
};
#endif /* __VMLINUX_ARCH_ARM64_H__ */

View File

@@ -0,0 +1,55 @@
#ifndef __VMLINUX_ARCH_POWERPC_H__
#define __VMLINUX_ARCH_POWERPC_H__
#ifdef __BPF_TRACING_H__
/* Expected include <bpf/bpf_tracing.h> */
#ifndef bpf_target_defined
#warning "Tracing need __TARGET_ARCH_powerpc defined"
#endif
#endif /* __BPF_TRACING_H__ */
struct user_pt_regs {
long unsigned int gpr[32];
long unsigned int nip;
long unsigned int msr;
long unsigned int orig_gpr3;
long unsigned int ctr;
long unsigned int link;
long unsigned int xer;
long unsigned int ccr;
long unsigned int softe;
long unsigned int trap;
long unsigned int dar;
long unsigned int dsisr;
long unsigned int result;
};
struct pt_regs {
union {
struct user_pt_regs user_regs;
struct {
long unsigned int gpr[32];
long unsigned int nip;
long unsigned int msr;
long unsigned int orig_gpr3;
long unsigned int ctr;
long unsigned int link;
long unsigned int xer;
long unsigned int ccr;
long unsigned int softe;
long unsigned int trap;
long unsigned int dar;
long unsigned int dsisr;
long unsigned int result;
};
};
union {
struct {
long unsigned int ppr;
long unsigned int kuap;
};
long unsigned int __pad[2];
};
};
#endif /* __VMLINUX_ARCH_POWERPC_H__ */

View File

@@ -1,6 +1,12 @@
#ifndef __VMLINUX_ARCH_X86_H__
#define __VMLINUX_ARCH_X86_H__
#ifdef __BPF_TRACING_H__
/* Expected include <bpf/bpf_tracing.h> */
#ifndef bpf_target_defined
#warning "Tracing need __TARGET_ARCH_x86 defined"
#endif
#endif /* __BPF_TRACING_H__ */
struct pt_regs {
long unsigned int r15;

View File

@@ -18,23 +18,11 @@
#include "vmlinux/vmlinux_types.h"
#include "vmlinux/vmlinux_common.h"
#include "vmlinux/vmlinux_arch.h"
#include "vmlinux/vmlinux_net.h"
/*
* Notice: Defining __VMLINUX_H__ (or __KERNEL__) cause <bpf/bpf_tracing.h>
* header file to define architecture specific PT_REGS_PARM's.
*
* When using '-target bpf' the fallback mechanism doesn't detect right arch
* via compiler defines.
*
* Makefile system in lib/common.mk detect ARCH and defines the
* defines __TARGET_ARCH_$(ARCH) matched on below.
*/
#if defined(__TARGET_ARCH_x86)
#include "vmlinux/arch/x86/vmlinux.h"
#else
#warning "Makefile for BPF-tracing on this arch: not supported yet"
#endif
#ifndef BPF_NO_PRESERVE_ACCESS_INDEX
#pragma clang attribute pop

View File

@@ -7,4 +7,5 @@ LIB_DIR = ../lib
include $(LIB_DIR)/common.mk
BPF_CFLAGS += -D__TARGET_ARCH_$(ARCH)
# The __TARGET_ARCH_xxx is defined in lib/common.mk
# BPF_CFLAGS += -D__TARGET_ARCH_$(ARCH)