• [Fw] assembly code in gas syntax


    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::章节即可,《深入理解计算系统》相关章节也有介绍。
     
     

    TOP

     

    这个等价于call_sys_call_table[%eax].
    只是省略了基地址而已,所以在“,”之前是空的。
    寻址格式(base_address, index, indexscale),其中indexscale也就是一个entry在表中占几个字节。
    你只需要看Professional Assembly Language这本书就可以了。
  • 相关阅读:
    jenkins任务
    追涨手段
    识别上升浪中的假反弹假阻力
    上升浪的判断
    点位超过10的上涨高位转折点
    纯碱下跌巨幅捕捉
    纯碱规律
    玉米
    iOS基础之界面通信
    iOS基础之UINavigationController(导航视图控制器)
  • 原文地址:https://www.cnblogs.com/bittorrent/p/3354361.html
Copyright © 2020-2023  润新知