From nobody Fri Jun 9 19:57:54 2023 X-Original-To: dev-commits-src-branches@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 4QdBhL58gXz4cKXv; Fri, 9 Jun 2023 19:57:54 +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 4QdBhL4T2Yz4Hly; Fri, 9 Jun 2023 19:57:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686340674; 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=m1MCtNryZtyyk89xKNxySGUAaWkaa+T36rkB+ab8qbk=; b=YvWo372Oq4VsWfU2zfTj24vfZbonfP+2kTT3aLVIRPb619MdAzCre+ax2NXpwwLcJ+AuJp kaqP/2TV72heYkFXJlhVWpIKrtuytkQZFw3wcc6tGut8pqpD29oVkCK4RqGnMo9lN6O4b4 vDNDRyCUI+9hdyGb4mnHKs309Dx5jRkKv6htO+aLg6fgAdhk88YNatumQp2Kfgxrz0GKGp hsXLgNtdXNrOage/pBUynuCATF3RerVkYgPIHy9Aityj1ifWnTDh/tFptYxJ3odj0jYO1H UsYCTk7+GtVutJoE+J2aaPCAxtmw+p5wSPv10s2pkUkFSEFFeQvR1ghR6rVIVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686340674; 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=m1MCtNryZtyyk89xKNxySGUAaWkaa+T36rkB+ab8qbk=; b=USGGss07sG4OQlSRamNK2dkiXc9FoP9u19I94ReRtk4JmpiOh1nswZ7Pz842f3GGnSOUCt ULchJGGlvooJ84TSp2PTRNoFb56aFHZityTIrgCSWTB0h4rzD1e9pHumc1C999jWpnygLc TQtbhuybeksquhqJ3sTPSqoz3R/4u0FJ+s8Qy7VSwjY28LB//kDiKS6EP+z5FgYD2k6IIy /hkVZCpu+Rwvo1WmNGU/M5n35B27odV1NAyazBgqlnavHsTQjzdXV9K3FXru4PRZXKNHUN 2ufO3Afka/J2453lCvvZe9tGl8l2102mwKWzYynBDhWMdZynx8WGAVjZdfYM3g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686340674; a=rsa-sha256; cv=none; b=NYPEasUyLLHz2In1p0OQ6m/rKJGyKq/5RvgNsDkEZOhhX6WHxijkiuB7IQS3t+9vtsJYRW 21n0tHtG/4+wvjrxwymwQOALzmu/rBqCwekfA4DiYyiop1+ajjj2ZkxnjZy7+04e51cAoU abycd6f+Ns3OiH5qFzsqz57fpoG8ps35GVNnV8vIeQa9k7PFzHTzNSbx7FYiIwTTj2Z2OW TAvAfJXRl+TUZWG5E/Oo1qo7mXA4OmnYNjXt+RntRig7YArWXRQEmrciSyAiHSLhpT37GT W5naiRlV/JEbtfXzHPnBrZq1NtlfNeZvqf+xyxdntykVd+SP2MyZU4WOtw0YNg== 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 4QdBhL3PzWznW1; Fri, 9 Jun 2023 19:57:54 +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 359Jvs54071885; Fri, 9 Jun 2023 19:57:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 359JvsY5071884; Fri, 9 Jun 2023 19:57:54 GMT (envelope-from git) Date: Fri, 9 Jun 2023 19:57:54 GMT Message-Id: <202306091957.359JvsY5071884@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 8a226e8cabee - stable/13 - arm64/disassem.c: style and formatting List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 8a226e8cabeeb8b022cc42245115ef7a1da3ce86 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=8a226e8cabeeb8b022cc42245115ef7a1da3ce86 commit 8a226e8cabeeb8b022cc42245115ef7a1da3ce86 Author: Mykola Hohsadze AuthorDate: 2023-04-18 15:50:33 +0000 Commit: Mitchell Horne CommitDate: 2023-06-09 18:14:57 +0000 arm64/disassem.c: style and formatting Reviewed by: mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D38899 (cherry picked from commit 5b61ad4b005d73b497537fcb41e3557314d18ddd) --- 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);