Subject: Re: asm() bugs
To: Taras Ivanenko <ivanenko@ctpa03.mit.edu>
From: Scott Reynolds <scottr@edsi.org>
List: port-mac68k
Date: 05/14/1996 16:44:05
On Tue, 14 May 1996, Taras Ivanenko wrote:
> asm("movel %0, a0
> movel %1, a1
> jsr _some_external_function:
> : "=g"(A), "=g"(C) );
You should specify any registers used in the assembly code like so:
asm("..." : "=g" (A), "=g" (C) : : "a0");
> int
> mrg_NewPtr()
> {
> int result = noErr;
> u_int numbytes;
> u_int32_t trapword;
> caddr_t ptr;
>
> asm(" movl d1, %0
> movl d0, %1"
> ! : "=g" (trapword), "=g" (numbytes)
> + :: "d0", "d1");
Without the added "bashed registers" that you apparently added here, this
code can fail as you describe.