Home | History | Annotate | Download | only in test
      1 
      2 #include <stdio.h>
      3 #include <stdlib.h>
      4 
      5 void do_fstenv ( void* p )
      6 {
      7    asm("movl 8(%esp), %eax ; fstenv (%eax)");
      8 }
      9 
     10 void do_fldenv ( void* p )
     11 {
     12    asm("movl 8(%esp), %eax ; fldenv (%eax)");
     13 }
     14 
     15 int main ( void )
     16 {
     17    int i;
     18    unsigned short* buf = malloc(14*sizeof(short));
     19    for (i = 0; i < 14; i++)
     20       buf[i] = i;
     21    buf[0] = 0x037f;
     22 
     23    do_fldenv(buf);
     24    do_fstenv(buf);
     25    for (i = 0; i < 14; i++) {
     26       printf("%04x ", buf[i]);
     27       if (i > 0 && ((i % 12) == 11))
     28           printf("\n");
     29    }
     30    printf("\n");
     31    return 0;
     32 }
     33