From mint-bounce@lists.fishpool.fi  Fri Dec 18 18:02:08 2009
X-Session-Marker: 616E6F64796E654078706C6F726E65742E636F6D
X-Filterd-Recvd-Size: 2236
From: "Roger Burrows" <rfburrows@ymail.com>
Organization: Anodyne Software
To: mint <mint@lists.fishpool.fi>
Date: Fri, 18 Dec 2009 17:58:33 -0500
MIME-Version: 1.0
Subject: Re: [MiNT] Missing clobbered register in gemlib
Message-ID: <4B2BC2C9.307.15F63FE@rfburrows.ymail.com>
Priority: normal
In-reply-to: <4B2BF08D.4070101@freesbee.fr>
References: <20091210202514.b9397305.mandin.patrice@orange.fr>, <op.u45es6sjofd6j1@descaro.cpe.ish>, <4B2BF08D.4070101@freesbee.fr>
X-mailer: Pegasus Mail for Windows (4.41)
Content-type: text/plain; charset=ISO-8859-1
Content-description: Mail message body
X-ecartis-version: Ecartis v1.0.0
Sender: mint-bounce@lists.fishpool.fi
Errors-to: mint-bounce@lists.fishpool.fi
X-original-sender: rfburrows@ymail.com
Precedence: bulk
List-help: <mailto:ecartis@lists.fishpool.fi?Subject=help>
List-unsubscribe: <mailto:mint-request@lists.fishpool.fi?Subject=unsubscribe>
List-Id: <mint.lists.fishpool.fi>
X-List-ID: <mint.lists.fishpool.fi>
List-subscribe: <mailto:mint-request@lists.fishpool.fi?Subject=subscribe>
List-owner: <mailto:tjhukkan@fishpool.fi>
List-post: <mailto:mint@lists.fishpool.fi>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from Quoted-printable to 8bit by mail.sparemint.org id nBIN27xH009341

Hello Vincent,
On 18 Dec 2009 at 22:13, Vincent Rivière wrote:
> 
> GEM/assembler specialists should have a look at the following code from the 
> GemLib:
> 
> In gemlib/gem_aesP.h:
> static inline void
> _aes_trap (AESPB * aespb)
> {
> 	__asm__ volatile (
> 		"move.l	%0,d1\n\t"	/* &aespb */
> 		"move.w	#200,d0\n\t"
> 		"trap	#2"
> 		:
> 		: "a"(aespb)
> 		: "d0","d1","a0","memory" /* <--- Clobber List here */
> 	);
> }
> 
> The Clobber List assumes that a trap #2 for AES does not change the value of
> a2 and other registers. Is this true ?

In two different Atari developers' newsletters, it is stated that registers D0-
D2 & A0-A2 may be destroyed by a trap call.  Also, the Lattice C AES interface 
routine specifically saves and restores A2/D2 across the trap (A0,A1,D0,D1 are 
always treated as 'volatile' across subroutine calls, so the interface routine 
is allowed to clobber them via the trap).

> One could add other registers to the clobber list (at least a1, maybe d2 and
> a2) to see what happens. This could prevent some optimization to occur 
> (very, very little), but in no case it could introduce bugs.
> 
> Similar stuff in gemlib/gem_vdiP.h:
> _vdi_trap_esc
> _vdi_trap_00
> 

I think it would be a good idea to make the clobber list A0-A2, D0-D2.

Roger Burrows


