help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

X86 In-Line Assembly using Floating Point with GCC and GNU Assemb ler


From: jerry . williamson
Subject: X86 In-Line Assembly using Floating Point with GCC and GNU Assemb ler
Date: Wed, 23 May 2001 18:03:28 -0500

Hello --


I am stuck on something that should be relatively simple.
I am using in-line assembly in my C-code with GCC on Linux
and I was to get access to the floating point unit -- 
I can load constants fine but I need to do loads and stores
from memory and the fstp function is causing a segmentation
fault.

This probably can be answered in one or two sentences but I 
have been looking for example code for FP using GNU ASM and
have come up dry.

asm volatile ("finit\n\t"
              "fldpi\n\t"
              "mov %1, %%eax\n\t"
              "fst %%st(3)\n\t"
              "fst %%st(0)\n\t"
/*            "fstp (%%eax)\n\t"    */
              :"=r" (TESTCODE1OUT) , "=r" (TEST1)
              : "r" (TEST1)
              :"memory", "%eax", "%ebx");


When I uncomment the above line containing fstp -- segmentation
fault results.

TEST1 is a structure defined as follows:


typedef struct ld {           /* ld represents the 80-bit extended real
format *
   unsigned long lo, hi;
   unsigned short exp;
   } LD;

LD *TEST1;




--
**************************************************************************
* Jerry Williamson @ Advanced Micro Devices  | "It is logical. The needs *
*          jerry.williamson@amd.com          | of the many outweigh      *
*                                            | the needs of the few --   *
*                                            | or the one." -- Spock     *
**************************************************************************





reply via email to

[Prev in Thread] Current Thread [Next in Thread]