From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 8471 invoked from network); 18 Dec 1998 13:14:08 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 18 Dec 1998 13:14:08 -0000 Received: from peak3.cs.hut.fi (peak3.cs.hut.fi [130.233.192.128]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id IAA21440 for ; Fri, 18 Dec 1998 08:03:46 -0500 Received: from localhost (hmallat@localhost) by peak3.cs.hut.fi (8.8.7/8.8.5) with SMTP id PAA21891 for ; Fri, 18 Dec 1998 15:02:07 +0200 Date: Fri, 18 Dec 1998 15:02:05 +0200 (EET) From: Hannu Mallat To: axp-list@redhat.com Subject: Re: LX164 and rpcc In-Reply-To: <19981217123625.G2290@zib.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sorry for the continued C source spam on the list ;-), but I've managed to track my problem down a bit further. I was stracing the little example program I posted earlier and found out that a munmap() call done by the stdio lib freaks out the process cycle counter. Here's another sample program that demonstrates what happens: #include #include #include #include #include #include #include #include #include static inline unsigned long cc64 (void) { unsigned long cc; asm volatile("rpcc %0" : "=r"(cc) : : "memory"); return cc; } int main(int argc, char* argv[]) { int i; unsigned long c1, c2; unsigned int i1, i2; for(i = 0; i < 10; i++) { char* stuff; struct stat buf; int mfd; mfd = open("/vmlinux.gz" /* or something ... */, O_RDONLY); fstat(mfd, &buf); stuff = mmap(0, buf.st_size, PROT_READ, MAP_PRIVATE, mfd, 0); c1 = cc64(); munmap(stuff, buf.st_size); c2 = cc64(); close(mfd); i1 = ((c1 >> 32ULL) & 0xffffffff) + (c1 & 0xffffffff); i2 = ((c2 >> 32ULL) & 0xffffffff) + (c2 & 0xffffffff); fprintf(stdout, "%08x %08x ... %08x %08x : %08x\n", (unsigned int)(c1 >> 32), (unsigned int)(c1 & 0xffffffff), (unsigned int)(c2 >> 32), (unsigned int)(c2 & 0xffffffff), i2 - i1); } exit(0); } Any kernel hackers out there? What's going on? Again, the sample program works fine on the OSF/1 machine I have access to. Hannu