Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <sys/wait.h>
- //#define RUIN_STACK 1
- int main()
- {
- //__asm__("xchg %bx, %bx");
- float a = 5.7, b = 1.2;
- union ud
- {
- float c;
- int cc;
- };
- union ud u;
- __asm__ __volatile__(
- "flds %1;"
- "flds %0;"
- "fdivrp %%st,%%st(1);"
- :
- : "m" (b), "m" (a)
- );
- #ifdef RUIN_STACK
- pid_t pid;
- if ( (pid = fork()) == 0 )
- {
- float t;
- __asm__ __volatile__(
- "fstps %0;"
- "fldz;"
- "fldz;"
- "fldz;"
- "fldz;"
- "fldz;"
- "fldz;"
- "fldz;"
- "fldz;"
- : "=m" (t)
- :
- );
- exit(0);
- }
- wait(NULL);
- #endif
- __asm__ __volatile__(
- "fstps %0;"
- : "=m" (u.c)
- :
- );
- fprintf(stderr,"rrrFather: %x\n",u.cc);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement