Date: Tue, 10 Jun 1997 13:44:22 -0700 From: Bill Currie Subject: Re: What registers do I have to save when using external assembler functions? To: William McGugan Cc: djgpp AT delorie DOT com Reply-to: billc AT blackmagic DOT tait DOT co DOT nz Message-id: <339DBCA6.63B1@blackmagic.tait.co.nz> Organization: Tait Electronics NZ MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit References: <339c502e DOT 3723200 AT nntp DOT netcomuk DOT co DOT uk> Precedence: bulk William McGugan wrote: > > What registers do I have to save when using external assembler > functions? I'm asking because my assembly functions crash with -O, and > I thought it might be due to DJGPP using a register variable that was > corrupted my asm functions. %ebx, %esi, %edi, %ebp, %es, %ds and %ss (%cs is pretty obvious:) %eax, %edx and %ecx are all free for your use (however, %eax is used for return values (so is %edx, but only for 8 byte values)). %fs and %gs are also free, however, libc uses %gs internally and never touches %fs. > I have declared all my global variables and external functions as > volatile, but that doesn't seem to help. No, it wouldn't, as the variables getting scragged are probably your locals (they tend to go into register when gcc is optimising). Bill -- Leave others their otherness.