From nobody Tue Apr 25 20:23:38 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Q5YNp225jz46g29; Tue, 25 Apr 2023 20:23:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Q5YNp1WKBz3DwN; Tue, 25 Apr 2023 20:23:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682454218; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rJktm9YvV7vif+joMG658SMtmLeZhRg0oeN/ANE3KLY=; b=YyWMjBkd6oWFm5rXcROWDBwahIRaZ/qFiko/hecY4egsrrbVhVCnZW+0BHpW48/xdzR8xH 2g+y5IisZf0QSvDhhIn+TEbpT6L/AETQ5LH6NysDabQm0GZeQlxCWJ7jX5l4l7qELe5sb1 /SknczU3mnb4sq26wq5mFbACi6QNwGtFcWUg/jIM4l307noeKnb9VaBnEJB5/jGOqD5b28 hpzzVlcRPIl0/sVuGeH9cN12YfSEzYSoBfa3LuLAkpM9crHhjJRvpW863XDf+ALjqLs4Wg pReMNJJKi2kNR6Z8JTjpS+ChH7oxMPHVY8gxmfO/KeP2uF9Yj1ky2ktRvndNQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682454218; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rJktm9YvV7vif+joMG658SMtmLeZhRg0oeN/ANE3KLY=; b=mHiLU3sObqZa4htR5zMl/G4JfmT86hyzJI5gjAuiVbMQrYNbvtJkPDo0C5UM/F8i8Igfe8 aZbA/Xe7ehTnn4VXcKNFeGzJcP4DhQikHkDNK+ffZxbqajTyKhh6X7NBovz8QPrfEZwluZ uONInhqjCia6GXvJjzM8AeNetMxV1dEGKaB48FteQVrepkNh3EvhVBnJ5nxAjYdVPGLzve 49vIaJKcl+AKLvyjGpQCe6EfhONVeXEJk3leVzj7mRWn2KiLiHNXCkqI3PhnJIPvNvSYXx etPhVRXUuPKGxWKV6wySTKvYFGuoCSNAJQb8/UofER0fQ56kYiPHmhU/cu9cSA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1682454218; a=rsa-sha256; cv=none; b=vaoXp0yeyR+ihFyk3jYpVTtdTcJrYv6kALfmt+OooqaseaKHp34PwEiFFD9uJwy35++nfO YsJDwLjOdaf+jE1jBGOPRl0dk0omKRFtvSM/XKDBl3sycqEYa/izafE7G3BaqCXOzi1rfY TM28Ban91Iywa/z7l8lcOugpPFIGpZdgW3hHuA/kXo2sO+CaiRKsuxxpxBHx1Y0Fu/OBF0 s70hkhxLENrlONUXDZyzTQT7i0AFESm3BggQZVK04cMGDAmkH4vvZKNcQyn0gshoQ7U9QA JYaTuoVfZmfl3TOQrB/kK5EnsWhg7r6XBowitvVnEbasX03suFpHCXnocpboHg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Q5YNp0bpvz1LSP; Tue, 25 Apr 2023 20:23:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 33PKNcml025532; Tue, 25 Apr 2023 20:23:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33PKNc0S025531; Tue, 25 Apr 2023 20:23:38 GMT (envelope-from git) Date: Tue, 25 Apr 2023 20:23:38 GMT Message-Id: <202304252023.33PKNc0S025531@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 5b61ad4b005d - main - arm64/disassem.c: style and formatting List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5b61ad4b005d73b497537fcb41e3557314d18ddd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=5b61ad4b005d73b497537fcb41e3557314d18ddd commit 5b61ad4b005d73b497537fcb41e3557314d18ddd Author: Mykola Hohsadze AuthorDate: 2023-04-18 15:50:33 +0000 Commit: Mitchell Horne CommitDate: 2023-04-25 20:23:15 +0000 arm64/disassem.c: style and formatting Reviewed by: mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D38899 --- sys/arm64/arm64/disassem.c | 75 +++++++++++++++++++++++++++++----------------- 1 file changed, 48 insertions(+), 27 deletions(-) diff --git a/sys/arm64/arm64/disassem.c b/sys/arm64/arm64/disassem.c index ce0bf7660b02..681164011b40 100644 --- a/sys/arm64/arm64/disassem.c +++ b/sys/arm64/arm64/disassem.c @@ -28,11 +28,13 @@ #include __FBSDID("$FreeBSD$"); -#include +#include #include -#include + #include +#include + #include #define ARM64_MAX_TOKEN_LEN 8 @@ -82,12 +84,21 @@ struct arm64_insn_token { * Define generic types for instruction printing. */ enum arm64_format_type { - TYPE_01, /* OP , , {, #} SF32/64 - OP , , #{, } SF32/64 */ - TYPE_02, /* OP , [, #]{!}] SF32/64 - OP , [], #{!} SF32/64 - OP , , {, EXTEND AMOUNT } */ - TYPE_03, /* OP , #imm SF32/64 */ + /* + * OP , , {, #imm} SF32/64 + * OP , , #{, } SF32/64 + */ + TYPE_01, + + /* + * OP , [, #]{!} SF32/64 + * OP , [], #{!} SF32/64 + * OP , , {, EXTEND AMOUNT } + */ + TYPE_02, + + /* OP , #imm SF32/64 */ + TYPE_03, }; /* @@ -101,8 +112,8 @@ enum arm64_format_type { * tokens - array of tokens (operands) inside instruction */ struct arm64_insn { - char* name; - char* format; + char *name; + char *format; enum arm64_format_type type; uint64_t special_ops; uint32_t mask; @@ -202,7 +213,7 @@ arm64_disasm_generate_masks(struct arm64_insn *tab) */ a = (INSN_SIZE * NBBY) - 1; while (*format != '\0' && (a >= 0)) { - switch(*format) { + switch (*format) { case '0': /* Bit is 0, add to mask and pattern */ mask |= (1 << a); @@ -230,7 +241,8 @@ arm64_disasm_generate_masks(struct arm64_insn *tab) i++; format++; if (i >= ARM64_MAX_TOKEN_LEN) { - printf("ERROR: token too long in op %s\n", + printf("ERROR: " + "token too long in op %s\n", tab->name); error = 1; break; @@ -243,7 +255,8 @@ arm64_disasm_generate_masks(struct arm64_insn *tab) ret = sscanf(format, "(%d)", &len); if (ret == 1) { if (token >= ARM64_MAX_TOKEN_CNT) { - printf("ERROR: to many tokens in op %s\n", + printf("ERROR: " + "too many tokens in op %s\n", tab->name); error = 1; break; @@ -357,7 +370,7 @@ disasm(const struct disasm_interface *di, vm_offset_t loc, int altfmt) while (i_ptr->name) { /* If mask is 0 then the parser was not initialized yet */ if ((i_ptr->mask != 0) && - ((insn & i_ptr->mask) == i_ptr->pattern)) { + ((insn & i_ptr->mask) == i_ptr->pattern)) { matchp = 1; break; } @@ -388,14 +401,17 @@ disasm(const struct disasm_interface *di, vm_offset_t loc, int altfmt) /* Print opcode by type */ switch (i_ptr->type) { case TYPE_01: - /* OP , , {, #} SF32/64 - OP , , #{, } SF32/64 */ + /* + * OP , , {, #} SF32/64 + * OP , , #{, } SF32/64 + */ /* Mandatory tokens */ ret = arm64_disasm_read_token(i_ptr, insn, "RD", &rd); ret |= arm64_disasm_read_token(i_ptr, insn, "RN", &rn); if (ret != 0) { - printf("ERROR: Missing mandatory token for op %s type %d\n", + printf("ERROR: " + "Missing mandatory token for op %s type %d\n", i_ptr->name, i_ptr->type); goto undefined; } @@ -420,15 +436,18 @@ disasm(const struct disasm_interface *di, vm_offset_t loc, int altfmt) } break; case TYPE_02: - /* OP , [, #]{!}] SF32/64 - OP , [], #{!} SF32/64 - OP , , {, EXTEND AMOUNT } */ + /* + * OP , [, #]{!}] SF32/64 + * OP , [], #{!} SF32/64 + * OP , , {, EXTEND AMOUNT } + */ /* Mandatory tokens */ ret = arm64_disasm_read_token(i_ptr, insn, "RT", &rt); ret |= arm64_disasm_read_token(i_ptr, insn, "RN", &rn); if (ret != 0) { - printf("ERROR: Missing mandatory token for op %s type %d\n", + printf("ERROR: " + "Missing mandatory token for op %s type %d\n", i_ptr->name, i_ptr->type); goto undefined; } @@ -464,7 +483,8 @@ disasm(const struct disasm_interface *di, vm_offset_t loc, int altfmt) break; } - di->di_printf("%s\t%s, ", i_ptr->name, arm64_reg(sf, rt)); + di->di_printf("%s\t%s, ", i_ptr->name, + arm64_reg(sf, rt)); if (inside != 0) { di->di_printf("[%s", arm64_reg(1, rn)); if (imm != 0) @@ -516,7 +536,8 @@ disasm(const struct disasm_interface *di, vm_offset_t loc, int altfmt) /* Mandatory tokens */ ret = arm64_disasm_read_token(i_ptr, insn, "RT", &rt); if (ret != 0) { - printf("ERROR: Missing mandatory token for op %s type %d\n", + printf("ERROR: " + "Missing mandatory token for op %s type %d\n", i_ptr->name, i_ptr->type); goto undefined; } @@ -533,13 +554,13 @@ disasm(const struct disasm_interface *di, vm_offset_t loc, int altfmt) } di->di_printf("\n"); - return(loc + INSN_SIZE); + return (loc + INSN_SIZE); undefined: di->di_printf("undefined\t%08x\n", insn); - return(loc + INSN_SIZE); + return (loc + INSN_SIZE); } /* Parse format strings at the very beginning */ -SYSINIT(arm64_disasm_generate_masks, SI_SUB_DDB_SERVICES, - SI_ORDER_FIRST, arm64_disasm_generate_masks, arm64_i); +SYSINIT(arm64_disasm_generate_masks, SI_SUB_DDB_SERVICES, SI_ORDER_FIRST, + arm64_disasm_generate_masks, arm64_i);