【问题标题】:how to do hex offset calculation in assembly如何在装配中进行十六进制偏移计算
【发布时间】:2020-01-01 15:18:40
【问题描述】:

据我了解,0x11(sp) 表示 sp 的当前内存位置加 11。 例如,如果 sp 的当前内存地址为 43ec,则 0x11(sp) 表示 43ec+11=43fd。但是当我从内存转储中计数时,它实际上在偏移量 17 处。任何人都可以向我解释一下。 isnt 0x11(sp) 表示sp的偏移量11?

assembly code:
4574:  b012 f845      call  #0x45f8 <puts>
4578:  f190 3800 1100 cmp.b #0x38, 0x11(sp)
457e:  0624           jeq   #0x458c <login+0x60>

memeory dump:
                                      sp
43e0:   0300 1c46 0000 0a00 0000 7845 4141 4141   ...F......xEAAAA
43f0:   4141 4141 4141 4141 4141 4141 4138 0044   AAAAAAAAAAAAA8.D
                                        sp+11

【问题讨论】:

  • 十六进制的 11 是十进制的 17。

标签: assembly hex offset


【解决方案1】:

十进制:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ...

十六进制:

0 1 2 3 4 5 6 7 8 9  A  B  C  D  E  F 10 11 ...

【讨论】:

    猜你喜欢
    • 2018-08-27
    • 2021-01-04
    • 1970-01-01
    • 2012-03-04
    • 1970-01-01
    • 1970-01-01
    • 2020-06-30
    • 2019-07-29
    • 2019-04-16
    相关资源
    最近更新 更多