From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1C2GrQ-000184-W9 for qemu-devel@nongnu.org; Tue, 31 Aug 2004 18:12:17 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1C2GrO-000172-Ia for qemu-devel@nongnu.org; Tue, 31 Aug 2004 18:12:16 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C2GrO-00016x-FC for qemu-devel@nongnu.org; Tue, 31 Aug 2004 18:12:14 -0400 Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.34) id 1C2GmL-0007Iw-OF for qemu-devel@nongnu.org; Tue, 31 Aug 2004 18:07:02 -0400 Message-ID: <4134F602.2030809@gmx.com> Date: Wed, 01 Sep 2004 00:04:50 +0200 From: "Bochnig, Martin" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] SPARC - host support in vl.c Reply-To: bochnig@pool.math.tu-berlin.de, qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Here my patch suggestions to add SPARC host support to vl.c : #elif defined(__sparc__) /* Derived from: "m68k updates #2" by Richard Zidlicky "crude hack to get some sort of rdtsc support" */ #include static int64_t cputicks=0; static struct timeval lastcptcall={0,0}; // assume 5 MHz Pentium, min 80 ticks between rdtsc calls int64_t cpu_get_real_ticks(void) { struct timeval tp; gettimeofday(&tp,(void*)0); if (tp.tv_sec == lastcptcall.tv_sec && tp.tv_usec == lastcptcall.tv_usec ){ cputicks += 1; } else { cputicks=0; lastcptcall=tp; } return ((int64_t)tp.tv_sec*1000000+tp.tv_usec)*5+cputicks; } #elif defined(__sparc64__) /* I'm not sure it was worth it, personally. * *UltraSparc: * * unsigned long x; * asm volatile ("rd %tick, %0" : "=r"(x)); * * Earlier Sparcs do not have this feature. * * */ int64_t cpu_get_real_ticks(void) { int64_t val; asm volatile ("rd %%tick, %0" : "=r"(val)); return val; } #else #error unsupported CPU #endif Any ideas would be appreciated. Martin