【发布时间】:2015-04-19 12:42:53
【问题描述】:
此代码应该输出 1 位的密钥长度,但它输出 segfault。
我不明白我做错了什么,问题一定出在清单的第一部分,因为我直接从书中取了flen函数:
section .text
global _start ;must be declared for linker (ld)
_start:
mov edi,key
call flen
mov ebx,1
add ecx,38
mov edx,1
int 0x80
flen: ;length of string on es:edi
xor eax,eax
xor ecx,ecx
dec ecx
cld
repne scasb
neg ecx
ret
xor eax,eax
inc eax
int 0x80
section .data
key db '123456',0x0
keylen equ $ - key ;length of our dear string
plaintext times 256 db 1
【问题讨论】:
标签: assembly segmentation-fault nasm