From patchwork Wed Jun 5 21:15:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 801646 Delivered-To: patch@linaro.org Received: by 2002:a5d:5610:0:b0:35b:5a80:51b4 with SMTP id l16csp37232wrv; Wed, 5 Jun 2024 14:18:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWw2hx131+q9Oy6A5/IPwBL/bpcJ+q1/WBUPig0sowv4D0+3qO454bCpH1OJt93Ww+5PJwnxwNBY6yMN9LuX868 X-Google-Smtp-Source: AGHT+IEr9F8ObJBzgVbuub1fesWrCj4amn4xgl7ZKosaKsQAQkSKO4Xldhk4KgenxRrLs2N78DUl X-Received: by 2002:aca:1712:0:b0:3c9:6c32:b1ec with SMTP id 5614622812f47-3d2043dc3a0mr3831426b6e.56.1717622335765; Wed, 05 Jun 2024 14:18:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717622335; cv=none; d=google.com; s=arc-20160816; b=rJqiKc9HWhCG2xeXof0RcEIDhfr69VML0SYaKxfW0uM9ChwBRDQ6ok0O1l6m41W9rm 8wgkMQXEWm0sMXsfmJQ3ZW9oV1MsAOtbobuafokG70qZsgmKiSivxdk+Xe/xGd3Po6KR YpQXj3Zvj+ZRnKzHiUby/Uch9okvBlMkWtCmN2j2RTHcy9PMKLHqbjVZN4U3NEiCenN2 M3twX/V8lB96tK4DzfkzZKpw8kdbfaDDTETWGXrfuaCtgH4V3LiW9BLOU+Wc+UY5vRGp EXKRbNfYPjCUtn8yoV9HSjONMG65+f7JeNdeJoKlVdy1PvgR8XM4gpa3jzRIYQ1Mnu5x gaHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9ILfcAsPqRhnr4sSxUgoQKpIDcJ0mZe41RgVmdO69OU=; fh=vm85eyWrvOAHduw3sqEA+cYBqvHB7M0MHFcRJg7VWOo=; b=uwD9K7zg4S3cWnFbvMgxEtH9uW43DohcUyl/7f/2rs8HVtyhUDMDG+ojy5B0mP525r LL8DrKDVO37j6I/Z7PusJ57yC7wdES7Fl55EJgksW6saugGCGSEr7Rwp56wk4syGoAMZ umoIuBixbJyXkt6FD9hvZqEIGBDFYFnkMfCnl5o47JVx3eIYmALsye9x0tOey7RmdN6i SXH36e+vMHla32xea8Xqsb1jE0V2+odPejG5IVOCk8gNB0RSEyOU2IzWUWk7ONSS7d42 C7RVR9+FZvkbl6X2LXEE69xFeUDnjuU+/kJh9PxA7vX7oKyPqPP8+uHjoTcGSKjm9kDd +dkw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AaOZDN0y; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-794f4d91d24si1483611085a.193.2024.06.05.14.18.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Jun 2024 14:18:55 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AaOZDN0y; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sExz6-0000gj-84; Wed, 05 Jun 2024 17:15:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sExz0-0000ef-Jo for qemu-devel@nongnu.org; Wed, 05 Jun 2024 17:15:47 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sExys-0003RX-TW for qemu-devel@nongnu.org; Wed, 05 Jun 2024 17:15:46 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-702508bf0a9so216624b3a.0 for ; Wed, 05 Jun 2024 14:15:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717622135; x=1718226935; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9ILfcAsPqRhnr4sSxUgoQKpIDcJ0mZe41RgVmdO69OU=; b=AaOZDN0yCNLi5u/+tRV8i+SsIbW47qvnsEqfvrN+5wHqzabQQMp4a4EJ8DpSycvVVt tXfSIUraUvaXy6jcUFR2xEhtksukQhMkYdZGiAN2mkssdqoXFOdSUTnZMusHMfmZEsAP +AokTYImaTFoA08Zv8Wtm/Gm2hxLamS54sQXMJSEcNKyE0kJ4i837aV0iYnkcUcRzSxp c0zb/lGYyl/oMb84I/kSSxckue3KU7lRq6aoAYTbuon30ln/nYC0HBU0tcFTD70YsRb5 ze3tzI3BSJzrQg/mzbBZXzReqNRJYSRB9YCQSp+jRl9UilqkSWsA5LYYk/eNHFTi+pX5 paCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717622135; x=1718226935; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9ILfcAsPqRhnr4sSxUgoQKpIDcJ0mZe41RgVmdO69OU=; b=MkuGYElfx3JiV/oiEsYlKYDfUwIzYIOwGRVlaNZjL4VuvjLjKAMyOL6PlgJ1FtKWlc gZoHQcbqxJ7dJ+CURPiidvtEEfhFpP1e3A85hdceUySNguMR83oQ4lVKYqvyBWbOnxqW kjfiTgYbXzO8PX+3UXBlpNqNtao3KgLA0FRDwNts/NykL7By50z652ZwN6vLB7IyjJQL mt830XpSt1SPQtnnOSQ4njF2qXRgUIZKguE+xWyb1vt8GF5IOjoP1wl3j3pV2Hd5yjjb /JJ5E/ZzN79rNYmg6LCBAJSYiFQK0u+ryIP5J+4NOcDyrEV/Zao5Kq/pYKn8WMAgZF5h kM2w== X-Gm-Message-State: AOJu0YwCo+O2E1/DRZtYrvREHarzjbYbisio2VJ0qwbabSaN7BaKJBsY XxOZjBLAV7ToDO/3dfq0GtVgvz2OTBcLsLP7pVcXGvpvmALiwFfAbShITQHDPegAcBBMPECsaPv L X-Received: by 2002:a05:6a00:99d:b0:6f3:ecdc:220e with SMTP id d2e1a72fcca58-703e5a249e0mr4497949b3a.24.1717622135494; Wed, 05 Jun 2024 14:15:35 -0700 (PDT) Received: from stoup.. ([71.212.132.216]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70242aec7d0sm9347538b3a.99.2024.06.05.14.15.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 14:15:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 14/16] disas/microblaze: Print registers directly with PRIrfsl Date: Wed, 5 Jun 2024 14:15:19 -0700 Message-Id: <20240605211521.577094-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240605211521.577094-1-richard.henderson@linaro.org> References: <20240605211521.577094-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use a printf format instead of sprintf into a buffer. Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier Message-Id: <20240412073346.458116-20-richard.henderson@linaro.org> --- disas/microblaze.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/disas/microblaze.c b/disas/microblaze.c index 390f98c0a3..24febfdea9 100644 --- a/disas/microblaze.c +++ b/disas/microblaze.c @@ -564,7 +564,6 @@ static const struct op_code_struct { /* prefix for register names */ #define register_prefix "r" -static const char fsl_register_prefix[] = "rfsl"; static const char pvr_register_prefix[] = "rpvr"; @@ -580,11 +579,13 @@ static const char pvr_register_prefix[] = "rpvr"; #include "disas/dis-asm.h" #define PRIreg register_prefix "%ld" +#define PRIrfsl register_prefix "fsl%ld" #define PRIimm "%d" #define get_field_rd(instr) ((instr & RD_MASK) >> RD_LOW) #define get_field_r1(instr) ((instr & RA_MASK) >> RA_LOW) #define get_field_r2(instr) ((instr & RB_MASK) >> RB_LOW) +#define get_field_rfsl(instr) (instr & RFSL_MASK) #define get_field_imm(instr) ((int16_t)instr) #define get_field_imm5(instr) ((int)instr & IMM5_MASK) #define get_field_imm15(instr) ((int)instr & IMM15_MASK) @@ -592,19 +593,6 @@ static const char pvr_register_prefix[] = "rpvr"; #define get_int_field_imm(instr) ((instr & IMM_MASK) >> IMM_LOW) #define get_int_field_r1(instr) ((instr & RA_MASK) >> RA_LOW) -/* Local function prototypes. */ - -static char * get_field_rfsl (long instr); - -static char * -get_field_rfsl (long instr) -{ - char tmpstr[25]; - snprintf(tmpstr, sizeof(tmpstr), "%s%d", fsl_register_prefix, - (short)((instr & RFSL_MASK) >> IMM_LOW)); - return(strdup(tmpstr)); -} - /* char * get_field_special (instr) @@ -803,11 +791,11 @@ print_insn_microblaze(bfd_vma memaddr, struct disassemble_info *info) get_field_imm5(inst)); break; case INST_TYPE_RD_RFSL: - fprintf_func(stream, "%s\t" PRIreg ", %s", + fprintf_func(stream, "%s\t" PRIreg ", " PRIrfsl, op->name, get_field_rd(inst), get_field_rfsl(inst)); break; case INST_TYPE_R1_RFSL: - fprintf_func(stream, "%s\t" PRIreg ", %s", + fprintf_func(stream, "%s\t" PRIreg ", " PRIrfsl, op->name, get_field_r1(inst), get_field_rfsl(inst)); break; case INST_TYPE_RD_SPECIAL: @@ -879,7 +867,7 @@ print_insn_microblaze(bfd_vma memaddr, struct disassemble_info *info) op->name, get_field_rd(inst)); break; case INST_TYPE_RFSL: - fprintf_func(stream, "%s\t%s", + fprintf_func(stream, "%s\t" PRIrfsl, op->name, get_field_rfsl(inst)); break; default: