Address operand syntax
There are up to 4 parameters of an address operand that are presented in the syntax displacement(base register, offset register, scalar multiplier)
. This is equivalent to [base register + displacement + offset register * scalar multiplier]
in Intel syntax. Either or both of the numeric, and either of the register parameters may be omitted:
movl -4(%ebp, %edx, 4), %eax # Full example: load *(ebp - 4 + (edx * 4)) into eax
movl -4(%ebp), %eax # Typical example: load a stack variable into eax
movl (%ecx), %edx # No offset: copy the target of a pointer into a register
leal 8(,%eax,4), %eax # Arithmetic: multiply eax by 4 and add 8
leal (%eax,%eax,2), %eax # Arithmetic: multiply eax by 2 and add eax (i.e. multiply by 3)
實際 Kernel 上應用
call _sys_call_table(,%eax,4) |
在linux环境下info gcc- C Extensions:: 在里面找到Extended Asm::章节即可,《深入理解计算系统》相关章节也有介绍。 |
|
|
|
|
|
|
|
这个等价于call_sys_call_table[%eax]. 只是省略了基地址而已,所以在“,”之前是空的。 寻址格式(base_address, index, indexscale),其中indexscale也就是一个entry在表中占几个字节。 你只需要看Professional Assembly Language这本书就可以了。 |
|