www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/25/12:15:58

From: nikki AT kki DOT net DOT pl (Inquisitor Nikodemus)
Newsgroups: comp.os.msdos.djgpp
Subject: extended asm & function result
Date: Sat, 25 Jul 1998 16:09:00 GMT
Organization: http://news.icm.edu.pl/
Lines: 33
Message-ID: <35ba024e.1072650@news.icm.edu.pl>
NNTP-Posting-Host: pppc218.poznan.tpnet.pl
Mime-Version: 1.0
NNTP-Posting-Date: 25 Jul 1998 16:11:12 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hey!

The problem is returning function result. Let's say,I've a piece of
asm code in my function,frankly,the asm code is whole function.
In extended assembly we've got possibility of outputing some values.
Now,I don't want to declare stupid additional eg. "int result" in my
function only as a returning buffer for ,let's say, value in eax
register ( that's the factual result of asm code) - what i want is
direct return of my asm EAX value.

So, my idea was to declare somthing like that :

int    my_function ( parameters...) {
           asm ( "blahblahblah..."
                        : /* output */       "=a"  (my_function)   
                        : blah,blah
                        : blah,blah); };
instead of :

int my_function(parameters     ..){
            int result ;
          asm (" blah..."
                   ; "=a" (result) 
                   : blah
                   : blah ); return result };

and IT WORKED! but only for a one function call, the further execution
of the program resulted in SIGSEV . How to solve that ?



/greetz
Nikki 

- Raw text -


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