X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f Date: Thu, 28 Feb 2002 19:22:49 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Luis cc: djgpp AT delorie DOT com Subject: Re: Help with extended inline asm (or I'm stupid) In-Reply-To: <6124b64f.0202280857.5d8c4dda@posting.google.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On 28 Feb 2002, Luis wrote: > int obt_flags (char* buffer) > { > asm ( > "fsave %0\n\t" > : // no outputs > : "m" (buffer) > : "memory" > ); > } > > void main(void) > { > char buffer[108]; > > obt_flags(buffer); > printf("%s\n",buffer); > } > > It compiles fine, but when executing it crashes with a sigsev FAULT, > when executing the print instruction. The info saved by FNSAVE is not text, it's binary data. In particular, there's no guarantee that it looks like a null-terminated C string. So trying to print that buffer with printf is asking for trouble.