From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32132 invoked by alias); 17 Aug 2007 12:16:56 -0000 Received: (qmail 31963 invoked by uid 22791); 17 Aug 2007 12:16:54 -0000 X-Spam-Status: No, hits=-2.0 required=5.0 tests=BAYES_00,DK_POLICY_SIGNSOME,DK_SIGNED,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from rv-out-0910.google.com (HELO rv-out-0910.google.com) (209.85.198.185) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 17 Aug 2007 12:16:51 +0000 Received: by rv-out-0910.google.com with SMTP id c27so419503rvf for ; Fri, 17 Aug 2007 05:16:50 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:mime-version:content-type; b=QGC83ZSFQaDUFLCqkN0ZMDtNTnf/TOAaT/BLdgWbEe8w3K8Ru2/aIj95M9K1qBHd04yvAqck+ca5xQQnqjcpkjrDGu08InmTIvJXuqdt0Rls3S5y+fLVawYrZxFA0QrxLlQmHZzGsSGP/nf3NlJcsqF/uzGjdttELmJl0XI45GY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:mime-version:content-type; b=SK2+kZZoZdsOZjfACARYOYvnJapVnEwnYIDs6xI/Wyp2X54zMScMNyw53RJqjhgSHUYdM00097rm6gqyxAbZ5S3ZUeVm+LC/6c56mdfY/VAcK58gnfuJNLjlBeTVglIvL3WQYCd/9ZNCYsCDaXq9POqQhEVS2gpas/OTQFl+D+g= Received: by 10.141.202.12 with SMTP id e12mr1212212rvq.1187353009957; Fri, 17 Aug 2007 05:16:49 -0700 (PDT) Received: by 10.141.33.13 with HTTP; Fri, 17 Aug 2007 05:16:49 -0700 (PDT) Message-ID: <950a36fb0708170516t6b9a267fh12926e4ace046127@mail.gmail.com> Date: Fri, 17 Aug 2007 12:16:00 -0000 From: "Pieter-Jan Busschaert" To: "Andrew Lunn" Subject: [PATCH] host/dump_instr : support for byteswapping, real time, wrapped buffers Cc: ecos-discuss@ecos.sourceware.org, ecos-patches@ecos.sourceware.org MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_29855_32846460.1187353009922" X-Virus-Checked: Checked by ClamAV on sourceware.org Mailing-List: contact ecos-patches-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-patches-owner@ecos.sourceware.org X-SW-Source: 2007-08/txt/msg00026.txt.bz2 ------=_Part_29855_32846460.1187353009922 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 1147 On 17/08/07, Andrew Lunn wrote: > On Fri, Aug 17, 2007 at 10:46:15AM +0200, Pieter-Jan Busschaert wrote: > > On 17/08/07, Andrew Lunn wrote: > > > > > > Could you produce a clean patch which i can commit to CVS? > > > > I thought about that, but decided not to, because I hard-coded the > > big-endian / little-endian swapping. I could add a CDL option to > > enable / disable this swapping, or I could submit a clean patch > > without swapping at all. What do you prefer ? > > This is a host tool. So you have command line parameters. -b and -l. > Or maybe it is easier to just have -s for swap. Then you don't need to > worry about the host endien's. *) This patch adds support for byteswapping to the dump_instr host tool. *) Support for correct time is added too, based on this version by Andrew Lunn : http://ecos.sourceware.org/ml/ecos-discuss/2001-10/msg00283.html *) This patch also adds support for wrapped around instrumentation buffers. You somehow have to know the wraparound location, ie by int wrap = (instrument_buffer_pointer - &instrument_buffer[0]); diag_printf("wrap around = %d\n", wrap); ------=_Part_29855_32846460.1187353009922 Content-Type: application/octet-stream; name=dump_instr.diff Content-Transfer-Encoding: base64 X-Attachment-Id: f_f5gn6gr2 Content-Disposition: attachment; filename="dump_instr.diff" Content-length: 8089 LS0tIGVjb3MvcGFja2FnZXMva2VybmVsL2N1cnJlbnQvaG9zdC9pbnN0ci9k dW1wX2luc3RyLmMJMjAwNy0wOC0xNyAxMzo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ZTsKKyAgICAgICAgY29udGludWU7Cisg ICAgICB9CisgICAgICBicmVhazsKKyAgICB9CisKKyAgICBpZiAod3JhcHBl ZCAmJiBjbnQgPT0gZmlyc3RpdGVtKSB7ICAgICAgICAgICAgICAgICAgLy8g ZW5kIG9mIGJ1ZmZlciByZWFjaGVkCisgICAgICBicmVhazsKKyAgICB9CisK KyAgICBpZiAocmVjb3JkLnR5cGUgPT0gMCkgeworICAgICAgYnJlYWs7Cisg ICAgfQorICAgIAorICAgIGlmIChzd2FwYnl0ZXMpIHsKKyAgICAgIHJlY29y ZC50eXBlID0gc3dhcDJieXRlcyhyZWNvcmQudHlwZSk7CisgICAgICByZWNv cmQudGhyZWFkID0gc3dhcDJieXRlcyhyZWNvcmQudGhyZWFkKTsKKyAgICAg IHJlY29yZC50aW1lc3RhbXAgPSBzd2FwNGJ5dGVzKHJlY29yZC50aW1lc3Rh bXApOworICAgICAgcmVjb3JkLmFyZzEgPSBzd2FwNGJ5dGVzKHJlY29yZC5h cmcxKTsKKyAgICAgIHJlY29yZC5hcmcyID0gc3dhcDRieXRlcyhyZWNvcmQu YXJnMik7CisgICAgfQorCisgICAgaWYgKHJlY29yZC50eXBlID09IENZR19J TlNUUlVNRU5UX0NMT0NLX1RJQ0tfU1RBUlQpIHsKKyAgICAgIGlmIChmaW5k Zmlyc3RjbG9jaykgeworICAgICAgICB0aWNrcyA9ICgoQ1lHX1dPUkQ2NCly ZWNvcmQuYXJnMiA8PCAzMikgKyAoKENZR19XT1JENjQpcmVjb3JkLmFyZzEp OworICAgICAgICBwcmludGYoImZpcnN0IHRpY2sgZm91bmQgb24gaXRlbSAl ZCA9PiAlZFxyXG4iLCBjbnQsIHRpY2tzKTsKKyAgICAgICAgdGlja3MtLTsK KyAgICAgICAgcmV0dXJuOworICAgICAgfSBlbHNlIHsKKyAgICAgICAgaWYg KHRpY2tzICE9ICgoQ1lHX1dPUkQ2NClyZWNvcmQuYXJnMiA8PCAzMikgKyAo KENZR19XT1JENjQpcmVjb3JkLmFyZzEpKSB7CisgICAgICAgICAgcHJpbnRm KCJ0aWNrIGNvdW50IGVycm9yIDogdGlja3MgPSAlbGxkLCBzaG91bGQgYmUg JWxsZFxyXG4iLCAKKyAgICAgICAgICAgICAgICAgdGlja3MsICgoQ1lHX1dP UkQ2NClyZWNvcmQuYXJnMiA8PCAzMikgKyAoKENZR19XT1JENjQpcmVjb3Jk LmFyZzEpKTsKKyAgICAgICAgICB0aWNrcyA9ICgoQ1lHX1dPUkQ2NClyZWNv cmQuYXJnMiA8PCAzMikgKyAoKENZR19XT1JENjQpcmVjb3JkLmFyZzEpOwor ICAgICAgICB9CisgICAgICB9CisgICAgfQorCisgICAgaWYgKCFmaW5kZmly c3RjbG9jaykgeworI2lmZGVmIENZR0RCR19LRVJORUxfSU5TVFJVTUVOVF9N U0dTIAorICAgICAgcHJpbnRmKCIlNGQgUmVjb3JkIHR5cGUgKDB4JTA0eCk6 ICUtMjBzIHRocmVhZCAlMmQsICIsCisgICAgICAgICAgICAgY250LCByZWNv cmQudHlwZSwgY3lnX2luc3RydW1lbnRfbXNnKHJlY29yZC50eXBlKSwgCisg ICAgICAgICAgICAgcmVjb3JkLnRocmVhZCk7CisjZWxzZQorICAgICAgcHJp bnRmKCIlNGQgUmVjb3JkIHR5cGUgMHglMDR4LCB0aHJlYWQgJTJkLCAiLAor ICAgICAgICAgICAgIGNudCwgcmVjb3JkLnR5cGUsIHJlY29yZC50aHJlYWQp OworI2VuZGlmCisgICAgICBwcmludGYoInRpbWUgJTEwbGxkLCBhcmcxIDB4 JTA4eCwgYXJnMiAweCUwOHhcbiIsCisgICAgICAgICAgICAgY3Z0X3RpbWUo cmVjb3JkLnRpbWVzdGFtcCksIHJlY29yZC5hcmcxLAorICAgICAgICAgICAg IHJlY29yZC5hcmcyKTsKKworICAgICAgaWYgKHJlY29yZC50eXBlID09IENZ R19JTlNUUlVNRU5UX0NMT0NLX0lTUikgeworICAgICAgICB0aWNrcysrOwor ICAgICAgfQorICAgIH0KKworICAgIGNudCsrOworICB9CisKKyAgaWYgKGZp bmRmaXJzdGNsb2NrKSB7CisgICAgcHJpbnRmKCJmaXJzdCB0aWNrIG5vdCBm b3VuZFxyXG4iKTsKKyAgfQogfQogCiBpbnQgbWFpbihpbnQgYXJnYywgY2hh ciAqIGFyZ3ZbXSkgCkBAIC02NiwxMyArMTgwLDQwIEBACiAgIGNoYXIgKiBm aWxlbmFtZTsKICAgc3RydWN0IEluc3RydW1lbnRfUmVjb3JkIHJlY29yZDsK ICAgaW50IGNudD0wOworICBpbnQgZmlyc3RpdGVtID0gMDsKKyAgYm9vbCB3 cmFwcGVkID0gZmFsc2U7CisgIGludCBjOworCisgIG5zX3Blcl90aWNrID0g cnRjX3Jlc29sdXRpb25bMF0vcnRjX3Jlc29sdXRpb25bMV07CisgIHBzX3Bl cl9oYWxfY2xvY2sgPSBuc19wZXJfdGljayAqIDEwMDAgLyBDWUdOVU1fS0VS TkVMX0NPVU5URVJTX1JUQ19QRVJJT0Q7CisKKyAgd2hpbGUgKChjID0gZ2V0 b3B0KGFyZ2MsIGFyZ3YsICJzdzoiKSkgIT0gLTEpIHsKKyAgICBzd2l0Y2gg KGMpIHsKKyAgICBjYXNlICdzJzoKKyAgICAgIHN3YXBieXRlcyA9IHRydWU7 CisgICAgICBicmVhazsKKyAgICBjYXNlICd3JzoKKyAgICAgIGZpcnN0aXRl bSA9IGF0b2kob3B0YXJnKTsKKyAgICAgIGJyZWFrOworICAgIGNhc2UgJz8n OgorICAgICAgaWYgKGlzcHJpbnQob3B0b3B0KSkgeworICAgICAgICBmcHJp bnRmIChzdGRlcnIsICJVbmtub3duIG9wdGlvbiAnLSVjJy5cbiIsIG9wdG9w dCk7CisgICAgICB9IGVsc2UgeworICAgICAgICBmcHJpbnRmIChzdGRlcnIs ICJVbmtub3duIG9wdGlvbiAnXFx4JXgnLlxuIiwgb3B0b3B0KTsKKyAgICAg IH0KKyAgICAgIAorICAgICAgcmV0dXJuIDE7CisgICAgZGVm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yAgc2Nhbl9maWxlKGZpbGUsIGZpcnN0aXRlbSwgdHJ1ZSk7Cisg IHNjYW5fZmlsZShmaWxlLCBmaXJzdGl0ZW0sIGZhbHNlKTsKIAogICBmY2xv c2UoZmlsZSk7CiAgIHJldHVybiAoMCk7Cg== ------=_Part_29855_32846460.1187353009922--