From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id F32953858417 for ; Wed, 26 Apr 2023 17:31:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F32953858417 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33QGx2qe004935 for ; Wed, 26 Apr 2023 17:31:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=LRRRjPkSBNmA0R3hbcIqQxWiCEBq+OsVMFeSNBkDVZw=; b=sKXBHTl6fg1xwFFV11an4gCto6Z0qGhzcmYREN8hBpFUd6h4VYdyl1nk+Y2pSbVsDV2r eJqp8DFemQlbTMJ2rdEE7dQrRjJshrI+YJ7I7cJUZ9OZZeshaepyxSMzofkCgH/xs8Sg IXZvjGIOfaqYIBPxFBvRVxj4b+Mx1YLfpErHVre9/S/0waPvfjzBan++PXS1SaHoQl9U m8MS1CU0r1Hg+R7r8QLAEHY+biXhDurc5LJyHQhm/YziPFYEFiI4ZVSBVjZj4pBJk+ib pXWeA/+Lco8Lvf4VudYJEmrp52be3ahFge6ftol/stiUw/y0apC6pO4JKdzIuzgZMVSH 8w== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q46gbt4bm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 26 Apr 2023 17:31:47 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 33QH2EMo032602 for ; Wed, 26 Apr 2023 17:31:47 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2102.outbound.protection.outlook.com [104.47.55.102]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3q4618fbtb-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 26 Apr 2023 17:31:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cL+psLsw9vOmJKg4TfJWre7j014QQPDJ1mEYKZ+XZnwHfalJWrenfWzPq4EY19oDDD1TzZ2x5bmpp8hTHj6iRvsacXprIrYOOH/kNE/6eIzOrTRjTWRCVq8XWqRjw4cjDOZYP8/2eXxe9FnhxzRV/x1wN4xv/0QITX1u9B5Dd94wGubgwjxfbNJDKa2GXqA/JdRqDc+2X6LxflADR0LRuqc2QtrRem9BAdhy9aSxvwkOKjxD7uyZAEodk5b5pSipeMYTyBbJEPRZIxcHnCpCb688/Mk3FlN9YeSfBIZf9BBnIBjCTSAUT6SH4OVd2byvxT237CD6FLNfnlPcYKKkZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LRRRjPkSBNmA0R3hbcIqQxWiCEBq+OsVMFeSNBkDVZw=; b=GKMBRpMpGkIHh8DH8wSyooN+iG8NLLoyXho0Ggx/je8d9lkbnC2fp/BDrU2LfgV6QN/sAB7Djm19WwrA97hNweqTQ87GU0f4whA07L1q+SftGSlD812LdF5QP+h/TUI8Xxx/ds8fJsGsuHbw5HFzVGpH2TpYrkcIxcsIQHXeuPco4E/kH2GRp8+suiCbyVt1wjTE+japA2CZzbQ7CqFP9k21t+61fh1jQ3S7bwFsvaCCF/k0AaOrz6LeSoTNbRhGcOfM4b1WVi6aGxUfExshXeEonNiAC2DAnehxy9RjbAresIcq/Pfn9xnJ59osu5xhowyj8Vr19NPQ5YL+P/jo/w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LRRRjPkSBNmA0R3hbcIqQxWiCEBq+OsVMFeSNBkDVZw=; b=Bnb8/vUw/LUg+jenkyJNz5yzUMoyt1IifyHS90zVtYPYLuVY1c2HuadGZ8iQ0u6FkCOYFL6xubmp+uSRhqK19VXwG0R41ae6ZCDV1qcraUXTej6uEq4isKX57XUxKWngO9zGbQloBSQDkStIiAnccWwW2inuHTKQoN1C6Ck07rM= Received: from BYAPR10MB2888.namprd10.prod.outlook.com (2603:10b6:a03:88::32) by PH0PR10MB5730.namprd10.prod.outlook.com (2603:10b6:510:148::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.33; Wed, 26 Apr 2023 17:31:44 +0000 Received: from BYAPR10MB2888.namprd10.prod.outlook.com ([fe80::53da:d3b:d2e4:d40]) by BYAPR10MB2888.namprd10.prod.outlook.com ([fe80::53da:d3b:d2e4:d40%6]) with mapi id 15.20.6319.033; Wed, 26 Apr 2023 17:31:43 +0000 From: "Jose E. Marchesi" To: binutils@sourceware.org Subject: [COMMITTED 3/3] gas: documentation for the BPF pseudo-c asm syntax Date: Wed, 26 Apr 2023 19:31:23 +0200 Message-Id: <20230426173123.24564-3-jose.marchesi@oracle.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230426173123.24564-1-jose.marchesi@oracle.com> References: <20230426173123.24564-1-jose.marchesi@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: AM0PR07CA0025.eurprd07.prod.outlook.com (2603:10a6:208:ac::38) To BYAPR10MB2888.namprd10.prod.outlook.com (2603:10b6:a03:88::32) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB2888:EE_|PH0PR10MB5730:EE_ X-MS-Office365-Filtering-Correlation-Id: 5a0f6dd6-3eb8-4e3e-9ecf-08db467c1a5f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x7/jhZCVWVM85IAV1YsXMfoMFtYQVgtXlAx7yytjQdGWlmxoaF8Ne9ZOpu+4ELoBOKDQnQzQxvZvzmVdkQbf8i8kcci29ntJ0BZF0dkyiG5cV7WLRgU1gQU3mKfN53N8NE+RBA55uVM5b/GCELCtCquY2ujgA3P6YsUWjRs2UoCCOKLArjK0Moe87dgHyaU7d+EYBM/9xBMzn2RZN1/lkrUijEaSj2unpfY9zXiKVuFHyK3cyiiEGFpKffd7TSONgCMPF0AXIUXd7PfeNrbd2BcNQ9AsYmIbyLYzhbZJHUBD+pk99l41Zo9UHYdRwkt9efU5xjhEoXHzfK/2ELNHlGDFAe8MsbfuYoTlyuiaSlwHpMOpszCnbXmQcJq8OgclnRBc7xUqR+tjMFR3/ktgv2q94rEy6weNl2J5vPYeffEKwoiyETFyTZWMhbra0orBmUw+IuYDSTJDhIJq4JofUEGFL+eyGMtBX/9YR2yI9bZU0lnXlfi00HULYHP9C9g3P58Tt6ERW3hs4z/4b3MhFjlDp+9M2QHVo4NkkfrtXMwkMucVpCZpuKTjgQNs7x7QBkYdxH3NweEa9tPhZQamRT9RIw45Rg0ymVmUzvo3dAM= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB2888.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(366004)(346002)(396003)(39860400002)(376002)(136003)(451199021)(38100700002)(6486002)(6916009)(316002)(6666004)(478600001)(36756003)(66556008)(66946007)(41300700001)(86362001)(66476007)(186003)(1076003)(8936002)(83380400001)(2616005)(26005)(6512007)(6506007)(8676002)(2906002)(5660300002)(21314003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?9M5Vge8QST4udZ7U0GjwIwyQk4oHF4r3eg7rbdg+7wQ4Zo62oNvXrLS/HR9l?= =?us-ascii?Q?MMbDIQX+KpTELbP+JXgU+S89rTfN2aPkwPukFi0+E+2fiIG+dQben9NDl/Hs?= =?us-ascii?Q?T2GeLM9K/gonPncyJHnLgh/PK8gx8ORi3Vqz/t6qz/RbnUFG6FaeaAzCHC8A?= =?us-ascii?Q?5gwl4uzoJnZrpYXJ3/lxcQfBKEHsWhEgyaf4wsz5GPziuGrXYQSRJIE3E1aI?= =?us-ascii?Q?/QRNuRYSrSH07efUT2KlQeWxbx5To0DdK9luctUD0NUkGNuXoxKS1nkOmgee?= =?us-ascii?Q?3JrPJrqzGJg39BpVXqgTpB4SKJH7D1gtMD+3sggzyZmLJIqpuxfgA6mj94Kn?= =?us-ascii?Q?k/Wczv/g/fHkkdPWp1gjE2DyjdC6ka2q8LAg0K53/+x5tXF6nTnZ7z9PfyGf?= =?us-ascii?Q?zWCaHTaiByBOoi/KuSpVMWCDGP1j0nPVnk91RykTuEU5LmQTeRoWLhKrGOkv?= =?us-ascii?Q?i8U9h075yB/U/wt5RAECnRnCMoV8F02B2UBBVxjZXPsWu+RKkJgd0+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aokGNCZoRlQbLyN3NXvEYXBc8VPfxkqqmbMKvdbJ+XvFlCiX X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5a0f6dd6-3eb8-4e3e-9ecf-08db467c1a5f X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB2888.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2023 17:31:43.7698 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NRoh5GYU6Vq/pr/GGgR0Z2JsjvQZbSTsQo+mJCBlOmyqrIGsVvxrNdTCvCvTO4sz8xps7mI98wQ8T0CE2mnPtdowSp+ucmXGnvums6HJcYs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB5730 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-26_09,2023-04-26_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 phishscore=0 mlxlogscore=935 adultscore=0 suspectscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304260155 X-Proofpoint-GUID: 0yinWvtbCgNB0MqVDska8iVNWSX-kgKD X-Proofpoint-ORIG-GUID: 0yinWvtbCgNB0MqVDska8iVNWSX-kgKD X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This patch expands the GAS manual in order to specify the alternate pseudo-C assembly syntax used in BPF, and now supported by the assembler. gas/ChangeLog: 2023-04-19 Jose E. Marchesi PR gas/29757 * doc/c-bpf.texi (BPF Pseudo-C Syntax): New section. --- gas/ChangeLog | 5 ++ gas/doc/c-bpf.texi | 202 +++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 201 insertions(+), 6 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 88a9d2eff95..2659601f793 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2023-04-19 Jose E. Marchesi + + PR gas/29757 + * doc/c-bpf.texi (BPF Pseudo-C Syntax): New section. + 2023-04-20 Guillermo E. Martinez PR gas/29728 diff --git a/gas/doc/c-bpf.texi b/gas/doc/c-bpf.texi index bb1c452f115..0756796adc9 100644 --- a/gas/doc/c-bpf.texi +++ b/gas/doc/c-bpf.texi @@ -19,6 +19,7 @@ * BPF Syntax:: Syntax * BPF Directives:: Machine Directives * BPF Opcodes:: Opcodes +* BPF Pseudo-C Syntax:: Alternative Pseudo-C Assembly Syntax @end menu @node BPF Options @@ -228,11 +229,11 @@ in @code{%d}. @subsubsection Endianness conversion instructions @table @code -@item endle %d, (8|16|32) -Convert the 8-bit, 16-bit or 32-bit value in @code{%d} to +@item endle %d, (16|32|64) +Convert the 16-bit, 32-bit or 64-bit value in @code{%d} to little-endian. -@item endbe %d, (8|16|32) -Convert the 8-bit, 16-bit or 32-bit value in @code{%d} to big-endian. +@item endbe %d, (16|32|64) +Convert the 16-bit, 32-bit or 64-bit value in @code{%d} to big-endian. @end table @subsubsection 64-bit load and pseudo maps @@ -335,9 +336,9 @@ holds true. @item ja %d,(%s|imm32),disp16 Jump-always. @item jeq %d,(%s|imm32),disp16 -Jump if equal. +Jump if equal, unsigned. @item jgt %d,(%s|imm32),disp16 -Jump if greater. +Jump if greater, unsigned. @item jge %d,(%s|imm32),disp16 Jump if greater or equal. @item jlt %d,(%s|imm32),disp16 @@ -385,3 +386,192 @@ Exchange-and-add a 64-bit value at the specified location. @item xaddw [%d+offset16],%s Exchange-and-add a 32-bit value at the specified location. @end table + +@node BPF Pseudo-C Syntax +@section BPF Pseudo-C Syntax + +This assembler supports another syntax to denote BPF instructions, +which is an alternative to the normal looking syntax documented above. +This alternatative syntax, which we call @dfn{pseudo-C syntax}, is +supported by the LLVM/clang integrated assembler. + +This syntax is very unconventional, but we need to support it in order +to support inline assembly in existing BPF programs. + +Note that the assembler is able to parse sources in which both +syntaxes coexist: some instructions can use the usual assembly like +syntax, whereas some other instructions in the same file can use the +pseudo-C syntax. + +@subsubsection Pseudo-C Register Names + +All BPF registers are 64-bit long. However, in the Pseudo-C syntax +registers can be referred using different names, which actually +reflect the kind of instruction they appear on: + +@table @samp +@item r0..r9 +General-purpose register in an instruction that operates on its value +as if it was a 64-bit value. +@item w0..w9 +General-purpose register in an instruction that operates on its value +as if it was a 32-bit value. +@end table + +@noindent +Note that in the Pseudo-C syntax register names are not preceded by +@code{%} characters. + +@subsubsection Arithmetic instructions + +In all the instructions below, the operations are 64-bit or 32-bit +depending on the names used to refer to the registers. For example +@code{r3 += r2} will perform 64-bit addition, whereas @code{w3 += w2} +will perform 32-bit addition. Mixing register prefixes is an error, +for example @code{r3 += w2}. + +@table @code +@item dst_reg += (imm32|src_reg) +Arithmetic addition. +@item dst_reg -= (imm32|src_reg) +Arithmetic subtraction. +@item dst_reg *= (imm32|src_reg) +Arithmetic multiplication. +@item dst_reg /= (imm32|src_reg) +Arithmetic integer unsigned division. +@item dst_reg %= (imm32|src_reg) +Arithmetic integer unsigned remainder. +@item dst_reg &= (imm32|src_reg) +Bit-wise ``and'' operation. +@item dst_reg |= (imm32|src_reg) +Bit-wise ``or'' operation. +@item dst_reg ^= (imm32|src_reg) +Bit-wise exclusive-or operation. +@item dst_reg <<= (imm32|src_reg) +Left shift, by whatever specified number of bits. +@item dst_reg >>= (imm32|src_reg) +Right logical shift, by whatever specified number of bits. +@item dst_reg s>>= (imm32|src_reg) +Right arithmetic shift, by whatever specified number of bits. +@item dst_reg = (imm32|src_reg) +Move the value in @code{imm32} or @code{src_reg} in @code{dst_reg}. +@item dst_reg = -dst_reg +Arithmetic negation. +@end table + +@subsubsection Endianness conversion instructions + +@table @code +@item dst_reg = le16 src_reg +Convert the 16-bit value in @code{src_reg} to little-endian. +@item dst_reg = le32 src_reg +Convert the 32-bit value in @code{src_reg} to little-endian. +@item dst_reg = le64 src_reg +Convert the 64-bit value in @code{src_reg} to little-endian. +@item dst_reg = be16 src_reg +Convert the 16-bit value in @code{src_reg} to big-endian. +@item dst_reg = be32 src_reg +Convert the 32-bit value in @code{src_reg} to big-endian. +@item dst_reg = be64 src_reg +Convert the 64-bit value in @code{src_reg} to big-endian. +@end table + +@subsubsection 64-bit load and pseudo maps + +@table @code +@item dst_reg = imm64 ll +Load the given signed 64-bit immediate, or pseudo map descriptor, to +the destination register @code{dst_reg}. +@end table + +@subsubsection Load instructions for socket filters + +@table @code +@item r0 = *(u8 *)skb[imm32] +Absolute 8-bit load. +@item r0 = *(u16 *)skb[imm32] +Absolute 16-bit load. +@item r0 = *(u32 *)skb[imm32] +Absolute 32-bit load. +@item r0 = *(u64 *)skb[imm32] +Absolute 64-bit load. +@item r0 = *(u8 *)skb[src_reg + imm32] +Indirect 8-bit load. +@item r0 = *(u16 *)skb[src_reg + imm32] +Indirect 16-bit load. +@item r0 = *(u32 *)skb[src_reg + imm32] +Indirect 32-bit load. +@item r0 = *(u64 *)skb[src_reg + imm32] +Indirect 64-bit load. +@end table + +@subsubsection Generic load/store instructions + +@table @code +@item dst_reg = *(u8 *)(src_reg + offset16) +Generic 8-bit load. +@item dst_reg = *(u16 *)(src_reg + offset16) +Generic 16-bit load. +@item dst_reg = *(u32 *)(src_reg + offset16) +Generic 32-bit load. +@item dst_reg = *(u64 *)(src_reg + offset16) +Generic 64-bit load. +@c XXX stb +@c NO PSEUDOC-SYNTAX +@c XXX sth +@c NO PSEUDOC-SYNTAX +@c XXX stw +@c NO PSEUDOC-SYNTAX +@c XXX stdw +@c NO PSEUDOC-SYNTAX +@item *(u8 *)(dst_reg + offset16) = src_reg +Generic 8-bit store. +@item *(u16 *)(dst_reg + offset16) = src_reg +Generic 16-bit store. +@item *(u32 *)(dst_reg + offset16) = src_reg +Generic 32-bit store. +@item *(u64 *)(dst_reg + offset16) = src_reg +Generic 64-bit store. +@end table + +@subsubsection Jump instructions + +@table @code +@item goto disp16 +Jump-always. +@item if dst_reg == (imm32|src_reg) goto disp16 +Jump if equal. +@item if dst_reg & (imm32|src_reg) goto disp16 +Jump if signed equal. +@item if dst_reg != (imm32|src_reg) goto disp16 +Jump if not equal. +@item if dst_reg > (imm32|src_reg) goto disp16 +Jump if bigger, unsigned. +@item if dst_reg < (imm32|src_reg) goto disp16 +Jump if smaller, unsigned. +@item if dst_reg >= (imm32|src_reg) goto disp16 +Jump if bigger or equal, unsigned. +@item if dst_reg <= (imm32|src_reg) goto disp16 +Jump if smaller or equal, unsigned. +@item if dst_reg s> (imm32|src_reg) goto disp16 +Jump if bigger, signed. +@item if dst_reg s< (imm32|src_reg) goto disp16 +Jump if smaller, signed. +@item if dst_reg s>= (imm32|src_reg) goto disp16 +Jump if bigger or equal, signed. +@item if dst_reg s<= (imm32|src_reg) goto disp16 +Jump if smaller or equal, signed. +@item call imm32 +Jump and link. +@item exit +Terminate the eBPF program. +@end table + +@subsubsection Atomic instructions + +@table @code +@item lock *(u64 *)(dst_reg + offset16) += src_reg +Exchange-and-add a 64-bit value at the specified location. +@item lock *(u32 *)(dst_reg + offset16) += src_reg +Exchange-and-add a 32-bit value at the specified location. +@end table -- 2.30.2