This is the mail archive of the sid@sourceware.org mailing list for the SID project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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

2006-05-10  Dave Brolley  <brolley@redhat.com>

	* 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.
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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]