5 void do_fsave ( void* p
)
7 asm __volatile__("fninit");
8 asm __volatile__("fldpi");
9 asm __volatile__("fld1");
10 asm __volatile__("fldln2");
11 asm __volatile__("fsave (%0)" : : "r" (p
) : "memory" );
14 int isFPLsbs ( int i
)
17 q
= 0; if (i
== q
|| i
== q
+1) return 1;
18 q
= 10; if (i
== q
|| i
== q
+1) return 1;
19 q
= 20; if (i
== q
|| i
== q
+1) return 1;
20 q
= 30; if (i
== q
|| i
== q
+1) return 1;
21 q
= 40; if (i
== q
|| i
== q
+1) return 1;
22 q
= 50; if (i
== q
|| i
== q
+1) return 1;
23 q
= 60; if (i
== q
|| i
== q
+1) return 1;
24 q
= 70; if (i
== q
|| i
== q
+1) return 1;
28 void show_fpustate ( unsigned char* buf
, int hide64to80
)
32 for (i
= 0; i
< 14; i
++)
33 printf("%02x ", buf
[i
]);
37 for (i
= 14; i
< 28; i
++)
38 printf("%02x ", buf
[i
]);
41 for (i
= 0; i
< 80; i
++) {
44 if (hide64to80
&& isFPLsbs(i
))
47 printf("%02x ", buf
[i
+28]);
48 if (i
> 0 && ((i
% 10) == 9))
53 int main ( int argc
, char** argv
)
56 unsigned char* buf
= malloc(108);
58 printf("Re-run with any arg to suppress least-significant\n"
59 " 16 bits of FP numbers\n");
60 for (i
= 0; i
< 108; i
++)
63 /* dump FPU state in buf, and show it. */
65 show_fpustate( buf
, xx
);