gpt4 book ai didi

linux - 在 Linux 64 位中处理命令行

转载 作者:IT王子 更新时间:2023-10-29 00:50:36 25 4
gpt4 key购买 nike

<分区>

我在从 Linux 64 位汇编程序访问进程命令行时遇到问题。为了用最少的代码重现这一点,我制作了这个打印程序名称前 5 个字符的 32 位程序:

.section .text.globl _start_start: movl  %esp, %ebp movl $4, %eax        # write movl $1, %ebx        # stdout movl 4(%ebp), %ecx   # program name address (argv[0]) movl $5, %edx        # hard-coded length int  $0x80 movl $1, %eax movl $0, %ebx int  $0x80

这个程序正在运行。当我将其转换为 64 位并在 Linux 64 中运行时,它不打印任何内容:

.section .text.globl _start_start: movq  %rsp, %rbp movq $4, %rax movq $1, %rbx movq 8(%rbp), %rcx       # program name address ? movq $5, %rdx int  $0x80 movq $1, %rax movq $0, %rbx int  $0x80

我的错误在哪里?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com