From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail.phytec.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 1ZKmRT-0001Vw-Bq for barebox@lists.infradead.org; Thu, 30 Jul 2015 11:56:10 +0000 Received: from idefix.phytec.de (idefix.phytec.de [172.16.0.10]) by root.phytec.de (Postfix) with ESMTP id 3BF38A00105 for ; Thu, 30 Jul 2015 13:57:26 +0200 (CEST) From: Daniel Schultz Date: Thu, 30 Jul 2015 13:54:32 +0200 Message-Id: <1438257272-39816-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 v3] commands: Add dhrystone To: barebox@lists.infradead.org VGhpcyB0b29sIHdpbGwgaGVscCB0byBtZWFzdXJlIHRoZSBzeXN0ZW0gcGVyZm9ybWFuY2UuCgpT b21lIFNvQ3MgaGF2ZW4ndCB0aGUgcG9zc2liaWxpdHkgdG8gcm91dGUgdGhlaXIgY2xvY2tzIHRv IHRoZSBvdXRwdXQgcGlucy4KU28geW91IGNhbiB1c2UgZGhyeXN0b25lIHRvIGdldCBhIGZlZWRi YWNrIGFib3V0IHRoZSBjbG9jayBzcGVlZC4KClNpZ25lZC1vZmYtYnk6IERhbmllbCBTY2h1bHR6 IDxkLnNjaHVsdHpAcGh5dGVjLmRlPgotLS0KCkNoYW5nZXM6Cgl2MToKCWFwcGxpZWQgUkZDIHN1 Z2dlc3Rpb25zOgoJCS1yZW1vdmVkICdkZWZhdWx0IG4nIGluIEtjb25maWcKCQktcmVmYWN0b3Jl ZCB0aW1lIGRlZmluZXMgd2l0aCBkZWZhdWx0IHRpbWUgdW5pdHMKCQktb25seSBwcmludCB2YXJp YWJsZSB2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TUUgKDUwICogTVNFQ09O RCkKKy8qIE1lYXN1cmVtZW50cyBzaG91bGQgbGFzdCBhdCBsZWFzdCA1MG1zZWNvbmRzICovCisj ZGVmaW5lIFRPT19MQVJHRV9USU1FICgyICogU0VDT05EKQorCisKK2VudW0gaWRlbnRzIGNvbXBh cmVfY2hhcnMoY2hhciBjaGFyXzEsIGNoYXIgY2hhcl8yKQoreworCWlmIChjaGFyXzEgIT0gY2hh cl8yKSB7CisJCXJldHVybiBpZGVudF8xOworCX0gZWxzZSB7IC8qIHNob3VsZCBub3QgZXhlY3V0 ZWQgKi8KKwkJY2hhcl8xX2dsb2IgPSBjaGFyXzE7CisJCXJldHVybiBpZGVudF8yOworCX0KK30K KworYm9vbCBjb21wYXJlX3N0cnMoY2hhciBzdHJfMVszMV0sIGNoYXIgc3RyXzJbMzFdKQorewor CWludCBvZmZzZXQ7CisKKwlvZmZzZXQgPSAyOworCXdoaWxlIChvZmZzZXQgPD0gMikKKwkJaWYg KGNvbXBhcmVfY2hhcnMoc3RyXzFbb2Zmc2V0XSwgc3RyXzJbb2Zmc2V0KzFdKSA9PSBpZGVudF8x KQorCQkJKytvZmZzZXQ7CisJaWYgKHN0cmNtcChzdHJfMSwgc3RyXzIpID4gMCkgeworCQlpbnRf Z2xvYiA9IG9mZnNldCArIDc7CisJCXJldHVybiB0cnVlOworCX0gZWxzZSB7CisJCXJldHVybiBm YWxzZTsKKwl9CisKK30KKworYm9vbCBjaGVja19pZGVudChlbnVtIGlkZW50cyBpZGVudCkKK3sK KwlpZiAoaWRlbnQgPT0gaWRlbnRfMykKKwkJcmV0dXJuIHRydWU7CisJZWxzZQorCQlyZXR1cm4g ZmFsc2U7Cit9CisKK3ZvaWQgcHJvY183KGludCBpbnB1dF8xLCBpbnQgaW5wdXRfMiwgaW50ICpv dXQpCit7CisJKm91dCA9IGlucHV0XzIgKyBpbnB1dF8xICsgMjsKK30KKwordm9pZCBwcm9jXzYo ZW51bSBpZGVudHMgaWRlbnQsIGVud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LworCWlmIChu ZXh0X3JlY29yZC0+ZGlzY3IgPT0gaWRlbnRfMSkgeyAvKiB0aGVuLCBleGVjdXRlZCAqLworCQlu ZXh0X3JlY29yZC0+dmFyaWFudC52YXJfMS5pbnRfY29tcCA9IDY7CisJCXByb2NfNihyZWNvcmQt PnZhcmlhbnQudmFyXzEuZW51bV9jb21wLAorCQkJJm5leHRfcmVjb3JkLT52YXJpYW50LnZhcl8x LmVudW1fY29tcCk7CisJCW5leHRfcmVjb3JkLT5wdHJfY29tcCA9IHJlY29yZF9nbG9iLT5wdHJf Y29tcDsKKwkJcHJvY183KG5leHRfcmVjb3JkLT52YXJpYW50LnZhcl8xLmludF9jb21wLCAxMCwK KwkJCSZuZXh0X3JlY29yZC0+dmFyaWFudC52YXJfMS5pbnRfY29tcCk7CisJfSBlbHNlIHsgLyog bm90IGV4ZWN1dGVkICovCisJCSpyZWNvcmQgPSAqcmVjb3JkLT5wdHJfY29tcDsKKwl9Cit9CisK K3ZvaWQgcHJvY18yKGludCAqb3V0KQoreworCWlmIChjaGFyXzFfZ2xvYiA9PSAnQScpCisJCSpv dXQgPSAqb3V0ICsgOSAtIGludF9nbG9iOworfQorCit2b2lkIHByb2NfNCh2b2lkKQoreworCWJv b2xfZ2xvYiA9IChjaGFyXzFfZ2xvYiA9PSAnQScpIHwgYm9vbF9nbG9iOworCWNoYXJfMl9nbG9i ID0gJ0InOworfQorCit2b2lkIHByb2NfNSh2b2lkKQoreworCWNoYXJfMV9nbG9iID0gJ0EnOwor CWJvb2xfZ2xvYiA9IGZhbHNlOworfQorCisvKiBkaHJ5XzIuYyAqLworCit2b2lkIGZpbGxfYXJy YXkoaW50IGFycl8xWzUwXSwgaW50IGFycl8yWzUwXVs1MF0sIGludCB2YWxfMSwgaW50IHZhbF8y KQoreworCWludCBpOworCWludCBvZmZzZXQ7CisKKwlvZmZzZXQgPSB2YWxfMSArIDU7CisJYXJy XzFbb2Zmc2V0XSA9IHZhbF8yOworCWFycl8xW29mZnNldC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5KHN0cl8xLCAiREhSWVNUT05FIFBST0dSQU0sIDEnU1QgU1RSSU5HIik7CisK KwlhcnJfMl9nbG9iWzhdWzddID0gMTA7CisJLyogV2FzIG1pc3NpbmcgaW4gcHVibGlzaGVkIHBy b2dyYW0uIFdpdGhvdXQgdGhpcyBzdGF0ZW1lbnQsICAgICovCisJLyogYXJyXzJfZ2xvYiBbOF1b N10gd291bGQgaGF2ZSBhbiB1bmRlZmluZWQgdmFsdWUuICAgICAgICAgICAgICovCisJLyogV2Fy bmluZzogV2l0aCAxNi1CaXQgcHJvY2Vzc29ycyBhbmQgbnVtYmVyX29mX3J1bnMgPiAzMjAwMCwg ICovCisJLyogb3ZlcmZsb3cgbWF5IG9jY3VyIGZvciB0aGlzIGFycmF5IGVsZW1lbnQuICAgICAg ICAgICAgICAgICAgICovCisKKwkvKioqKioqKioqKioqKioqLworCS8qIFN0YXJ0IHRpbWVyICov CisJLyoqKioqKioqKioqKioqKi8KKwkqc3RhcnRfdGltZSA9IGdldF90aW1lX25zKCk7CisKKwlm b3IgKGkgPSAxOyBpIDw9IG51bWJlcl9vZl9ydW5zOyArK2kpIHsKKwkJcHJvY181KCk7CisJCXBy b2NfNCgpOworCQkvKiBjaGFyXzFfZ2xvYiA9PSAnQScsIGNoYXJfMl9nbG9iID09ICdCJywgYm9v bF9nbG9iID09IHRydWUgKi8KKwkJaW50XzEgPSAyOworCQlpbnRfMiA9IDM7CisJCXN0cmNweShz dHJfMiwgIkRIUllTVE9ORSBQUk9HUkFNLCAyJ05EIFNUUklORyIpOworCQlpZGVudCA9IGlkZW50 XzI7CisJCWJvb2xfZ2xvYiA9ICFjb21wYXJlX3N0cnMoc3RyXzEsIHN0cl8yKTsKKwkJLyogYm9v bF9nbG9iID09IDEgKi8KKwkJd2hpbGUgKGludF8xIDwgaW50XzIpIHsKKwkJCWludF8zID0gNSAq IGludF8xIC0gaW50XzI7CisJCQkvKiBpbnRfMyA9PSA3ICovCisJCQlwcm9jXzcoaW50XzEsIGlu dF8yLCAmaW50XzMpOworCQkJLyogaW50XzMgPT0gNyAqLworCQkJaW50XzEgKz0gMTsKKwkJfQor CQkvKiBpbnRfMSA9PSAzLCBpbnRfMiA9PSAzLCBpbnRfMyA9PSA3ICovCisJCWZpbGxfYXJyYXko YXJyXzFfZ2xvYiwgYXJyXzJfZ2xvYiwgaW50XzEsIGludF8zKTsKKwkJLyogaW50X2dsb2IgPT0g NSAqLworCQlmaWxsX3JlY29yZChyZWNvcmRfZ2xvYik7CisJCWZvciAoY2hhcl9pID0gJ0EnOyBj aGFyX2kgPD0gY2hhcl8yX2dsb2I7ICsrY2hhcl9pKSB7CisJCQlpZiAoaWRlbnQgPT0gY29tcGFy ZV9jaGFycyhjaGFyX2ksICdDJykpIHsKKwkJCQlwcm9jXzYoaWRlbnRfMSwgJmlkZW50KTsKKwkJ CQlzdHJjcHkoc3RyXzIsCisJCQkJCSJESFJZU1RPTkUgUFJPR1JBTSwgMydSRCBTVFJJTkciKTsK KwkJCQlpbnRfMiA9IGk7CisJCQkJaW50X2dsb2IgPSBpOworCQkJfQorCQl9CisJCS8qIGludF8x ID09IDMsIGludF8yID09IDMsIGludF8zID09IDcgKi8KKwkJaW50XzIgPSBpbnRfMiAqIGludF8x OworCQlpbnRfMSA9IGludF8yIC8gaW50XzM7CisJCWludF8yID0gNyAqIChpbnRfMiAtIGludF8z KSAtIGludF8xOworCQkvKiBpbnRfMSA9PSAxLCBpbnRfMiA9PSAxMywgaW50XzMgPT0gNyAqLwor CQlwcm9jXzIoJmludF8xKTsKKwkJLyogaW50XzEgPT0gNSAqLworCX0KKworCS8qKioqKioqKioq KioqKi8KKwkvKiBTdG9wIHRpbWVyICovCisJLyoqKioqKioqKioqKioqLworCSplbmRfdGltZSA9 IGdldF90aW1lX25zKCk7CisKKwlwcmludGYoIkV4ZWN1dGlvbiBlbmRzXG4iKTsKKwlwcmludGYo IlxuIik7CisJcHJpbnRmKCJGYWlsZWQgdmFyaWFibGVzOlxuIik7CisJaWY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AgIT0gbmV4dF9yZWNvcmRfZ2xvYikgeworCQlwcmludGYoInJl Y29yZF9nbG9iLT5wdHJfY29tcDogICAgMHglcFxuIiwKKwkJCXJlY29yZF9nbG9iLT5wdHJfY29t cCk7CisJCXByaW50ZigiICAgICAgICBzaG91bGQgYmU6ICAgICAgICAweCVwXG4iLCBuZXh0X3Jl Y29yZF9nbG9iKTsKKwl9CisJaWYgKHJlY29yZF9nbG9iLT5kaXNjciAhPSAwKSB7CisJCXByaW50 ZigicmVjb3JkX2dsb2ItPmRpc2NyOiAgICAgICAlZFxuIiwgcmVjb3JkX2dsb2ItPmRpc2NyKTsK KwkJcHJpbnRmKCIgICAgICAgIHNob3VsZCBiZTogICAgICAgICVkXG4iLCAwKTsKKwl9CisJaWYg KHJlY29yZF9nbG9iLT52YXJpYW50LnZhcl8xLmVudW1fY29tcCAhPSAyKSB7CisJCXByaW50Zigi cmVjb3JkX2dsb2ItPmVudW1fY29tcDogICAlZFxuIiwKKwkJCXJlY29yZF9nbG9iLT52YXJpYW50 LnZhcl8xLmVudW1fY29tcCk7CisJCXByaW50ZigiICAgICAgICBzaG91bGQgYmU6ICAgICAgICAl ZFxuIiwgMik7CisJfQorCWlmIChyZWNvcmRfZ2xvYi0+dmFyaWFudC52YXJfMS5pbnRfY29tcCAh PSAxNykgeworCQlwcmludGYoInJlY29yZF9nbG9iLT5pbnRfY29tcDogICAgJWRcbiIsCisJCQly ZWNvcmRfZ2xvYi0+dmFyaWFudC52YXJfMS5pbnRfY29tcCk7CisJCXByaW50ZigiICAgICAgICBz aG91bGQgYmU6ICAgICAgICAlZFxuIiwgMTcpOworCX0KKwlpZiAoc3RyY21wKHJlY29yZF9nbG9i LT52YXJpYW50LnZhcl8xLnN0cl9jb21wLAorCQkiREhSWVNUT05FIFBST0dSQU0sIFNPTUUgU1RS SU5HIikgIT0gMCkgeworCQlwcmludGYoInJlY29yZF9nbG9iLT5zdHJfY29tcDogICAgJXNcbiIs CisJCQlyZWNvcmRfZ2x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G9iLT52YXJp YW50LnZhcl8xLmludF9jb21wKTsKKwkJcHJpbnRmKCIgICAgICAgIHNob3VsZCBiZTogICAgICAg ICAgICAgJWRcbiIsIDE4KTsKKwl9CisJaWYgKHN0cmNtcChuZXh0X3JlY29yZF9nbG9iLT52YXJp YW50LnZhcl8xLnN0cl9jb21wLAorCQkiREhSWVNUT05FIFBST0dSQU0sIFNPTUUgU1RSSU5HIikg IT0gMCkgeworCQlwcmludGYoIm5leHRfcmVjb3JkX2dsb2ItPnN0cl9jb21wOiAgICAlc1xuIiwK KwkJCW5leHRfcmVjb3JkX2dsb2ItPnZhcmlhbnQudmFyXzEuc3RyX2NvbXApOworCQlwcmludGYo IiAgICAgICAgc2hvdWxkIGJlOiAgICAgICAgICAgICBESFJZU1RPTkUgUFJPR1JBTSwgU09NRSBT VFJJTkdcbiIpOworCX0KKwlpZiAoaW50XzEgIT0gNSkgeworCQlwcmludGYoImludF8xOiAgICAg ICAgICAgICAgICVkXG4iLCBpbnRfMSk7CisJCXByaW50ZigiICAgICAgICBzaG91bGQgYmU6ICAg JWRcbiIsIDUpOworCX0KKwlpZiAoaW50XzIgIT0gMTMpIHsKKwkJcHJpbnRmKCJpbnRfMjogICAg ICAgICAgICAgICAlZFxuIiwgaW50XzIpOworCQlwcmludGYoIiAgICAgICAgc2hvdWxkIGJlOiAg ICVkXG4iLCAxMyk7CisJfQorCWlmIChpbnRfMyAhPSA3KSB7CisJCXByaW50ZigiaW50XzM6ICAg ICAgICAgICAgICAgJWRcbiIsIGludF8zKTsKKwkJcHJpbnRmKCIgICAgICAgIHNob3VsZCBiZTog ICAlZFxuIiwgNyk7CisJfQorCWlmIChpZGVudCAhPSAxKSB7CisJCXByaW50ZigiaWRlbnQ6ICAg ICAgICAgICAgICAgJWRcbiIsIGlkZW50KTsKKwkJcHJpbnRmKCIgICAgICAgIHNob3VsZCBiZTog ICAlZFxuIiwgMSk7CisJfQorCWlmIChzdHJjbXAoc3RyXzEsICJESFJZU1RPTkUgUFJPR1JBTSwg MSdTVCBTVFJJTkciKSAhPSAwKSB7CisJCXByaW50Zigic3RyXzE6ICAgICAgICAgICAgICAgJXNc biIsIHN0cl8xKTsKKwkJcHJpbnRmKCIgICAgICAgIHNob3VsZCBiZTogICBESFJZU1RPTkUgUFJP R1JBTSwgMSdTVCBTVFJJTkdcbiIpOworCX0KKwlpZiAoc3RyY21wKHN0cl8yLCAiREhSWVNUT05F IFBST0dSQU0sIDInTkQgU1RSSU5HIikgIT0gMCkgeworCQlwcmludGYoInN0cl8yOiAgICAgICAg ICAgICAgICVzXG4iLCBzdHJfMik7CisJCXByaW50ZigiICAgICAgICBzaG91bGQgYmU6ICAgREhS WVNUT05FIFBST0dSQU0sIDInTkQgU1RSSU5HXG4iKTsKKwl9CisJcHJpbnRmKCJcbiIpOworCit9 CisKK3N0YXRpYyBpbnQgZG9fZGhyeXN0b25lKGludCBhcmdjLCBjaGFyICphcmd2W10pCit7CisJ dTMyCW51bWJlcl9vZl9ydW5zOworCS8qIHZhcmlhYmxlcyBmb3IgdGltZSBtZWFzdXJlbWVudCAg ICAgICAgICAgICAgICAgKi8KKwl1NjQJYmVnaW5fdGltZTsKKwl1NjQJZW5kX3RpbWU7CisJdTY0 CXVzZXJfdGltZTsKKwl1NjQJbmFub3NlY29uZHM7CisKKwkvKiBiYXJlYm94IGNtZCAqLworCWlm IChhcmdjID09IDIpCisJCW51bWJlcl9vZl9ydW5zID0gc2ltcGxlX3N0cnRvdWwoYXJndlsxXSwg TlVMTCwgMTApOworCWVsc2UKKwkJbnVtYmVyX29mX3J1bnMgPSAxMDAwMDsKKworCS8qIEluaXRp YWxpemF0aW9ucyAqLworCW5leHRfcmVjb3JkX2dsb2IgPSB4bWFsbG9jKHNpemVvZigqbmV4dF9y ZWNvcmRfZ2xvYikpOworCXJlY29yZF9nbG9iID0geG1hbGxvYyhzaXplb2YoKnJlY29yZF9nbG9i KSk7CisKKwlwcmludGYoIlxuIik7CisJcHJpbnRmKCJEaHJ5c3Rv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