This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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]

Re: Adding soft-registers




James Dessart wrote:

On Thu, 8 Jan 2004, Stephane Carrez wrote:



FYI the 6809 is intermediate between 68HC11 and 68HC12: same regs,
same instruction set, same addressing modes as HC11 + restricted auto increment
mode (restricted compared to HC12).  My feeling is that you should
be able to steal the hole hc11 port and hack it to your needs (and pretend
it is an HC12 as the 6809 is closer to it then to HC11; except for movXXX patterns:-) ).


There is a difference, a rather big one, in the direct mode.  The HC11 and
HC12s only address page 0.  The 6809 has a register to configure which 256
byte page that the direct mode points at.  As a result, two machines which
I know of that use the 6809 (the TRS-80 Color Computer series and the
Thomson series from France) both have content in page 0 in a normal
configuration, that the application may want to access.

As far as gcc is concerned, this is minor. This does not affect the code generation. The difference in addressing modes and difference of instruction set is more important as the 6809 is between the two (you must disable the tbcc and dbcc insn for example).


So the page 0 implementation that those ports use is limited. What would be nice is a run-time configured page that contains the registers. The direct page register could be configured in the runtime, and the compiled code wouldn't know the difference. The problem is that the segment that would be used would need to be on a page boundary... I'm not sure the assembler or linker are properly set up to do that sort of thing in a memory-efficient way. What do you think, Eric? Other than me, you're probably the one who's played with those tools the most, and perhaps the author. :)

James

This can be done by the linker script. You should specify a region that you map wherever you want on 256b boundary. Your registers/direct addressing global variables should be put in a section that is mapped to that region.

You can even manage to make the linker perform linker relaxation and transform
any 16-bit extended addressing into direct page addressing.  The hc11 linker
performs that.  This is triggered for [0..0xff] addresses but could be changed
for whatever page.

Stephane

--
        Home                           Office
E-mail: stcarrez@nerim.fr              Stephane.Carrez@solsoft.com
WWW:    http://stcarrez.nerim.net      http://www.solsoft.com
        Free the Software!             Security Policy Management



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