Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/regress/sys/kern/ras



Hi,

Bill Studenmund wrote:
> On Tue, Jan 06, 2004 at 09:40:57PM +0000, Martin Husemann wrote:
> >
> > Module Name:        src
> > Committed By:       martin
> > Date:               Tue Jan  6 21:40:57 UTC 2004
> >
> > Added Files:
> >     src/regress/sys/kern/ras: Makefile.inc
> >
> > Log Message:
> > Avoid optimizations that move common code out of the RAS.
> > The compiler does not understand RAS, so it makes wrong assumptions
> > about the lifetime of register values.
> 
> Wouldn't it be better to tell the compiler that it can't reorder? I'm
> concerend that by relying on compile settings we end up with something
> bit fragile.
> 
> For C code, "volatile" (or "__volatile" or however we spell it now) is the=
> 
> way to go. I realize you have some .s files in here, but there should be a=
> 
> way to tell the compiler to not move code around there too.
> 

Volatile is good - but unfortunately not always enough.

RAS (when a section is interrupted) just (re)sets the PC 
- it does not restore other registers or auxiliary memory.

This means that (excluding the last write opcode) the ras section
should not modify any registers (or auxiliary memory) that are
live (will be read later in the code) at the beginning of the section.

When optimizing the compiler is more likely to find registers
that are live at the beginning - but not at the end of the section
and reuse them.
( Not optimizing does not guarantee ras compatible code ) 

I don't think RAS should be coded in C - but the alternative, writing
assembly code for each architecture, also sucks.

        Stephan




Home | Main Index | Thread Index | Old Index