[patch][commit] trace_counter and GETMEM*, SETMEM*

Dave Brolley <[email protected]>
Newsgroups gmane.comp.emulators.sid.devel
Message-ID <[email protected]>
I've committed the attached patch which makes 
cgen_bi_endian_cpu::trace_counter a virtual method in order to allow 
hooks in inherited classes.

It also fixes an astonishing bug in that some of the GETMEM* and SETMEM* 
methods were reading/writing to insn memory.

Dave
sid-cgen-cpu.ChangeLog (text/plain, 266 B)
2006-05-10  Dave Brolley  <[email protected]>

	* cgen-cpu.h (trace_counter): Now virtual.
	(SETMEMBI): Write to data memory
	(class cgen_bi_endian_cpu, class cgen_bi_endian_cpu) 
	(class cgen_bi_endian_cpu, class cgen_bi_endian_cpu): Read/write
	from data memory.
sid-cgen-cpu.patch.txt (text/plain, 2.8 KB)
Index: sid/component/cgen-cpu/cgen-cpu.h
===================================================================
RCS file: /cvs/src/src/sid/component/cgen-cpu/cgen-cpu.h,v
retrieving revision 1.16
diff -c -p -r1.16 cgen-cpu.h
*** sid/component/cgen-cpu/cgen-cpu.h	28 Oct 2005 19:53:33 -0000	1.16
--- sid/component/cgen-cpu/cgen-cpu.h	10 May 2006 20:54:25 -0000
*************** protected:
*** 80,86 ****
  		       struct disassemble_info *info);
    static int cgen_symbol_at_address(bfd_vma addr, struct disassemble_info * info);
    // Counter tracing support
!   void trace_counter (PCADDR pc);
  
  public:
    // Called by semantic code to perform branches.
--- 80,86 ----
  		       struct disassemble_info *info);
    static int cgen_symbol_at_address(bfd_vma addr, struct disassemble_info * info);
    // Counter tracing support
!   virtual void trace_counter (PCADDR pc);
  
  public:
    // Called by semantic code to perform branches.
*************** public:
*** 128,134 ****
    inline void
    SETMEMBI(PCADDR pc, ADDR addr, BI value)
      {
!       return this->write_insn_memory_1 (pc, addr, value);
      }
    inline void
    SETMEMQI(PCADDR pc, ADDR addr, QI value)
--- 128,134 ----
    inline void
    SETMEMBI(PCADDR pc, ADDR addr, BI value)
      {
!       return this->write_data_memory_1 (pc, addr, value);
      }
    inline void
    SETMEMQI(PCADDR pc, ADDR addr, QI value)
*************** public:
*** 200,226 ****
    inline SF
    GETMEMSF(PCADDR pc, IADDR addr)
      {
!       SI iv = this->read_insn_memory_4 (pc, addr);
        return * (SF *)(char *)(& iv);
      }
    inline void
    SETMEMSF(PCADDR pc, ADDR addr, SF value)
      {
        SI iv = * (SI *)(char *)(& value);      
!       return this->write_insn_memory_4 (pc, addr, iv);
      }
  
    inline DF
    GETMEMDF(PCADDR pc, IADDR addr)
      {
!       DI iv = this->read_insn_memory_8 (pc, addr);
        return * (DF *)(char *)(& iv);
      }
    inline void
    SETMEMDF(PCADDR pc, ADDR addr, DF value)
      {
        DI iv = * (DI *)(char *)(& value);      
!       return this->write_insn_memory_8 (pc, addr, iv);
      }
  
    // IMEM: instruction memory calls
--- 200,226 ----
    inline SF
    GETMEMSF(PCADDR pc, IADDR addr)
      {
!       SI iv = this->read_data_memory_4 (pc, addr);
        return * (SF *)(char *)(& iv);
      }
    inline void
    SETMEMSF(PCADDR pc, ADDR addr, SF value)
      {
        SI iv = * (SI *)(char *)(& value);      
!       return this->write_data_memory_4 (pc, addr, iv);
      }
  
    inline DF
    GETMEMDF(PCADDR pc, IADDR addr)
      {
!       DI iv = this->read_data_memory_8 (pc, addr);
        return * (DF *)(char *)(& iv);
      }
    inline void
    SETMEMDF(PCADDR pc, ADDR addr, DF value)
      {
        DI iv = * (DI *)(char *)(& value);      
!       return this->write_data_memory_8 (pc, addr, iv);
      }
  
    // IMEM: instruction memory calls
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.