[patch][rfa]: SID mapper component - wordsize

Dave Brolley <[email protected]>
Newsgroups gmane.comp.emulators.sid.devel
Organization Red Hat Canada, Ltd
Message-ID <[email protected]>
Hi,

I ran across a problem with the scaling of the upper bound of a mapped 
range when the wordsize feature is used. The specification

[4*1000-1010]

should allow access to the range 4000-4043, however, the upper bound is 
simply being multiplied by the wordsize, resulting in an upper bound of 
4040. If the mapper is accessed using wordsized elements, the problem 
goes unnoticed, since the mapper does not check the ending address of 
the range being accessed. However, if the mapper is accessed one byte at 
a time (as GDB often does), the final 3 bytes are considered unmapped.

Attached is the patch which corrects this. OK to commit?

Dave
mapper-wordsize.patch.txt (text/plain, 1.5 KB)
Index: component/mapper/compMapper.cxx
===================================================================
RCS file: /cvs/src/src/sid/component/mapper/compMapper.cxx,v
retrieving revision 1.12
diff -c -p -r1.12 compMapper.cxx
*** component/mapper/compMapper.cxx	11 Nov 2002 22:28:28 -0000	1.12
--- component/mapper/compMapper.cxx	13 Feb 2003 23:49:05 -0000
***************
*** 1,6 ****
  // compMapper.cxx - a bus mapper component.  -*- C++ -*-
  
! // Copyright (C) 1999-2002 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 ----
  // compMapper.cxx - a bus mapper component.  -*- 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_mapper::make_name_mapping (const
*** 774,780 ****
    // scale all values by the word width
    record.mapped_base *= record.bytes_per_word;
    record.low    *= record.bytes_per_word;
!   record.high   *= record.bytes_per_word;
    record.stride *= record.bytes_per_word;
    record.width  *= record.bytes_per_word;
  
--- 774,780 ----
    // scale all values by the word width
    record.mapped_base *= record.bytes_per_word;
    record.low    *= record.bytes_per_word;
!   record.high   = (record.high + 1) * record.bytes_per_word - 1;
    record.stride *= record.bytes_per_word;
    record.width  *= record.bytes_per_word;
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.