From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail.phytec.de ([217.6.246.34] helo=root.phytec.de) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZIBSr-0002NY-C6 for barebox@lists.infradead.org; Thu, 23 Jul 2015 08:02:51 +0000 Received: from idefix.phytec.de (idefix.phytec.de [172.16.0.10]) by root.phytec.de (Postfix) with ESMTP id 20AAEA0045B for ; Thu, 23 Jul 2015 10:04:06 +0200 (CEST) From: Daniel Schultz Date: Thu, 23 Jul 2015 10:01:32 +0200 Message-Id: <1437638492-12290-1-git-send-email-d.schultz@phytec.de> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH v1] commands: Add dhrystone To: barebox@lists.infradead.org VGhpcyB0b29sIHdpbGwgaGVscCB0byBtZWFzdXJlIHRoZSBzeXN0ZW0gcGVyZm9ybWFuY2UuCgpT b21lIFNvQ3MgaGF2ZW4ndCB0aGUgcG9zc2liaWxpdHkgdG8gcm91dGUgdGhlaXIgY2xvY2tzIHRv IHRoZSBvdXRwdXQgcGlucy4KU28geW91IGNhbiB1c2UgZGhyeXN0b25lIHRvIGdldCBhIGZlZWRi YWNrIGFib3V0IHRoZSBjbG9jayBzcGVlZC4KClNpZ25lZC1vZmYtYnk6IERhbmllbCBTY2h1bHR6 IDxkLnNjaHVsdHpAcGh5dGVjLmRlPgotLS0KCkNoYW5nZXM6Cgl2MToKCWFwcGxpZWQgUkZDIHN1 Z2dlc3Rpb25zOgoJCS1yZW1vdmVkICdkZWZhdWx0IG4nIGluIEtjb25maWcKCQktcmVmYWN0b3Jl ZCB0aW1lIGRlZmluZXMgd2l0aCBkZWZhdWx0IHRpbWUgdW5pdHMKCQktb25seSBwcmludCB2YXJp YWJsZSB2YWx1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Qgb2YgdmFyaWFibGVzIGZvciB0aW1lIG1lYXN1cmVtZW50ICovCisKK2VudW0gaWRlbnRz IGNvbXBhcmVfY2hhcnMoY2hhciBjaGFyXzEsIGNoYXIgY2hhcl8yKQoreworCWlmIChjaGFyXzEg IT0gY2hhcl8yKSB7CisJCXJldHVybiBpZGVudF8xOworCX0gZWxzZSB7IC8qIHNob3VsZCBub3Qg ZXhlY3V0ZWQgKi8KKwkJY2hhcl8xX2dsb2IgPSBjaGFyXzE7CisJCXJldHVybiBpZGVudF8yOwor CX0KK30KKworYm9vbCBjb21wYXJlX3N0cnMoY2hhciBzdHJfMVszMV0sIGNoYXIgc3RyXzJbMzFd KQoreworCWludCBvZmZzZXQ7CisKKwlvZmZzZXQgPSAyOworCXdoaWxlIChvZmZzZXQgPD0gMikK KwkJaWYgKGNvbXBhcmVfY2hhcnMoc3RyXzFbb2Zmc2V0XSwgc3RyXzJbb2Zmc2V0KzFdKSA9PSBp ZGVudF8xKQorCQkJKytvZmZzZXQ7CisJaWYgKHN0cmNtcChzdHJfMSwgc3RyXzIpID4gMCkgewor CQlpbnRfZ2xvYiA9IG9mZnNldCArIDc7CisJCXJldHVybiB0cnVlOworCX0gZWxzZSB7CisJCXJl dHVybiBmYWxzZTsKKwl9CisKK30KKworYm9vbCBjaGVja19pZGVudChlbnVtIGlkZW50cyBpZGVu dCkKK3sKKwlpZiAoaWRlbnQgPT0gaWRlbnRfMykKKwkJcmV0dXJuIHRydWU7CisJZWxzZQorCQly ZXR1cm4gZmFsc2U7Cit9CisKK3ZvaWQgcHJvY183KGludCBpbnB1dF8xLCBpbnQgaW5wdXRfMiwg aW50ICpvdXQpCit7CisJKm91dCA9IGlucHV0XzIgKyBpbnB1dF8xICsgMjsKK30KKwordm9pZCBw cm9jXzYoZW51bSBpZGVudHMgaWRlbnQsIGVudW0gaWRlbnRzICppZGVudF9vdXQpCit7CisJKmlk ZW50X291dCA9IGlkZW50OworCWlmICghY2hlY2tfaWRlbnQoaWRlbnQ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luZXh0X3JlY29yZC0+dmFyaWFudC52YXJfMS5pbnRfY29tcCA9IDY7CisJCXByb2NfNihy ZWNvcmQtPnZhcmlhbnQudmFyXzEuZW51bV9jb21wLAorCQkJJm5leHRfcmVjb3JkLT52YXJpYW50 LnZhcl8xLmVudW1fY29tcCk7CisJCW5leHRfcmVjb3JkLT5wdHJfY29tcCA9IHJlY29yZF9nbG9i LT5wdHJfY29tcDsKKwkJcHJvY183KG5leHRfcmVjb3JkLT52YXJpYW50LnZhcl8xLmludF9jb21w LCAxMCwKKwkJCSZuZXh0X3JlY29yZC0+dmFyaWFudC52YXJfMS5pbnRfY29tcCk7CisJfSBlbHNl IHsgLyogbm90IGV4ZWN1dGVkICovCisJCSpyZWNvcmQgPSAqcmVjb3JkLT5wdHJfY29tcDsKKwl9 Cit9CisKK3ZvaWQgcHJvY18yKGludCAqb3V0KQoreworCWlmIChjaGFyXzFfZ2xvYiA9PSAnQScp CisJCSpvdXQgPSAqb3V0ICsgOSAtIGludF9nbG9iOworfQorCit2b2lkIHByb2NfNCh2b2lkKQor eworCWJvb2xfZ2xvYiA9IChjaGFyXzFfZ2xvYiA9PSAnQScpIHwgYm9vbF9nbG9iOworCWNoYXJf Ml9nbG9iID0gJ0InOworfQorCit2b2lkIHByb2NfNSh2b2lkKQoreworCWNoYXJfMV9nbG9iID0g J0EnOworCWJvb2xfZ2xvYiA9IGZhbHNlOworfQorCisvKiBkaHJ5XzIuYyAqLworCit2b2lkIGZp bGxfYXJyYXkoaW50IGFycl8xWzUwXSwgaW50IGFycl8yWzUwXVs1MF0sIGludCB2YWxfMSwgaW50 IHZhbF8yKQoreworCWludCBpOworCWludCBvZmZzZXQ7CisKKwlvZmZzZXQgPSB2YWxfMSArIDU7 CisJYXJyXzFbb2Zmc2V0XSA9IHZhbF8yOworCWFycl8xW29mZnNldCsxXSA9IGFycl8xW29mZnNl dF07CisJYXJyXzFbb2Zmc2V0KzMwXSA9IG9mZnNldDsKKwlmb3IgKGkgPSBvZmZzZXQ7IGkgPD0g b2Zmc2V0KzE7ICsraSkKKwkJYXJyXzJbb2Zmc2V0XVtpXSA9IG9mZnNldDsKKwlhcnJfMltvZmZz ZXRdW29mZnNldC0xXSArPSAxOworCWFycl8yW29mZnNldCsyMF1bb2Zmc2V0XSA9IGFycl8xW29m ZnNldF07CisJaW50X2dsb2IgPSA1OworfQorCitzdGF0aWMgaW50IGRvX2RocnlzdG9uZShpbnQg YXJnYywgY2hhciAqYXJndltdKQoreworCS8qIG1haW4gcHJvZ3JhbSwgY29ycmVzcG9uZHMgdG8g cHJvY2VkdXJlcyAgICAgICAgKi8KKwkvKiBNYWluIGFuZCBQcm9jXzAgaW4gdGhlIEFkYSB2ZXJz aW9uICAgICAgICAgICAgICovCisJaW50CQlpbnRfMTsKKwlpbnQJCWludF8yOworCWludAkJaW50 XzM7CisJY2hhcgkJY2hhcl9pOworCWVudW0gaWRlbnRzCWlkZW50OworCWNoYXIJCXN0cl8xWzMx XTsKKwljaGFyCQlzdHJfMlszMV07CisJaW50CQlpOworCWludAkJbnVtYmVyX29mX3J1bnM7CisJ Y2hhcgkJKm5ld19hcmd2WzJdOworCWNoYXIJCXRtcF9zdHJbMTBdOworCisJLyogYmFyZWJveCBj bWQgKi8KKwlpZiAoYXJnYyA9PSAyKQorCQludW1iZXJfb2ZfcnVucyA9IHNpbXBsZV9zdHJ0b3Vs KGFyZ3ZbMV0sIE5VTEwsIDEwKTsKKwllbHNlCisJCW51bWJlcl9vZl9ydW5zID0gMTAwMDA7CisK KwkvKiBJbml0aWFsaXphdGlvbnMgKi8KKwlpZGVudCA9IGlkZW50XzI7IC8qIHByZXZlbnQgY29t cGlsZXIgd2FybmluZyAqLworCWludF8yID0gMDsgLyogcHJldmVudCBjb21waWxlciB3YXJuaW5n ICovCisJaW50XzMgPSAwOyAvKiBwcmV2ZW50IGNvbXBpbGVyIHdhcm5pbmcgKi8KKworCW5leHRf cmVjb3JkX2dsb2IgPSBtYWxsb2Moc2l6ZW9mKHN0c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WJ1 dGVcbiIpOworCXByaW50ZigiXG4iKTsKKwlwcmludGYoIkV4ZWN1dGlvbiBzdGFydHMsICVkIHJ1 bnMgdGhyb3VnaCBEaHJ5c3RvbmVcbiIsIG51bWJlcl9vZl9ydW5zKTsKKworCS8qKioqKioqKioq KioqKiovCisJLyogU3RhcnQgdGltZXIgKi8KKwkvKioqKioqKioqKioqKioqLworCWJlZ2luX3Rp bWUgPSBnZXRfdGltZV9ucygpOworCisJZm9yIChpID0gMTsgaSA8PSBudW1iZXJfb2ZfcnVuczsg KytpKSB7CisJCXByb2NfNSgpOworCQlwcm9jXzQoKTsKKwkJLyogY2hhcl8xX2dsb2IgPT0gJ0En LCBjaGFyXzJfZ2xvYiA9PSAnQicsIGJvb2xfZ2xvYiA9PSB0cnVlICovCisJCWludF8xID0gMjsK KwkJaW50XzIgPSAzOworCQlzdHJjcHkoc3RyXzIsICJESFJZU1RPTkUgUFJPR1JBTSwgMidORCBT VFJJTkciKTsKKwkJaWRlbnQgPSBpZGVudF8yOworCQlib29sX2dsb2IgPSAhY29tcGFyZV9zdHJz KHN0cl8xLCBzdHJfMik7CisJCS8qIGJvb2xfZ2xvYiA9PSAxICovCisJCXdoaWxlIChpbnRfMSA8 IGludF8yKSB7CisJCQlpbnRfMyA9IDUgKiBpbnRfMSAtIGludF8yOworCQkJLyogaW50XzMgPT0g NyAqLworCQkJcHJvY183KGludF8xLCBpbnRfMiwgJmludF8zKTsKKwkJCS8qIGludF8zID09IDcg Ki8KKwkJCWludF8xICs9IDE7CisJCX0KKwkJLyogaW50XzEgPT0gMywgaW50XzIgPT0gMywgaW50 XzMgPT0gNyAqLworCQlmaWxsX2FycmF5KGFycl8xX2dsb2IsIGFycl8yX2dsb2IsIGludF8xLCBp bnRfMyk7CisJCS8qIGludF9nbG9iID09IDUgKi8KKwkJZmlsbF9yZWNvcmQocmVjb3JkX2dsb2Ip OworCQlmb3IgKGNoYXJfaSA9ICdBJzsgY2hhcl9pIDw9IGNoYXJfMl9nbG9iOyArK2NoYXJfaSkg eworCQkJaWYgKGlkZW50ID09IGNvbXBhcmVfY2hhcnMoY2hhcl9pLCAnQycpKSB7CisJCQkJcHJv Y182KGlkZW50XzEsICZpZGVudCk7CisJCQkJc3RyY3B5KHN0cl8yLAorCQkJCQkiREhSWVNUT05F IFBST0dSQU0sIDMnUkQgU1RSSU5HIik7CisJCQkJaW50XzIgPSBpOworCQkJCWludF9nbG9iID0g aTsKKwkJCX0KKwkJfQorCQkvKiBpbnRfMSA9PSAzLCBpbnRfMiA9PSAzLCBpbnRfMyA9PSA3ICov CisJCWludF8yID0gaW50XzIgKiBpbnRfMTsKKwkJaW50XzEgPSBpbnRfMiAvIGludF8zOworCQlp bnRfMiA9IDcgKiAoaW50XzIgLSBpbnRfMykgLSBpbnRfMTsKKwkJLyogaW50XzEgPT0gMSwgaW50 XzIgPT0gMTMsIGludF8zID09IDcgKi8KKwkJcHJvY18yKCZpbnRfMSk7CisJCS8qIGludF8xID09 IDUgKi8KKwl9CisKKwkvKioqKioqKioqKioqKiovCisJLyogU3RvcCB0aW1lciAqLworCS8qKioq KioqKioqKioqKi8KKwllbmRfdGltZSA9IGdldF90aW1lX25zKCk7CisKKwlwcmludGYoIkV4ZWN1 dGlvbiBlbmRzXG4iKTsKKwlwcmludGYoIlxuIik7CisJcHJpbnRmKCJGYWlsZWQgdmFyaWFibGVz OlxuIik7CisJaWYgKGludF9nbG9iICE9IDUpIHsKKwkJcHJpbnRmKCJpbnRfZ2xvYjogICAgICAg ICAgICAlZFxuIiwgaW50X2dsb2IpOworCQlwcmludGYoIiAgICAgICAgc2hvdWxkIGJlOiAgICVk XG4iLCA1KTsKKwl9CisJaWYgKGJvb2xfZ2xvYiAhPSAxKSB7CisJCXByaW50ZigiYm9vbF9nbG9i OiAgICAgICAgICAgJWRcbiIsIGJvb2xfZ2xvYik7CisJCXByaW50ZigiICAgICAgICBzaG91bGQg YmU6ICAgJWRcbiIsIDEpOworCX0KKwlpZiAoY2hhcl8xX2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b2ItPmRpc2NyKTsKKwkJcHJpbnRmKCIgICAgICAgIHNob3VsZCBiZTogICAg ICAgICVkXG4iLCAwKTsKKwl9CisJaWYgKHJlY29yZF9nbG9iLT52YXJpYW50LnZhcl8xLmVudW1f Y29tcCAhPSAyKSB7CisJCXByaW50ZigicmVjb3JkX2dsb2ItPmVudW1fY29tcDogICAlZFxuIiwK KwkJCXJlY29yZF9nbG9iLT52YXJpYW50LnZhcl8xLmVudW1fY29tcCk7CisJCXByaW50ZigiICAg ICAgICBzaG91bGQgYmU6ICAgICAgICAlZFxuIiwgMik7CisJfQorCWlmIChyZWNvcmRfZ2xvYi0+ dmFyaWFudC52YXJfMS5pbnRfY29tcCAhPSAxNykgeworCQlwcmludGYoInJlY29yZF9nbG9iLT5p bnRfY29tcDogICAgJWRcbiIsCisJCQlyZWNvcmRfZ2xvYi0+dmFyaWFudC52YXJfMS5pbnRfY29t cCk7CisJCXByaW50ZigiICAgICAgICBzaG91bGQgYmU6ICAgICAgICAlZFxuIiwgMTcpOworCX0K KwlpZiAoc3RyY21wKHJlY29yZF9nbG9iLT52YXJpYW50LnZhcl8xLnN0cl9jb21wLAorCQkiREhS WVNUT05FIFBST0dSQU0sIFNPTUUgU1RSSU5HIikgIT0gMCkgeworCQlwcmludGYoInJlY29yZF9n bG9iLT5zdHJfY29tcDogICAgJXNcbiIsCisJCQlyZWNvcmRfZ2xvYi0+dmFyaWFudC52YXJfMS5z dHJfY29tcCk7CisJCXByaW50ZigiICAgICAgICBzaG91bGQgYmU6ICAgICAgICBESFJZU1RPTkUg UFJPR1JBTSwgU09NRSBTVFJJTkdcbiIpOworCX0KKworCWlmIChuZXh0X3JlY29yZF9nbG9iLT5w dHJfY29tcCAhPSBuZXh0X3JlY29yZF9nbG9iKSB7CisJCXByaW50ZigibmV4dF9yZWNvcmRfZ2xv Yi0+cHRyX2NvbXA6ICAgIDB4JXBcbiIsCisJCQluZXh0X3JlY29yZF9nbG9iLT5wdHJfY29tcCk7 CisJCXBya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b2ItPnZhcmlhbnQudmFy XzEuc3RyX2NvbXApOworCQlwcmludGYoIiAgICAgICAgc2hvdWxkIGJlOiAgICAgICAgICAgICBE SFJZU1RPTkUgUFJPR1JBTSwgU09NRSBTVFJJTkdcbiIpOworCX0KKwlpZiAoaW50XzEgIT0gNSkg eworCQlwcmludGYoImludF8xOiAgICAgICAgICAgICAgICVkXG4iLCBpbnRfMSk7CisJCXByaW50 ZigiICAgICAgICBzaG91bGQgYmU6ICAgJWRcbiIsIDUpOworCX0KKwlpZiAoaW50XzIgIT0gMTMp IHsKKwkJcHJpbnRmKCJpbnRfMjogICAgICAgICAgICAgICAlZFxuIiwgaW50XzIpOworCQlwcmlu dGYoIiAgICAgICAgc2hvdWxkIGJlOiAgICVkXG4iLCAxMyk7CisJfQorCWlmIChpbnRfMyAhPSA3 KSB7CisJCXByaW50ZigiaW50XzM6ICAgICAgICAgICAgICAgJWRcbiIsIGludF8zKTsKKwkJcHJp bnRmKCIgICAgICAgIHNob3VsZCBiZTogICAlZFxuIiwgNyk7CisJfQorCWlmIChpZGVudCAhPSAx KSB7CisJCXByaW50ZigiaWRlbnQ6ICAgICAgICAgICAgICAgJWRcbiIsIGlkZW50KTsKKwkJcHJp bnRmKCIgICAgICAgIHNob3VsZCBiZTogICAlZFxuIiwgMSk7CisJfQorCWlmIChzdHJjbXAoc3Ry XzEsICJESFJZU1RPTkUgUFJPR1JBTSwgMSdTVCBTVFJJTkciKSAhPSAwKSB7CisJCXByaW50Zigi c3RyXzE6ICAgICAgICAgICAgICAgJXNcbiIsIHN0cl8xKTsKKwkJcHJpbnRmKCIgICAgICAgIHNo b3VsZCBiZTogICBESFJZU1RPTkUgUFJPR1JBTSwgMSdTVCBTVFJJTkdcbiIpOworCX0KKwlpZiAo c3RyY21wKHN0cl8yLCAiREhSWVNUT05FIFBST0dSQU0sIDInTkQgU1RSSU5HIikgIT0gMCkgewor CQlwcmludGYoInN0cl8yOiAgICAgICAgICAgICAgICVzXG4iLCBzdHJfM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