Assembler code, need help understand what 'movzwl 0x40272e(,%rax,4),%esi' is doing

▼魔方 西西 提交于 2021-02-10 17:29:22

问题


i understand what the other calls are doing but when i get line 36, i don't get what's happening?

my 3 parameters are rsi = 5, rdx = 6, rcx = 7

On line 26 my %rax = 25 then on line 30 my rsi changes from 5 to 37

can you explain why this happens? and what is 0x40272e

0x0000000000401212 <+0>:        sub    $0x8,%rsp                # subtract 8 from rsp
0x0000000000401216 <+4>:        lea    -0x1(%rdx),%rax          # rax = -1 + rdx  
0x000000000040121a <+8>:        cmp    $0xf,%rax                # rax ?? 0xf '-1' 'SI' 
0x000000000040121e <+12>:   ja     0x40124f <phase_3+61>    # if(rax > 0xf) goto L1 
0x0000000000401220 <+14>:   cmp    $0x2,%rdi                # rdi ?? 0x2 
0x0000000000401224 <+18>:   jle    0x40124f <phase_3+61>    # if(rdi <= 0x2) goto L1 
0x0000000000401226 <+20>:   cmp    $0xa,%rsi                # rsi ?? 0xa '10' 'LF' 
0x000000000040122a <+24>:   ja     0x40124f <phase_3+61>    # if(rsi > 0xa) goto L1   
0x000000000040122c <+26>:   lea    (%rsi,%rsi,4),%rax       # rax = 5 * rsi 
0x0000000000401230 <+30>:   movzwl 0x40272e(,%rax,4),%esi   # esi = 0 + rax * 4 
0x0000000000401238 <+38>:   movsbq 0x402801(,%rdx,4),%rax   # rax = 0 + rdx * 4 
0x0000000000401241 <+47>:   xor    %rax,%rsi                # rsi ^ rax 
0x0000000000401244 <+50>:   sete   %al                      # if (rsi == rax) al = 1
0x0000000000401247 <+53>:   movzbl %al,%eax                 # rax = al
0x000000000040124a <+56>:   cmp    %rcx,%rsi                # rsi ?? rcx
0x000000000040124d <+59>:   je     0x40125b <phase_3+73>    # if (rsi == rcx) goto L2 
0x000000000040124f <+61>:   callq  0x401b17 <bomb_explodes> # boom boom
0x0000000000401254 <+66>:   mov    $0xffffffffffffffff,%rax # rax = -1
0x000000000040125b <+73>:   add    $0x8,%rsp                # add 8 to rsp
0x000000000040125f <+77>:   retq                            # return rax

来源:https://stackoverflow.com/questions/53146459/assembler-code-need-help-understand-what-movzwl-0x40272e-rax-4-esi-is-doi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!