Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kl3yx-0002a5-LP for qemu-devel@nongnu.org; Wed, 01 Oct 2008 11:51:19 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kl3yv-0002YB-CK for qemu-devel@nongnu.org; Wed, 01 Oct 2008 11:51:18 -0400 Received: from [199.232.76.173] (port=49460 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kl3yu-0002Y3-T6 for qemu-devel@nongnu.org; Wed, 01 Oct 2008 11:51:16 -0400 Received: from falcon.cybervisiontech.com ([217.20.163.9]:37772) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Kl3yu-0006at-3W for qemu-devel@nongnu.org; Wed, 01 Oct 2008 11:51:16 -0400 Received: from localhost (localhost [127.0.0.1]) by falcon.cybervisiontech.com (Postfix) with ESMTP id DDDBF7441A6 for ; Wed, 1 Oct 2008 18:51:00 +0300 (EEST) Received: from falcon.cybervisiontech.com ([127.0.0.1]) by localhost (falcon.cybervisiontech.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cUHv8IT-QU3t for ; Wed, 1 Oct 2008 18:51:00 +0300 (EEST) Received: from [10.2.1.87] (gateway.cybervisiontech.com.ua [91.198.50.114]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by falcon.cybervisiontech.com (Postfix) with ESMTP id 31E8B744180 for ; Wed, 1 Oct 2008 18:51:00 +0300 (EEST) Message-ID: <48E39C5F.4070006@icyb.net.ua> Date: Wed, 01 Oct 2008 18:50:55 +0300 From: Andriy Gapon MIME-Version: 1.0 References: <48D12AD5.2040308@icyb.net.ua> In-Reply-To: <48D12AD5.2040308@icyb.net.ua> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: pc/i386: legacy memory attributes - write only? Reply-To: 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 Sorry for top-posting. More on this topic. I looked at the code in hw/piix_pci.c, namely update_pam() and the code seems to do things quite differently from what I expected. Cases for values 0 (-R-W) and 3 (+R+W) seem to be correct: in one case both types of requests are directed to ROM and in the other they are directed to RAM. But cases for 1 (+R-W) and 2 (-R+W) seem to be quite broken: 1: effectively this should specify read-only access to RAM (write access is directed to PCI interface of ROM and ignored there), but the code does something different here. Example: set type of memory region to 3, write some data there, set the type to 1 - after that the memory contains some different data from what was written. 2: the code simply treats this case as the zero case (everything goes to ROM) Sorry for providing only a complaint (and some analysis) and not providing any patches. It is not too obvious from cpu_register_physical_memory "API" how to obtain the desired/correct behavior. on 17/09/2008 19:05 Andriy Gapon said the following: > > I am working on a BIOS-ish code geared towards 440BX/PIIX4 chipset, so I > decided to try it under qemu emulation. > > There is a snippet in the code that works as best described in 82443BX > documentation: >> As an example, consider a BIOS that is implemented on the expansion >> bus. During the initialization process, the BIOS can be shadowed in >> main memory to increase the system performance. When BIOS is shadowed >> in main memory, it should be copied to the same address location. To >> shadow the BIOS, the attributes for that address range should be set >> to write only. The BIOS is shadowed by first doing a read of that >> address. This read is forwarded to the expansion bus. The host then >> does a write of the same address, which is directed to main memory. >> After the BIOS is shadowed, the attributes for that memory area are >> set to read only so that all writes are forwarded to the expansion >> bus. > > The code tries to do exactly that by writing 20h to PCI configuration > register 20h (of device 0:0:0). Then reading and writing back the whole > F0000h-FFFFFh region and then setting the register to 10h. > > But in qemu I see that after the above operation the corresponding RAM > region contains all zero bytes. > > I think that behavior of 440BX and 440FX which qemu emulates should be > identical in this respect. > Does qemu perform proper emulation of attributes for legacy memory > segments? > Should the above work in qemu? Maybe there is some bug in my code. > -- Andriy Gapon