From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25224 invoked by alias); 21 Oct 2003 22:14:14 -0000 Mailing-List: contact sid-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: sid-owner@sources.redhat.com Received: (qmail 25193 invoked from network); 21 Oct 2003 22:14:12 -0000 Received: from unknown (HELO touchme.toronto.redhat.com) (207.219.125.105) by sources.redhat.com with SMTP; 21 Oct 2003 22:14:12 -0000 Received: from redhat.com (to-dhcp22.toronto.redhat.com [172.16.14.122]) by touchme.toronto.redhat.com (Postfix) with ESMTP id 17B1E800410; Tue, 21 Oct 2003 18:14:10 -0400 (EDT) Message-ID: <3F95AF9D.1050306@redhat.com> Date: Tue, 21 Oct 2003 22:14:00 -0000 From: Dave Brolley User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Dave Brolley Cc: sid@sources.redhat.com Subject: Re: [patch][rfa] generic memory enhancements References: <3F958FF9.6050001@redhat.com> In-Reply-To: <3F958FF9.6050001@redhat.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-q4/txt/msg00026.txt.bz2 This patch is postponed pending a better implementation. Dave Brolley wrote: > Hi, > > This patch enhances generic memory in several ways: > > 1) It allows writes to readonly memory if the attribute > "allow-write-to-rom" is set > 2) It warns about write to rom if "warn-write-to-rom" is set > 3) It allows the base address of the memory to be specified via the > "base-address" attribute for use in generated warnings. > > ok to commit? > > Dave > >------------------------------------------------------------------------ > >2003-10-07 Dave Brolley > > For Stan Cox > * generic.h (SID_GB_WRITE): allow_rom_write implies warn_rom_write. > >2003-10-07 Dave Brolley > > For Stan Cox > * generic.h (generic_memory): New member allow_rom_write. > (SID_GB_WRITE): Use it. > * generic.cxx (generic_memory): Initialize it. > >2003-10-07 Dave Brolley > > * generic.h (generic_read_write_bus::write_any): Move to > generic_read_only_bus. > (generic_read_only_bus::SID_GB_WRITE): Allow write to read-only-port > with a warning if ignore_rom_write is set. > >2003-10-07 Dave Brolley > > * generic.h (generic_memory): New member: base_address. > (SID_GB_WRITE): Add target->base_address to the address printed. > * generic.cxx (generic_memory): Initialize base_address. Add > base-address attribute. > >2003-10-07 Dave Brolley > > For Stan Cox > * generic.cxx (generic_memory): New member ignore_rom_write. > * generic.h (generic_read_only_bus::SID_GB_WRITE): Use it. > >2003-10-07 Dave Brolley > > For Frank Ch. Eigler > * generic.cxx (generic_memory ctor): Add evil backdoor hack to > read memory buffer base/size via attributes. > > > >------------------------------------------------------------------------ > >Index: sid/component/memory/generic.cxx >=================================================================== >RCS file: /cvs/src/src/sid/component/memory/generic.cxx,v >retrieving revision 1.8 >diff -c -p -r1.8 generic.cxx >*** sid/component/memory/generic.cxx 10 Jun 2003 18:27:10 -0000 1.8 >--- sid/component/memory/generic.cxx 21 Oct 2003 19:16:36 -0000 >*************** >*** 1,6 **** > // generic.cxx - a class of generic memories. -*- C++ -*- > >! // Copyright (C) 1999-2001,2003 Red Hat. > // This file is part of SID and is licensed under the GPL. > // See the file COPYING.SID for conditions for redistribution. > >--- 1,6 ---- > // generic.cxx - a class of generic memories. -*- C++ -*- > >! // Copyright (C) 1999-2003 Red Hat. > // This file is part of SID and is licensed under the GPL. > // See the file COPYING.SID for conditions for redistribution. > >*************** generic_memory::generic_memory() throw ( >*** 55,61 **** > imagemmap_pin (this, & generic_memory::imagemmap_handler), > imagemsync_pin (this, & generic_memory::imagemsync_handler), > read_latency (0), >! write_latency (0) > { > this->max_buffer_length = 32UL * 1024UL * 1024UL; > this->buffer = 0; >--- 55,64 ---- > imagemmap_pin (this, & generic_memory::imagemmap_handler), > imagemsync_pin (this, & generic_memory::imagemsync_handler), > read_latency (0), >! write_latency (0), >! base_address (0), >! warn_rom_write (false), >! allow_rom_write (false) > { > this->max_buffer_length = 32UL * 1024UL * 1024UL; > this->buffer = 0; >*************** generic_memory::generic_memory() throw ( >*** 82,87 **** >--- 85,98 ---- > > add_attribute ("read-latency", & this->read_latency, "setting"); > add_attribute ("write-latency", & this->write_latency, "setting"); >+ add_attribute ("base-address", & this->base_address, "setting"); >+ >+ add_attribute ("warn-rom-write-option?", & this->warn_rom_write, "setting"); >+ add_attribute ("allow-rom-write-option?", & this->allow_rom_write, "setting"); >+ >+ // Undocumented, dangerous, do not use ... >+ add_attribute_ro ("buffer-base-UNSAFE", (host_int_4*) & this->buffer); >+ add_attribute_ro ("buffer-length-UNSAFE", & this->buffer_length); > > add_attribute_virtual ("state-snapshot", this, > & generic_memory::save_state, >Index: sid/component/memory/generic.h >=================================================================== >RCS file: /cvs/src/src/sid/component/memory/generic.h,v >retrieving revision 1.5 >diff -c -p -r1.5 generic.h >*** sid/component/memory/generic.h 3 Aug 2001 06:02:46 -0000 1.5 >--- sid/component/memory/generic.h 21 Oct 2003 19:16:36 -0000 >*************** private: >*** 100,105 **** >--- 100,108 ---- > > host_int_2 read_latency; > host_int_2 write_latency; >+ host_int_4 base_address; >+ bool warn_rom_write; >+ bool allow_rom_write; > > string image_file_name; > callback_pin imageload_pin; >*************** public: >*** 125,131 **** > // some macros to make manufacturing of the cartesian-product calls simpler > #define SID_GB_WRITE(type2) \ > bus::status write(host_int_4 address, type2 data) throw () \ >! { return bus::unpermitted; } > > #define SID_GB_READ(type2) \ > bus::status read(host_int_4 address, type2& data) throw () \ >--- 128,141 ---- > // some macros to make manufacturing of the cartesian-product calls simpler > #define SID_GB_WRITE(type2) \ > bus::status write(host_int_4 address, type2 data) throw () \ >! { if (! target->warn_rom_write && ! target->allow_rom_write) \ >! return bus::unpermitted; \ >! cerr << "Warning: invalid write to ROM address 0x" << std::hex << target->base_address + address << endl; \ >! if (target->allow_rom_write) \ >! return this->write_any(address,data); \ >! else \ >! return bus::ok; } >! > > #define SID_GB_READ(type2) \ > bus::status read(host_int_4 address, type2& data) throw () \ >*************** protected: >*** 160,165 **** >--- 170,179 ---- > template > inline bus::status > read_any(host_int_4 address, DataType& data); >+ >+ template >+ inline bus::status >+ write_any(host_int_4 address, DataType data); > }; > > >*************** public: >*** 190,200 **** > SID_GB_WRITE(big_int_8); > > #undef SID_GB_WRITE >- >- protected: >- template >- inline bus::status >- write_any(host_int_4 address, DataType data); > }; > > >--- 204,209 ---- >*************** protected: >*** 203,209 **** > > template > inline bus::status >! generic_read_write_bus::write_any(host_int_4 address, DataType data) > { > const unsigned width = sizeof(typename DataType::value_type); > >--- 212,218 ---- > > template > inline bus::status >! generic_read_only_bus::write_any(host_int_4 address, DataType data) > { > const unsigned width = sizeof(typename DataType::value_type); > > >