AsmREPLx86-64 汇编语言的 REPL
AsmREPL 是一个适用于 64 位 x86 汇编语言的 REPL,支持以最低级语言进行交互式编码。
用法:
安装 gem:
$ gem install asmrepl
然后像这样启动 repl:
$ asmrepl
如果你是在macOS上,你需要用sudo启动rep。
当 REPL 启动时,它将显示所有寄存器值和标志:
================== CPU STATE ===================
rax 000000000000000000 r8 0x00007f89d0f04640
rbx 000000000000000000 r9 0x0000000000000004
rcx 0x00007f89d0f04a50 r10 000000000000000000
rdx 0x..fc611d3f0aa2900d4 r11 0x00000001033a4000
rdi 0x00007ff7bd126148 r12 000000000000000000
rsi 000000000000000000 r13 0x00007ff7bd125dc0
rbp 0x00007ff7bd125c40 r14 000000000000000000
rsp 0x00007ff7bd125c38 r15 000000000000000000
rip 0x00000001033a4001
rflags 0x0000000000000246
cs 0x000000000000002b
fs 000000000000000000
gs 000000000000000000
FLAGS: ["PF", "ZF", "IF"]
(rip 0x00000001033a4001)>
然后你可以发出命令并检查寄存器值。让我们写入 rax
寄存器并检查它的值:
(rip 0x00000001033a4001)> mov rax, 5
=============== REGISTER CHANGES ===============
rax 000000000000000000 => 0x0000000000000005
(rip 0x00000001033a4009)> rax
0x0000000000000005
(rip 0x00000001033a4009)>
现在让我们写入rbx
寄存器并将两个值相加:
(rip 0x00000001033a4009)> mov rbx, 3
=============== REGISTER CHANGES ===============
rbx 000000000000000000 => 0x0000000000000003
(rip 0x00000001033a4011)> add rax, rbx
=============== REGISTER CHANGES ===============
rax 0x0000000000000005 => 0x0000000000000008
rflags 0x0000000000000246 => 0x0000000000000202
FLAGS: ["IF"]
(rip 0x00000001033a4015)> rax
0x0000000000000008
(rip 0x00000001033a4015)> rbx
0x0000000000000003
(rip 0x00000001033a4015)>
最后,让我们检查 CPU 中的所有值:
(rip 0x00000001033a4015)> cpu
================== CPU STATE ===================
rax 0x0000000000000008 r8 0x00007f89d0f04640
rbx 0x0000000000000003 r9 0x0000000000000004
rcx 0x00007f89d0f04a50 r10 000000000000000000
rdx 0x..fc611d3f0aa2900d4 r11 0x00000001033a4000
rdi 0x00007ff7bd126148 r12 000000000000000000
rsi 000000000000000000 r13 0x00007ff7bd125dc0
rbp 0x00007ff7bd125c40 r14 000000000000000000
rsp 0x00007ff7bd125c38 r15 000000000000000000
rip 0x00000001033a4015
rflags 0x0000000000000202
cs 0x000000000000002b
fs 000000000000000000
gs 000000000000000000
FLAGS: ["IF"]
(rip 0x00000001033a4015)>
评论