From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail.phycard.co.uk ([217.6.246.34] helo=root.phytec.de) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZMF4t-0006S0-N4 for barebox@lists.infradead.org; Mon, 03 Aug 2015 12:42:55 +0000 Received: from idefix.phytec.de (idefix.phytec.de [172.16.0.10]) by root.phytec.de (Postfix) with ESMTP id B423AA003F4 for ; Mon, 3 Aug 2015 14:44:16 +0200 (CEST) From: Daniel Schultz Date: Mon, 3 Aug 2015 14:41:11 +0200 Message-Id: <1438605671-46880-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 v4] commands: Add dhrystone To: barebox@lists.infradead.org VGhpcyB0b29sIHdpbGwgaGVscCB0byBtZWFzdXJlIHRoZSBzeXN0ZW0gcGVyZm9ybWFuY2UuCgpT b21lIFNvQ3MgaGF2ZW4ndCB0aGUgcG9zc2liaWxpdHkgdG8gcm91dGUgdGhlaXIgY2xvY2tzIHRv IHRoZSBvdXRwdXQgcGlucy4KU28geW91IGNhbiB1c2UgZGhyeXN0b25lIHRvIGdldCBhIGZlZWRi YWNrIGFib3V0IHRoZSBjbG9jayBzcGVlZC4KClNpZ25lZC1vZmYtYnk6IERhbmllbCBTY2h1bHR6 IDxkLnNjaHVsdHpAcGh5dGVjLmRlPgotLS0KCkNoYW5nZXM6Cgl2MToKCWFwcGxpZWQgUkZDIHN1 Z2dlc3Rpb25zOgoJCS1yZW1vdmVkICdkZWZhdWx0IG4nIGluIEtjb25maWcKCQktcmVmYWN0b3Jl ZCB0aW1lIGRlZmluZXMgd2l0aCBkZWZhdWx0IHRpbWUgdW5pdHMKCQktb25seSBwcmludCB2YXJp YWJsZSB2YW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YyBpbnQJCWFy cl8yX2dsb2JbNTBdWzUwXTsKKworLyogQ3ljbGUgVmFyaWFibGVzOiAqLworc3RhdGljIGludAkJ aW50XzE7CitzdGF0aWMgaW50CQlpbnRfMjsKK3N0YXRpYyBpbnQJCWludF8zOworc3RhdGljIGNo YXIJCWNoYXJfaTsKK3N0YXRpYyBlbnVtIGlkZW50cwlpZGVudDsKK3N0YXRpYyBjaGFyCQlzdHJf MVszMV07CitzdGF0aWMgY2hhcgkJc3RyXzJbMzFdOworc3RhdGljIGludAkJaTsKKworCisjZGVm aW5lIFRPT19TTUFMTF9USU1FICg1MCAqIE1TRUNPTkQpCisvKiBNZWFzdXJlbWVudHMgc2hvdWxk IGxhc3QgYXQgbGVhc3QgNTBtc2Vjb25kcyAqLworI2RlZmluZSBUT09fTEFSR0VfVElNRSAoMiAq IFNFQ09ORCkKKworCitzdGF0aWMgZW51bSBpZGVudHMgY29tcGFyZV9jaGFycyhjaGFyIGNoYXJf MSwgY2hhciBjaGFyXzIpCit7CisJaWYgKGNoYXJfMSAhPSBjaGFyXzIpCisJCXJldHVybiBpZGVu dF8xOworCWNoYXJfMV9nbG9iID0gY2hhcl8xOworCXJldHVybiBpZGVudF8yOworfQorCitzdGF0 aWMgYm9vbCBjb21wYXJlX3N0cnMoY2hhciBzdHJfMVszMV0sIGNoYXIgc3RyXzJbMzFdKQorewor CWludCBvZmZzZXQ7CisKKwlvZmZzZXQgPSAyOworCXdoaWxlIChvZmZzZXQgPD0gMikKKwkJaWYg KGNvbXBhcmVfY2hhcnMoc3RyXzFbb2Zmc2V0XSwgc3RyXzJbb2Zmc2V0KzFdKSA9PSBpZGVudF8x KQorCQkJKytvZmZzZXQ7CisJaWYgKHN0cmNtcChzdHJfMSwgc3RyXzIpID4gMCkgeworCQlpbnRf Z2xvYiA9IG9mZnNldCArIDc7CisJCXJldHVybiB0cnVlOworCX0KKwlyZXR1cm4gZmFsc2U7Cit9 CisKK3N0YXRpYyBib29sIGNoZWNrX2lkZW50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XJpYW50LnZhcl8xLmludF9jb21wID0gcmVjb3JkLT52YXJpYW50LnZhcl8xLmludF9jb21wOwor CW5leHRfcmVjb3JkLT5wdHJfY29tcCA9IHJlY29yZC0+cHRyX2NvbXA7CisJcHJvY183KDEwLCBp bnRfZ2xvYiwgJnJlY29yZF9nbG9iLT52YXJpYW50LnZhcl8xLmludF9jb21wKTsKKwkvKiBQdHJf VmFsX1Bhci0+cHRyX2NvbXAtPnB0cl9jb21wID09IHJlY29yZF9nbG9iLT5wdHJfY29tcCAqLwor CWlmIChuZXh0X3JlY29yZC0+ZGlzY3IgPT0gaWRlbnRfMSkgeyAvKiB0aGVuLCBleGVjdXRlZCAq LworCQluZXh0X3JlY29yZC0+dmFyaWFudC52YXJfMS5pbnRfY29tcCA9IDY7CisJCXByb2NfNihy ZWNvcmQtPnZhcmlhbnQudmFyXzEuZW51bV9jb21wLAorCQkJJm5leHRfcmVjb3JkLT52YXJpYW50 LnZhcl8xLmVudW1fY29tcCk7CisJCW5leHRfcmVjb3JkLT5wdHJfY29tcCA9IHJlY29yZF9nbG9i LT5wdHJfY29tcDsKKwkJcHJvY183KG5leHRfcmVjb3JkLT52YXJpYW50LnZhcl8xLmludF9jb21w LCAxMCwKKwkJCSZuZXh0X3JlY29yZC0+dmFyaWFudC52YXJfMS5pbnRfY29tcCk7CisJfSBlbHNl IHsgLyogbm90IGV4ZWN1dGVkICovCisJCSpyZWNvcmQgPSAqcmVjb3JkLT5wdHJfY29tcDsKKwl9 Cit9CisKK3N0YXRpYyB2b2lkIHByb2NfMihpbnQgKm91dCkKK3sKKwlpZiAoY2hhcl8xX2dsb2Ig PT0gJ0EnKQorCQkqb3V0ID0gKm91dCArIDkgLSBpbnRfZ2xvYjsKK30KKworc3RhdGljIHZvaWQg cHJvY180KHZvaWQpCit7CisJYm9vbF9nbG9iID0gKGNoYXJfMV9nbG9iID09ICdBJykgfCBib29s X2dsb2I7CisJY2hhcl8yX2dsb2IgPSAnQic7Cit9CisKK3N0YXRpYyB2b2lkIHByb2NfNSh2b2lk KQoreworCWNoYXJfMV9nbG9iID0gJ0EnOworCWJvb2xfZ2xvYiA9IGZhbHNlOworfQorCisvKiBk aHJ5XzIuYyAqLworCitzdGF0aWMgdm9pZCBmaWxsX2FycmF5KGludCBhcnJfMVs1MF0sIGludCBh cnJfMls1MF1bNTBdLCBpbnQgdmFsXzEsIGludCB2YWxfMikKK3sKKwlpbnQgaTsKKwlpbnQgb2Zm c2V0OworCisJb2Zmc2V0ID0gdmFsXzEgKyA1OworCWFycl8xW29mZnNldF0gPSB2YWxfMjsKKwlh cnJfMVtvZmZzZXQrMV0gPSBhcnJfMVtvZmZzZXRdOworCWFycl8xW29mZnNldCszMF0gPSBvZmZz ZXQ7CisJZm9yIChpID0gb2Zmc2V0OyBpIDw9IG9mZnNldCsxOyArK2kpCisJCWFycl8yW29mZnNl dF1baV0gPSBvZmZzZXQ7CisJYXJyXzJbb2Zmc2V0XVtvZmZzZXQtMV0gKz0gMTsKKwlhcnJfMltv ZmZzZXQrMjBdW29mZnNldF0gPSBhcnJfMVtvZmZzZXRdOworCWludF9nbG9iID0gNTsKK30KKwor c3RhdGljIHZvaWQgb25lX2RocnlzdG9uZV9jeWNsZSh2b2lkKQoreworCXByb2NfNSgpOworCXBy b2NfNCgpOworCS8qIGNoYXJfMV9nbG9iID09ICdBJywgY2hhcl8yX2dsb2IgPT0gJ0InLCBib29s X2dsb2IgPT0gdHJ1ZSAqLworCWludF8xID0gMjsKKwlpbnRfMiA9IDM7CisJc3RyY3B5KHN0cl8y LCAiREhSWVNUT05FIFBST0dSQU0sIDInTkQgU1RSSU5HIik7CisJaWRlbnQgPSBpZGVudF8yOwor CWJvb2xfZ2xvYiA9ICFjb21wYXJlX3N0cnMoc3RyXzEsIHN0cl8yKTsKKwkvKiBib29sX2dsb2Ig PT0gMSAqLworCXdoaWxlIChpbnRfMSA8IGludF8yKSB7CisJCWludF8zID0gNSAqIGludF8xIC0g aW50XzI7CisJCS8qIGludF8zID09IDcgKi8KKwkJcHJvY183KGludF8xLCBpbnRfMiwgJmludF8z KTsKKwkJLyogaW50XzMgPT0gNyAqLworCQlpbnRfMSArPSAxOworCX0KKwkvKiBpbnRfMSA9PSAz LCBpbnRfMiA9PSAzLCBpbnRfMyA9PSA3ICovCisJZmlsbF9hcnJheShhcnJfMV9nbG9iLCBhcnJf Ml9nbG9iLCBpbnRfMSwgaW50XzMpOworCS8qIGludF9nbG9iID09IDUgKi8KKwlmaWxsX3JlY29y ZChyZWNvcmRfZ2xvYik7CisJZm9yIChjaGFyX2kgPSAnQSc7IGNoYXJfaSA8PSBjaGFyXzJfZ2xv YjsgKytjaGFyX2kpIHsKKwkJaWYgKGlkZW50ID09IGNvbXBhcmVfY2hhcnMoY2hhcl9pLCAnQycp KSB7CisJCQlwcm9jXzYoaWRlbnRfMSwgJmlkZW50KTsKKwkJCXN0cmNweShzdHJfMiwKKwkJCQki REhSWVNUT05FIFBST0dSQU0sIDMnUkQgU1RSSU5HIik7CisJCQlpbnRfMiA9IGk7CisJCQlpbnRf Z2xvYiA9IGk7CisJCX0KKwl9CisJLyogaW50XzEgPT0gMywgaW50XzIgPT0gMywgaW50XzMgPT0g NyAqLworCWludF8yID0gaW50XzIgKiBpbnRfMTsKKwlpbnRfMSA9IGludF8yIC8gaW50XzM7CisJ aW50XzIgPSA3ICogKGludF8yIC0gaW50XzMpIC0gaW50XzE7CisJLyogaW50XzEgPT0gMSwgaW50 XzIgPT0gMTMsIGludF8zID09IDcgKi8KKwlwcm9jXzIoJmludF8xKTsKKwkvKiBpbnRfMSA9PSA1 ICovCit9CisKK3N0YXRpYyBpbnQgZG9fZGhyeXN0b25lKGludCBhcmdjLCBjaGFyICphcmd2W10p Cit7CisJaW50CW51bWJlcl9vZl9ydW5zOworCWludAlhY3R1YWxseV9udW1iZXJfb2ZfcnVucyA9 IDA7CisJLyogdmFyaWFibGVzIGZvciB0aW1lIG1lYXN1cmVtZW50ICAgICAgICAgICAgICAgICAq LworCXU2NAliZWdpbl90aW1lOworCXU2NAllbmRfdGltZTsKKwl1NjQJdXNlcl90aW1lOworCXU2 NAluYW5vc2Vjb25kczsKKworCS8qIGJhcmVib3ggY21kICovCisJaWYgKGFyZ2MgPT0gMikgewor CQludW1iZXJfb2ZfcnVucyA9IHNpbXBsZV9zdHJ0b3VsKGFyZ3ZbMV0sIE5VTEwsIDEwKTsKKwkJ aWYgKG51bWJlcl9vZl9ydW5zID09IDApCisJCQludW1iZXJfb2ZfcnVucyA9IDE7CisJfSBlbHNl IHsKKwkJbnVtYmVyX29mX3J1bnMgPSAxMDAwMDsKKwl9CisKKwkvKiBJbml0aWFsaXphdGlvbnMg Ki8KKwluZXh0X3JlY29yZF9nbG9iID0geG1hbGxvYyhzaXplb2YoKm5leHRfcmVjb3JkX2dsb2Ip KTsKKwlyZWNvcmRfZ2xvYiA9IHhtYWxsb2Moc2l6ZW9mKCpyZWNvcmRfZ2xvYikpOworCisJcHJp bnRmKCJcbiIpOworCXByaW50ZigiRGhyeXN0b25lIEJlbmNobWFyaywgVmVyc2lvbiAyLjEgKExh bmd1YWdlOiBDKVxuIik7CisJcHJpbnRmKCJcbiIpOworCXByaW50ZigiUHJvZ3JhbSBjb21waWxl ZCB3aXRob3V0ICdyZWdpc3RlcicgYXR0cmlidXRlXG4iKTsKKwlwcmludGYoIlxuIik7CisKKwlp ZGVudCA9IGlkZW50XzI7CS8qIHByZXZlbnQgY29tcGlsZXIgd2FybmluZyAqLworCWludF8yID0g MDsJCS8qIHByZXZlbnQgY29tcGlsZXIgd2FybmluZyAqLworCWludF8zID0gMDsJCS8qIHByZXZl bnQgY29tcGlsZXIgd2FybmluZyAqLworCisJcmVjb3JkX2dsb2ItPnB0cl9jb21wCQkJPSBuZXh0 X3JlY29yZF9nbG9iOworCXJlY29yZF9nbG9iLT5kaXNjcgkJCT0gaWRlbnRfMTsKKwlyZWNvcmRf Z2xvYi0+dmFyaWFudC52YXJfMS5lbnVtX2NvbXAJPSBpZGVudF8zOworCXJlY29yZF9nbG9iLT52 YXJpYW50LnZhcl8xLmludF9jb21wCT0gNDA7CisJc3RyY3B5KHJlY29yZF9nbG9iLT52YXJpYW50 LnZhcl8xLnN0cl9jb21wLAorCQkiREhSWVNUT05FIFBST0dSQU0sIFNPTUUgU1RSSU5HIik7CisJ c3RyY3B5KHN0cl8xLCAiREhSWVNUT05FIFBST0dSQU0sIDEnU1QgU1RSSU5HIik7CisKKwlhcnJf Ml9nbG9iWzhdWzddID0gMTA7CisJLyogV2FzIG1pc3NpbmcgaW4gcHVibGlzaGVkIHByb2dyYW0u IFdpdGhvdXQgdGhpcyBzdGF0ZW1lbnQsICAgICovCisJLyogYXJyXzJfZ2xvYiBbOF1bN10gd291 bGQgaGF2ZSBhbiB1bmRlZmluZWQgdmFsdWUuICAgICAgICAgICAgICovCisJLyogV2FybmluZzog V2l0aCAxNi1CaXQgcHJvY2Vzc29ycyBhbmQgbnVtYmVyX29mX3J1bnMgPiAzMjAwMCwgICovCisJ Lyogb3ZlcmZsb3cgbWF5IG9jY3VyIGZvciB0aGlzIGFycmF5IGVsZW1lbnQuICAgICAgICAgICAg ICAgICAgICovCisKKwkvKioqKioqKioqKioqKioqLworCS8qIFN0YXJ0IHRpbWVyICovCisJLyoq KioqKioqKioqKioqKi8KKwliZWdpbl90aW1lID0gZ2V0X3RpbWVfbnMoKTsKKworYWdhaW46CisJ Zm9yIChpID0gMDsgaSA8IG51bWJlcl9vZl9ydW5zOyBpKyspCisJCW9uZV9kaHJ5c3RvbmVfY3lj bGUoKTsKKworCWFjdHVhbGx5X251bWJlcl9vZl9ydW5zICs9IG51bWJlcl9vZl9ydW5zOworCWVu ZF90aW1lID0gZ2V0X3RpbWVfbnMoKTsKKwl1c2VyX3RpbWUgPSBlbmRfdGltZSAtIGJlZ2luX3Rp bWU7CisKKwlpZiAodXNlcl90aW1lIDwgVE9PX1NNQUxMX1RJTUUpCisJCWdvdG8gYWdhaW47CisK KwlwcmludGYoIkV4ZWN1dGlvbiBmaW5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lwcmlu dGYoIiAgICAgICAgc2hvdWxkIGJlOiAgICAgICAgICAgICAlZFxuIiwgMSk7CisJfQorCWlmIChu ZXh0X3JlY29yZF9nbG9iLT52YXJpYW50LnZhcl8xLmludF9jb21wICE9IDE4KSB7CisJCXByaW50 ZigibmV4dF9yZWNvcmRfZ2xvYi0+aW50X2NvbXA6ICAgICVkXG4iLAorCQkJbmV4dF9yZWNvcmRf Z2xvYi0+dmFyaWFudC52YXJfMS5pbnRfY29tcCk7CisJCXByaW50ZigiICAgICAgICBzaG91bGQg YmU6ICAgICAgICAgICAgICVkXG4iLCAxOCk7CisJfQorCWlmIChzdHJjbXAobmV4dF9yZWNvcmRf Z2xvYi0+dmFyaWFudC52YXJfMS5zdHJfY29tcCwKKwkJIkRIUllTVE9ORSBQUk9HUkFNLCBTT01F IFNUUklORyIpICE9IDApIHsKKwkJcHJpbnRmKCJuZXh0X3JlY29yZF9nbG9iLT5zdHJfY29tcDog ICAgJXNcbiIsCisJCQluZXh0X3JlY29yZF9nbG9iLT52YXJpYW50LnZhcl8xLnN0cl9jb21wKTsK KwkJcHJpbnRmKCIgICAgICAgIHNob3VsZCBiZTogICAgICAgICAgICAgREhSWVNUT05FIFBST0dS QU0sIFNPTUUgU1RSSU5HXG4iKTsKKwl9CisJaWYgKGludF8xICE9IDUpIHsKKwkJcHJpbnRmKCJp bnRfMTogICAgICAgICAgICAgICAlZFxuIiwgaW50XzEpOworCQlwcmludGYoIiAgICAgICAgc2hv dWxkIGJlOiAgICVkXG4iLCA1KTsKKwl9CisJaWYgKGludF8yICE9IDEzKSB7CisJCXByaW50Zigi aW50XzI6ICAgICAgICAgICAgICAgJWRcbiIsIGludF8yKTsKKwkJcHJpbnRmKCIgICAgICAgIHNo b3VsZCBiZTogICAlZFxuIiwgMTMpOworCX0KKwlpZiAoaW50XzMgIT0gNykgeworCQlwcmludGYo ImludF8zOiAgICAgICAgICAgICAgICVkXG4iLCBpbnRfMyk7CisJCXByaW50ZigiICAgICAgICBz aG91bGQgYmU6ICAgJWRcbiIsIDcpOworCX0KKwlpZiAoaWRlbnQgIT0gMSkgeworCQlwcmludGYo ImlkZW50OiAgICAgICAgICAgICAgICVkXG4iLCBpZGVudCk7CisJCXByaW50ZigiICAgICAgICBz aG91bGQgYmU6ICAgJWRcbiIsIDEpOworCX0KKwlpZiAoc3RyY21wKHN0cl8xLCAiREhSWVNUT05F IFBST0dSQU0sIDEnU1QgU1RSSU5HIikgIT0gMCkgeworCQlwcmludGYoInN0cl8xOiAgICAgICAg ICAgICAgICVzXG4iLCBzdHJfMSk7CisJCXByaW50ZigiICAgICAgICBzaG91bGQgYmU6ICAgREhS WVNUT05FIFBST0dSQU0sIDEnU1QgU1RSSU5HXG4iKTsKKwl9CisJaWYgKHN0cmNtcChzdHJfMiwg IkRIUllTVE9ORSBQUk9HUkFNLCAyJ05EIFNUUklORyIpICE9IDApIHsKKwkJcHJpbnRmKCJzdHJf MjogICAgICAgICAgICAgICAlc1xuIiwgc3RyXzIpOworCQlwcmludGYoIiAgICAgICAgc2hvdWxk IGJlOiAgIERIUllTVE9ORSBQUk9HUkFNLCAyJ05EIFNUUklOR1xuIik7CisJfQorCXByaW50Zigi XG4iKTsKKworCWlmICh1c2VyX3RpbWUgPiBUT09fTEFSR0VfVElNRSkKKwkJcHJpbnRmKCJNZWFz dXJlZCB0aW1lIHRvbyBsYXJnZSB0byBvYnRhaW4gbWVhbmluZ2Z1bCByZXN1bHRzIG9yIGEgdGlt ZXIgd3JhcCBoYXBwZW5kLlxuIik7CisJZWxzZSBpZiAoZW5kX3RpbWUgPCBiZWdpbl90aW1lKQor CQlwcmludGYoIlRpbWVyIG92ZXJmbG93IG9jY3VyZWQuXG4iKTsKKworCXByaW50ZigidXNlcl90 aW1lOiAlbGx1IG5zXG4iLCB1c2VyX3RpbWUpOworCisJbmFub3NlY29uZHMgPSB1c2VyX3RpbWU7 CisJZG9fZGl2KG5hbm9zZWNvbmRzLCBhY3R1YWxseV9udW1iZXJfb2Zfc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