Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754144AbdFMXuC (ORCPT ); Tue, 13 Jun 2017 19:50:02 -0400 Received: from mail-dm3nam03on0070.outbound.protection.outlook.com ([104.47.41.70]:9568 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753323AbdFMXt5 (ORCPT ); Tue, 13 Jun 2017 19:49:57 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=David.Daney@cavium.com; From: David Daney To: Alexei Starovoitov , Daniel Borkmann , "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: linux-mips@linux-mips.org, ralf@linux-mips.org, David Daney Subject: [PATCH 3/4] bpf: Add MIPS support to samples/bpf. Date: Tue, 13 Jun 2017 16:49:37 -0700 Message-Id: <20170613234938.4823-4-david.daney@cavium.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170613234938.4823-1-david.daney@cavium.com> References: <20170613234938.4823-1-david.daney@cavium.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [50.233.148.156] X-ClientProxiedBy: BY2PR07CA0024.namprd07.prod.outlook.com (10.166.107.19) To MWHPR07MB3501.namprd07.prod.outlook.com (10.164.192.28) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR07MB3501: X-MS-Office365-Filtering-Correlation-Id: 923294e7-a36a-4717-ab76-08d4b2b6ded2 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075)(201703031133081);SRVR:MWHPR07MB3501; X-Microsoft-Exchange-Diagnostics: 1;MWHPR07MB3501;3:e9AZ7KWJfhB1FcJ530Hi48l1eO0x0WRfpZ5RrHwxcRpzdhR3HtM2brxaifWSt23JdMFRjkAUzQpCEFzBCJby+esoVSdIGL8M202ZDgA1BplXhKxMPE6tWwM/sdjzyS/ojjcBnGf/uedgRlIs2qNiMkuIe/aTyD1Q0FP6/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9pubSV5yKdGWQQOH7gahl9F56Rm0zu2QLlhABI5uyr+3hmsqHzDnr+Wyz1v1uGfdvYSX3FgqWtbV/W6Jj2JuWWZQzb9QtBfQXxovQyQMjnt2tM/dK4oiL+10m7GWWASXZO95QF80qhrWtfUTi9BoXJwo+Z9u+qllkcaVW6bkvuds8+dRtEPcM3j1uTrxoXtURp5K7sw508fYzB/wnkxA2R+fnAUGl+aED9Y4MBV/0aPwoILG/PruicwejI+ReaoHEaeUr/amC11UD+2fkoc0BtPCPixE1+4BscrXcMdJ1CxuVTBdaf27Sj4Nh9tUl3QOMl5/TuEWrOPb+x9X0TzxFXJi8lkVrrEwmapRpWrzkNnOGVSjdq8I3Qop4mzHRO5oVqi8geO0 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123562025)(20161123555025)(20161123558100)(20161123560025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:MWHPR07MB3501;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:MWHPR07MB3501; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;MWHPR07MB3501;4:tjBHWhQxcBxT6fJnGMwNHpaVbGU26+Mvhmr/MXiW/q?= =?us-ascii?Q?WqKx68oJKlYUj/6fXz6EGuwxm4tyAL7sxkJh8a3iFaI9OzzAMruWNx6Jzre0?= =?us-ascii?Q?DVrkeN6XWkVr67Zz332jBnFrw2CrJ58NIF+SK5ccHnKUUtyy9Fh+AVFWBCpu?= =?us-ascii?Q?z/lYJe07LsLqg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P?= =?us-ascii?Q?9FSPCPLxfjCGKrTVqxP2akov0x9aQ/r2EZ0Pbu+6F1TL8I+HGJ+G6MVGNhCQ?= =?us-ascii?Q?p8pG7S8LChjgiSOIG2BBD66/TazqAp?= X-Forefront-PRVS: 0337AFFE9A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(39840400002)(39450400003)(39410400002)(39400400002)(39850400002)(189002)(199003)(6512007)(105586002)(53936002)(50226002)(53416004)(2950100002)(106356001)(4326008)(189998001)(6506006)(25786009)(42186005)(6666003)(33646002)(50466002)(69596002)(5003940100001)(6486002)(48376002)(76176999)(47776003)(7736002)(305945005)(1076002)(478600001)(101416001)(2906002)(81156014)(8676002)(81166006)(72206003)(107886003)(36756003)(5660300001)(66066001)(38730400002)(3846002)(68736007)(97736004)(6116002)(86362001)(50986999);DIR:OUT;SFP:1101;SCL:1;SRVR:MWHPR07MB3501;H:ddl.caveonetworks.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;MWHPR07MB3501;23:TkTj194itqK6rH39WK3MYyz2YgRShzeolknxm3NUk?= =?us-ascii?Q?EbiueNgjBFyWX3pjfTdtpwIkWja/R6yXgk/+z1Vr0OwvNU8ig6dgzUF6QEZQ?= =?us-ascii?Q?6H6cnDWWFevlK9z+mP+5PBjNrbkVwspEUTMGiGAPk8fwPvh5fl57ZGiNyqmH?= =?us-ascii?Q?MXMb7xbdxbb6oyNHEgsGcywIHmDvgWdcLdKqbKOL34jMGgqIwLoHVYqtQ+pg?= =?us-ascii?Q?EiqcFMBiJhvLCKJSs/nQcjMQZgWF3doSns6g/YWdriXMsXxq/KMt67s/16Ka?= =?us-ascii?Q?yBXfq67O72EIgXiqwgkK7c+lPRYMIvq1aeX14tyaXfEYg1PVegP1rlIuLFuv?= =?us-ascii?Q?j7yPe0x8Fe6THQk0YbpQEPSt3Ic7+qSwG3QHA5/9Sdn2LGo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BIiTqVgi6AkHcIzALVx3BOkNlnRcrZ/9Cdc1opcelcmb;24:NUNOG1T3u1UJQWwWLYHqUh2xLbJZu5k+DhAmZEpNMb5nzBOS56NMnLNpUOEJ+0wmq9CULtuAEmmyijWQS/WbKQ/FOCuAcFVIzDGeD6Shwig= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;MWHPR07MB3501;7:NX0FEIcG+x45ukNlOLo8PA59hAgmfoEr33p5CDsKdE9dYqMKCUq1lXDjY3aFY/pW5QZQls0dKipVjcksKov4MLI/C54BJftowe8nJO+WmyI/RM89d10e1aShbk4ibv0mmXlplVnbm/RXTOXDOG9meWTwdAllcxHF0XILEeGMMPPoOap0+IHjbfZlT0ejs1foGVknDHDuraTquxhvoyzkZrAfE5ZgpTWlY1w/BMmKAKgYf8I5ImYX1exiBWvW1SZFTki3YibwtWugbUJaGGbSm8gFkBdugV1Y+4gsNueDXWRNyBeF5nc07Y9CUpc0stqe/ss7exeOPsVf/vkRvEWCkg== X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2017 23:49:45.5722 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB3501 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1002 Lines: 31 Signed-off-by: David Daney --- samples/bpf/bpf_helpers.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/samples/bpf/bpf_helpers.h b/samples/bpf/bpf_helpers.h index 9a9c95f..76526da 100644 --- a/samples/bpf/bpf_helpers.h +++ b/samples/bpf/bpf_helpers.h @@ -135,6 +135,19 @@ static int (*bpf_skb_change_head)(void *, int len, int flags) = #define PT_REGS_SP(x) ((x)->sp) #define PT_REGS_IP(x) ((x)->pc) +#elif defined(__mips__) + +#define PT_REGS_PARM1(x) ((x)->regs[4]) +#define PT_REGS_PARM2(x) ((x)->regs[5]) +#define PT_REGS_PARM3(x) ((x)->regs[6]) +#define PT_REGS_PARM4(x) ((x)->regs[7]) +#define PT_REGS_PARM5(x) ((x)->regs[8]) +#define PT_REGS_RET(x) ((x)->regs[31]) +#define PT_REGS_FP(x) ((x)->regs[30]) /* Works only with CONFIG_FRAME_POINTER */ +#define PT_REGS_RC(x) ((x)->regs[1]) +#define PT_REGS_SP(x) ((x)->regs[29]) +#define PT_REGS_IP(x) ((x)->cp0_epc) + #elif defined(__powerpc__) #define PT_REGS_PARM1(x) ((x)->gpr[3]) -- 2.9.4