From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NFcG8-0005n8-Go for qemu-devel@nongnu.org; Tue, 01 Dec 2009 18:35:52 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NFcG5-0005mo-LB for qemu-devel@nongnu.org; Tue, 01 Dec 2009 18:35:51 -0500 Received: from [199.232.76.173] (port=48118 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NFcG5-0005ml-Gh for qemu-devel@nongnu.org; Tue, 01 Dec 2009 18:35:49 -0500 Received: from fe02x03-cgp.akado.ru ([77.232.31.165]:49280 helo=akado.ru) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NFcG5-00088K-2z for qemu-devel@nongnu.org; Tue, 01 Dec 2009 18:35:49 -0500 Date: Wed, 2 Dec 2009 02:35:30 +0300 (MSK) From: malc Subject: Re: [Qemu-devel] TBL register permissions for PPC In-Reply-To: <8F6B1156-5574-41A3-B2EE-978E77391EF7@suse.de> Message-ID: References: <4aa8564b0912011033n68653e6dufc4bd87ccaf030a5@mail.gmail.com> <8F6B1156-5574-41A3-B2EE-978E77391EF7@suse.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: Dima Ilyevsky , qemu-devel@nongnu.org On Wed, 2 Dec 2009, Alexander Graf wrote: > > On 01.12.2009, at 19:33, Dima Ilyevsky wrote: > > > Hello All, > > > > I have a question about read permissions of TBL SPR for all ppc processors: > > I have discovered that my application, compiled by WindRiver diab compiler and running in vxworks OS on ppc405 architecture bumps into exception generated when trying to read TBL or TBU registers: > > Unless Linux does something funky, mftlb, mftbu (and mftb on 64 bit) are readable from PR=1. > > int main() > { > long tbu=0, tbl=0; > > asm("mftbu %0" : "=r" (tbu)); > asm("mftbl %0" : "=r" (tbl)); > > printf("TB: %#x %#x\n", tbl, tbu); > } > > agraf@lychee:/tmp> ./mftb > TB: 0xc0397180 0x603 > > However it can't be written to: > > asm("mttbl %0" : : "r" (tbl)); > > agraf@lychee:/tmp> ./mftb > Illegal instruction 7.2.1 Writing the Time Base Writing the Time Base is privileged, and can be done only in hypervisor state. Reading the Time Base is not privileged; it is discussed in Chapter 4 of Book II. > > > So yes, I'd suspect a bug in qemu here. Feel free to send a patch. > > Alex > -- mailto:av1474@comtv.ru