| delorie.com/archives/browse.cgi | search |
| 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 <eliz AT is DOT elta DOT co DOT il> |
| X-Sender: | eliz AT is |
| To: | Luis <luisllo AT alumni DOT uv DOT es> |
| 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: | <Pine.SUN.3.91.1020228192113.7029A-100000@is> |
| MIME-Version: | 1.0 |
| 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 |
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.
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |