如何使用sys_write显示寄存器值?

时间:2019-04-11 00:31:36

标签: assembly x86 gas

我想显示参数计数(argc)。我知道ESP寄存器指向argc,但无法将值传递给ECX注册表。我该怎么办?

EXIT = 1
READ = 3
WRITE = 4
STDOUT = 1
SYSCALL32 = 0x80
ERR_CODE = 0

.text
.global _start
_start:
    mov $WRITE, %eax
    mov $STDOUT, %ebx
    mov %esp, %ecx
    mov $1, %edx
    int $SYSCALL32
    ret

_exit:
    mov $EXIT, %eax
    mov $ERR_CODE, %ebx
    int $SYSCALL32

0 个答案:

没有答案