小编fro*_*i78的帖子

如果用两个变量或一个变量和一个数字文字进行加法运算,为什么从C ++调用的汇编函数在标志中给出不同的结果?

如果有人可以,请帮助我!

我编写了3行汇编代码以获取RFLAGS的值:

PUBLIC x64rflags
.code
; Caller C++ function prototype: unsigned long long int x64rflags();
x64rflags PROC     
    pushfq          ; RFLAGS into stack
    pop rax         ; RAX = RFLAGS
    ret    
x64rflags ENDP
End
Run Code Online (Sandbox Code Playgroud)

我在C ++库中使用它来检查C ++程序中的标志:

//The RFLAGS query function. Result in unsigned long long int value.
extern "C"
{
    unsigned long long int x64rflags();
}

//The FLAGS bits decimal values
enum
{
    FLAGS_CF = 1, //Carry
    FLAGS_PF = 4, //Parity
    FLAGS_AF = 16, //Adjust (Auxiliary carry)
    FLAGS_ZF = 64, //Zero …
Run Code Online (Sandbox Code Playgroud)

c c++ assembly flags

0
推荐指数
1
解决办法
67
查看次数

标签 统计

assembly ×1

c ×1

c++ ×1

flags ×1