小编fei*_*ty2的帖子

为什么我必须玩“rsp”来调用 C++ 函数?

我刚刚开始我的组装之旅,很明显我是一个新手,我一直在编写相当简单和基本的程序,我只是注意到一些奇怪的东西(对我来说)。

一个程序给出以二进制 111 结尾的表格中的数字计数

入口点:

#include <iostream>
#include <cstdlib>

extern "C" auto _start(void *, void *)->void;

auto print_msg(char *msg) {
    std::cout << msg;
}

auto print_int(uint64_t val) {
    std::cout << val;
}

auto main()->int {
    _start(print_int, print_msg);
    std::cout << std::endl;
    system("pause");
}
Run Code Online (Sandbox Code Playgroud)

集会:

.const
_tab    dw 65535, 61951, 61949, 61925, 61927, 61734, 61735, 61728
_LENGTH = ($ - _tab) / 2
_msg_1  db 'There are ', 0
_msg_2  db ' numbers ending with 111 in binary!', 0

.code
_start proc …
Run Code Online (Sandbox Code Playgroud)

windows assembly x86-64 masm calling-convention

3
推荐指数
1
解决办法
1089
查看次数

标签 统计

assembly ×1

calling-convention ×1

masm ×1

windows ×1

x86-64 ×1