From patchwork Thu Jul 4 08:11:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1127404 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45fW0H53GPz9s4Y for ; Thu, 4 Jul 2019 18:11:43 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="n7ysUVMg"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 45fW0H0BsBzDqZl for ; Thu, 4 Jul 2019 18:11:43 +1000 (AEST) X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 45fW093cDnzDqPm for ; Thu, 4 Jul 2019 18:11:37 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="n7ysUVMg"; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (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) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 45fW0870swz9s4Y; Thu, 4 Jul 2019 18:11:36 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1562227897; bh=OX5Dege/z3KwsjL9/PTBSR7ePBv4SGwthVbA+erpxCc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n7ysUVMg8yX3BleBSe/cMCn/Ko/AtM55sLXxrDhez9RzQ4QqorREywB3Fwr0P3yWz U3X4HvtxONunyncqTXUApFWEJzKWTvSb5iwCw/1XeNxtp7ZsuiAPOpB/x3g7QuYWe8 Ig3zA65dE25j04BweOzPdb44jYWy+2Rmfc8JPcYr7PWlSuyA0mBS5I2lI7BlFwV/VC DbQPKolh4qAqAGawMVtwB3c2lagoUGzmNQYXjbLvm25b4ELCDJk+SDMgLRYjjYDbw6 5EVA3K67LA2+PkjoAvWO8pb9UreCbdfAd1h4dL9M2wSCqfZBssbwK8TUNgZBQWRTPT T3vVxlC0AmpFw== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Thu, 4 Jul 2019 18:11:31 +1000 Message-Id: <20190704081133.7818-2-amitay@ozlabs.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190704081133.7818-1-amitay@ozlabs.org> References: <20190704081133.7818-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 1/3] istep: Add checking for istep major/minor numbers X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "mailing list for https://github.com/open-power/pdbg development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Amitay Isaacs Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Signed-off-by: Amitay Isaacs --- src/istep.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/istep.c b/src/istep.c index 08a6215..a9acbe7 100644 --- a/src/istep.c +++ b/src/istep.c @@ -20,18 +20,40 @@ #include "optcmd.h" #include "path.h" +struct istep_data { + int major; + int minor_first; + int minor_last; +} istep_data[] = { + { 2, 2, 17 }, + { 3, 1, 22 }, + { 4, 1, 34 }, + { 5, 1, 2 }, + { 0, 0, 0 }, +}; + static int istep(uint32_t major, uint32_t minor) { struct pdbg_target *target; - int count = 0; + int count = 0, i; if (major < 2 || major > 5) { fprintf(stderr, "Istep major should be 2 to 5\n"); return 0; } - if (major == 2 && minor == 1) { - fprintf(stderr, "Istep 2 minor should be > 1\n"); - return 0; + + for (i=0; istep_data[i].major != 0; i++) { + if (istep_data[i].major != major) + continue; + + if (minor < istep_data[i].minor_first || + minor > istep_data[i].minor_last) { + fprintf(stderr, "Istep %d minor should be %d to %d\n", + major, + istep_data[i].minor_first, + istep_data[i].minor_last); + return 0; + } } for_each_path_target_class("sbefifo", target) {