From c11c0ef01cbd77f9eedc5d8c36d570072d0a2b63 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Sat, 27 Dec 2025 00:14:20 +0800 Subject: [PATCH] TEST.s --- TEST.s | 6 ++++++ inst.s | 27 ++++++++++++++++----------- 2 files changed, 22 insertions(+), 11 deletions(-) create mode 100644 TEST.s diff --git a/TEST.s b/TEST.s new file mode 100644 index 0000000..7e805d4 --- /dev/null +++ b/TEST.s @@ -0,0 +1,6 @@ +.text +.global test + +test: + mov %eax,%ebx + ret diff --git a/inst.s b/inst.s index 82417d2..48472f5 100644 --- a/inst.s +++ b/inst.s @@ -38,24 +38,29 @@ asm_make_inst: call asm_find_opcode movq %rax, v_op - leaq fmt, %rdi - movb 10(%rax), %al - movzbq %al, %rsi - xorq %rax, %rax - call printf +#ModRM = 0x3 = mode register + movq $0x3, %rsi + shlq $6, %rsi - leaq fmt, %rdi movq v_src, %rax movb 8(%rax), %al - movzbq %al, %rsi - xorq %rax, %rax - call printf + movzbq %al, %rax + shlq $3, %rax + orq %rax, %rsi - leaq fmt, %rdi movq v_dst, %rax movb 8(%rax), %al - movzbq %al, %rsi + movzbq %al, %rax + orq %rax, %rsi + + shlq $8, %rsi + movq v_op, %rax + movb 10(%rax), %al + movzbq %al, %rax + orq %rax, %rsi + xorq %rax, %rax + leaq fmt, %rdi call printf pop %rbp -- 2.25.1