5 #include "x86_dumpfenv.h"
7 /* No-Wait Store x87 environment */
8 #define __fnstenv(__env) __asm__ __volatile__ \
9 ("fnstenv %0" : "=m" (*(__env)))
11 /* Store MXCSR register */
12 #define __stmxcsr(__csr) __asm__ __volatile__ \
13 ("stmxcsr %0" : "=m" (*(__csr)))
16 fenv_dump(myfenv_t *envp)
18 memset(envp, 0, sizeof(myfenv_t));
20 __fnstenv(&envp->x87);
21 __stmxcsr(&envp->mxcsr);
25 fenv_print(const myfenv_t *envp)
29 printf(" word: 0x%x\n", envp->x87.control);
30 printf("status: 0x%x\n", envp->x87.status);
31 printf(" tag: 0x%x\n", envp->x87.tag);
33 for (i = 0; i < 4; i++)
34 printf("others[%d] = 0x%x\n", i, envp->x87.others[i]);
36 printf("mxcsr: 0x%x\n", envp->mxcsr);
46 * printf() taints fp environment; therefore first populate the
47 * structures and and then print their contents.
49 * Many thanks to sjamman@ who saved the day!