Home | History | Annotate | Download | only in x86
      1 #include "tests/asm.h"
      2 #include <stdio.h>
      3 
      4 extern int foo_1 ( void );
      5 asm("\n"
      6 VG_SYM(foo_1) ":\n"
      7 "\tpushl $0\n"
      8 "\tpopfl\n"
      9 "\tmovl $0xFFFFFFFF, %eax\n"
     10 "\tmovl $0x12345678, %edx\n"
     11 "\tsubl %eax, %edx\n"
     12 "\tlahf\n"
     13 "\tret\n"
     14 );
     15 
     16 extern int foo_0 ( void );
     17 asm("\n"
     18 VG_SYM(foo_0) ":\n"
     19 "\tpushl $0\n"
     20 "\tpopfl\n"
     21 "\tmovl $0x0, %eax\n"
     22 "\tmovl $0x12345678, %edx\n"
     23 "\tsubl %eax, %edx\n"
     24 "\tlahf\n"
     25 "\tret\n"
     26 );
     27 
     28 int main ( void )
     29 {
     30   printf("0x%x\n", foo_0());
     31   printf("0x%x\n", foo_1());
     32   return 0;
     33 }
     34