From patchwork Tue Jul 4 09:54:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 9824469 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CF437604D9 for ; Tue, 4 Jul 2017 10:00:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE23228497 for ; Tue, 4 Jul 2017 10:00:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B2BA2284F4; Tue, 4 Jul 2017 10:00:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F064128497 for ; Tue, 4 Jul 2017 10:00:18 +0000 (UTC) Received: from localhost ([::1]:40033 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSKd0-0006Zp-7e for patchwork-qemu-devel@patchwork.kernel.org; Tue, 04 Jul 2017 06:00:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41411) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSKXo-00022I-OS for qemu-devel@nongnu.org; Tue, 04 Jul 2017 05:54:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSKXm-0000Vu-OD for qemu-devel@nongnu.org; Tue, 04 Jul 2017 05:54:56 -0400 Received: from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242]:34397) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dSKXm-0000Te-Hv for qemu-devel@nongnu.org; Tue, 04 Jul 2017 05:54:54 -0400 Received: by mail-lf0-x242.google.com with SMTP id g21so17212172lfk.1 for ; Tue, 04 Jul 2017 02:54:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=67Z8ZrfVmDhA3BsgMCEw0mv+SDYcsVjK+wKrmM/sKe0=; b=kgOqEOvh/ATOB8EWdvNVugc71ZQngjoHewR6ii/cDn3f5oqQi6atX7qoOj8mBMWQqy lHQ8DJZssCIN+q6EEKejNJ+UNBOKx20WxUap5ClE7CHh0I6Ju6/jv13pltuEONm91ykh yWCKMuKlMC2D5mLzENycvKPdCmEy4MnYgVSgg6ZRKGrCJroGMy/tcvxKmPOkbcPAiVjA UL9127YXXn+T+zmAchI7mITJZEicpe1BrkIq6X8UT77SzXvA5VUtRw2WziDrOxC2TsVQ XuYqmTBv9Anq+LLII0l8Yd9h2SjTD8Pa5viqDoi3hVHvwb1uUQO2qqtQcCobLgypxgQE qYCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=67Z8ZrfVmDhA3BsgMCEw0mv+SDYcsVjK+wKrmM/sKe0=; b=CXcsxXrBhmodQ9OXKDBxxMig/DK2vrFm9TipaCPejL5SzA6X60iDNcizLgDLT3URi5 6IX43nqnbXSQKdU5p4wTb68JFMUsn80+DUGPXSFUqTjrmTuIP2rsFJrBSWLZnful+N7I TmegROyh4TMjv9wa8rdXcOYwbId3nucpoxQbIDaQ1DMnkOXg4WIDZv0CBGAvHEpfcuIU FSkj8S/0x/6gBixKZcoprKB5K1CvXzNzYiqUWslHzJserZHGJl+4xBld4DnH5ff06gC0 dSZ3vmCd+A9JNKE3G3KEWQ0OeGQxO9Ug8atmrrnnHuX3gpcFQkMdU73XQPgqFxIsKcb/ C6Vg== X-Gm-Message-State: AIVw111MRzj1IQvmWDovx6TDhCbYoCVwSs3ZI1IbOyRNUbngqNkoJgjp AB4AaJsUBNY0Ea93 X-Received: by 10.46.84.72 with SMTP id y8mr1665780ljd.101.1499162091486; Tue, 04 Jul 2017 02:54:51 -0700 (PDT) Received: from localhost (81-231-233-234-no56.tbcn.telia.com. [81.231.233.234]) by smtp.gmail.com with ESMTPSA id m16sm3063781ljb.26.2017.07.04.02.54.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Jul 2017 02:54:50 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Tue, 4 Jul 2017 11:54:32 +0200 Message-Id: <1499162088-1562-2-git-send-email-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499162088-1562-1-git-send-email-edgar.iglesias@gmail.com> References: <1499162088-1562-1-git-send-email-edgar.iglesias@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::242 Subject: [Qemu-devel] [PULL v1 01/17] disas/microblaze: Add missing 'const' attributes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sai.pavan.boddu@xilinx.com, edgar.iglesias@xilinx.com, alistai@xilinx.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Stefan Weil Making the opcode list 'const' saves memory. Some function arguments and local variables needed 'const', too. Add also 'static' to two local functions. Reviewed-by: Edgar E. Iglesias Signed-off-by: Stefan Weil [EI: Removed old prototypes to fix the build] Signed-off-by: Edgar E. Iglesias --- disas/microblaze.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/disas/microblaze.c b/disas/microblaze.c index 7795a0b..598ecbc 100644 --- a/disas/microblaze.c +++ b/disas/microblaze.c @@ -272,7 +272,7 @@ enum microblaze_instr_type { #define MAX_OPCODES 280 -static struct op_code_struct { +static const struct op_code_struct { const char *name; short inst_type; /* registers and immediate values involved */ short inst_offset_type; /* immediate vals offset from PC? (= 1 for branches) */ @@ -596,10 +596,6 @@ static char * get_field_imm15 (long instr); #if 0 static char * get_field_unsigned_imm (long instr); #endif -char * get_field_special (long instr, struct op_code_struct * op); -unsigned long read_insn_microblaze (bfd_vma memaddr, - struct disassemble_info *info, - struct op_code_struct **opr); static char * get_field (long instr, long mask, unsigned short low) @@ -664,8 +660,8 @@ get_field_unsigned_imm (long instr) } */ -char * -get_field_special (long instr, struct op_code_struct * op) +static char * +get_field_special(long instr, const struct op_code_struct *op) { char tmpstr[25]; char spr[6]; @@ -729,14 +725,14 @@ get_field_special (long instr, struct op_code_struct * op) return(strdup(tmpstr)); } -unsigned long +static unsigned long read_insn_microblaze (bfd_vma memaddr, struct disassemble_info *info, - struct op_code_struct **opr) + const struct op_code_struct **opr) { unsigned char ibytes[4]; int status; - struct op_code_struct * op; + const struct op_code_struct *op; unsigned long inst; status = info->read_memory_func (memaddr, ibytes, 4, info); @@ -772,7 +768,7 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) fprintf_function fprintf_func = info->fprintf_func; void * stream = info->stream; unsigned long inst, prev_inst; - struct op_code_struct * op, *pop; + const struct op_code_struct *op, *pop; int immval = 0; bfd_boolean immfound = FALSE; static bfd_vma prev_insn_addr = -1; /*init the prev insn addr */