mirror of
https://github.com/ioacademy-jikim/debugging
synced 2025-06-08 08:26:14 +00:00
34 lines
504 B
C
34 lines
504 B
C
#include "tests/asm.h"
|
|
#include <stdio.h>
|
|
|
|
extern int foo_1 ( void );
|
|
asm("\n"
|
|
VG_SYM(foo_1) ":\n"
|
|
"\tpushl $0\n"
|
|
"\tpopfl\n"
|
|
"\tmovl $0xFFFFFFFF, %eax\n"
|
|
"\tmovl $0x12345678, %edx\n"
|
|
"\tsubl %eax, %edx\n"
|
|
"\tlahf\n"
|
|
"\tret\n"
|
|
);
|
|
|
|
extern int foo_0 ( void );
|
|
asm("\n"
|
|
VG_SYM(foo_0) ":\n"
|
|
"\tpushl $0\n"
|
|
"\tpopfl\n"
|
|
"\tmovl $0x0, %eax\n"
|
|
"\tmovl $0x12345678, %edx\n"
|
|
"\tsubl %eax, %edx\n"
|
|
"\tlahf\n"
|
|
"\tret\n"
|
|
);
|
|
|
|
int main ( void )
|
|
{
|
|
printf("0x%x\n", foo_0());
|
|
printf("0x%x\n", foo_1());
|
|
return 0;
|
|
}
|