From patchwork Thu Oct 17 05:03:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1178295 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) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46txsF14Yvz9sPJ for ; Thu, 17 Oct 2019 16:04:01 +1100 (AEDT) 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="i/xDUwlE"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46txsD1ywbzDr7F for ; Thu, 17 Oct 2019 16:04:00 +1100 (AEDT) X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46txs70gc5zDqPf for ; Thu, 17 Oct 2019 16:03:55 +1100 (AEDT) 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="i/xDUwlE"; 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 46txs63VM4z9sP3; Thu, 17 Oct 2019 16:03:54 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1571288634; bh=BzvPblbh2pYwXWnxQmoNIkFU0qfgLeWLvUl/QPMwobo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i/xDUwlEsdtwxQIzdGTxQCzyG58e3YXKakF+RCkYRrTTrv+WPfCPk+4/zTEoQ8oB8 aQmhSdk5mT1TbG0+Ugw+ZH9GLrqs2toTjNlA7Xf/IXUtPAjHt2XxdPrSXhjKylNBu2 myJ1QWEvUJ686bz97y/N2uwXoKxggZtWjECXbW7vgR78YCqQUC55VCn1I51lzju80e /nxyX1CBTwhDbfbMoPZ3z2kpkwpylIhbgFscdyfMhFru3/zgv7rYSA6D9qcsCRUuFA QI4xxaydUaElYM7B0g53Ilm3ENwqiW3tLSvKKP6IZxRF39AMh8QdGt0woHEC4faMyj l3Fq/CGz6wUnQ== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Thu, 17 Oct 2019 16:03:48 +1100 Message-Id: <20191017050350.26820-2-amitay@ozlabs.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191017050350.26820-1-amitay@ozlabs.org> References: <20191017050350.26820-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH v2 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 7a3c8f3..810d42e 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("pib", target) {