delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/09/21:45:31

Date: Tue, 10 Jun 1997 13:44:22 -0700
From: Bill Currie <billc AT blackmagic DOT tait DOT co DOT nz>
Subject: Re: What registers do I have to save when using external assembler
functions?
To: William McGugan <wmcgugan AT netcomuk DOT co DOT uk>
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
References: <339c502e DOT 3723200 AT nntp DOT netcomuk DOT co DOT uk>

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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019