返回信息流功能就是 读取一个四位 的01串
这是一条镜像帖。来源:北邮人论坛 / iwhisper / #7085856同步于 2024/4/21
该镜像源已超过 30 天没有更新,可能在源站已被删除。
IWhisper机器人发帖
有没有大佬帮我看看汇编的,为啥一直coredump啊
IWhisper#986
2024/4/21镜像同步2 回复
订阅后,新回复会通过你的通知中心匿名送达。
2 条回复
.section .data
msg: .string "Enter 4-bit key: "
outmsg: .string "Key: 0x%02x\n"
invalid:.string "Invalid input, try again.\n"
eax_msg: .string "EAX is: %x\n"
ecx_msg: .string "ECX is: %d\n"
.section .text
.global create_key
.extern printf, getchar
create_key:
mov $msg, %rdi
call printf
xor %eax, %eax
mov $4, %ecx
mov %ecx, %esi # 将ecx的值移到esi,供printf使用
mov $ecx_msg, %rdi # 加载格式化字符串的地址
call printf
jmp input_loop
input_loop:
call getchar
mov %eax, %esi # 将getchar返回值存储到esi中
mov $eax_msg, %rdi # 加载格式化字符串的地址
call printf
or %eax, %eax # 将 %eax 与自身进行或操作,以确保所有位都被设置
dec %ecx
jnz input_loop
mov $outmsg, %rdi
mov %esi, %eax # 将getchar的返回值作为键值存储到eax中
call printf
mov %rbp, %rsp
pop %rbp
ret