小编Som*_*ude的帖子

如何使用汇编写入stdout?

我在尝试写文字"嗨!"时遇到了麻烦.在'stdout'.我使用Freebsd的系统调用的默认调用约定(FreeBSD Developers'Handbook:11.3.1)和我的新手组装技巧编写了这段代码.

这是代码(at&t格式):

.data
        str:
        .ascii "hi!"

.text

.globl main

main:
        pushl $0x3      # size
        pushl $str      # *buf
        pushl $0x1      # fd
        movl $0x4,%eax  # write
        int $0x80

        movl $0x1,%eax
        movl $0x0,%ebx
        int $0x80
Run Code Online (Sandbox Code Playgroud)

该系统是FreeBSD 9 x86.

x86 assembly freebsd stdout

5
推荐指数
1
解决办法
2999
查看次数

标签 统计

assembly ×1

freebsd ×1

stdout ×1

x86 ×1