具有单个参数的 ASM 'sall' 命令?
ASM 'sall' command with single argument?
sall 指令,格式为
sall Src,Dest
翻译成Dest左移Src
Dest=Dest<<Src
但我不知道这是什么:
sall -8(%ebp)
我假设它向左移动了 -8(%ebp),但是移动了多少?
如documentation所述:
SAL r/m32, 1
表示:
Multiply r/m32 by 2, once.
您的汇编程序似乎不需要 , 1
,因为它很容易推断出来。
我刚刚在这里做了一个快速测试,看看这个:
.globl f
f:
sall -8(%ebp)
sall , -8(%ebp)
Assemble 并反汇编:
$ otool -tV example.o
example.o:
(__TEXT,__text) section
f:
0000000000000000 shll -0x8(%ebp)
0000000000000004 shll -0x8(%ebp)
$ otool -t example.o
example.o:
(__TEXT,__text) section
0000000000000000 67 d1 65 f8 67 d1 65 f8
请注意,两个操作码的结果完全相同。
sall 指令,格式为
sall Src,Dest
翻译成Dest左移Src
Dest=Dest<<Src
但我不知道这是什么:
sall -8(%ebp)
我假设它向左移动了 -8(%ebp),但是移动了多少?
如documentation所述:
SAL r/m32, 1
表示:
Multiply r/m32 by 2, once.
您的汇编程序似乎不需要 , 1
,因为它很容易推断出来。
我刚刚在这里做了一个快速测试,看看这个:
.globl f
f:
sall -8(%ebp)
sall , -8(%ebp)
Assemble 并反汇编:
$ otool -tV example.o
example.o:
(__TEXT,__text) section
f:
0000000000000000 shll -0x8(%ebp)
0000000000000004 shll -0x8(%ebp)
$ otool -t example.o
example.o:
(__TEXT,__text) section
0000000000000000 67 d1 65 f8 67 d1 65 f8
请注意,两个操作码的结果完全相同。