Assembly: One thing to note about lea

The utility of lea and mov is different. If the current value of %rsi is 0,
lea 0x28(%rsi),%rax, this only calculates an address, rather than performing address access.
mov 0x8(%rsi),%rsi, and this mov needs to access the memory address after calculating the address. If rsi is 0, an illegal access error occurs.
You need to pay attention to this when looking at the compilation. Don't be fooled.

374d30: 55 push %rbp
374d31: 48 8d 46 28 lea 0x28(%rsi),%rax ,,,, this should also be wrong
374d35: 4d 89 c1 mov %r8,%r9
374d38: 49 89 c8 mov %rcx, %r8
374d3b: 48 89 d1 mov %rdx,%rcx
374d3e: 48 89 c2 mov %rax,%rdx
374d41: 48 89 e5 mov %rsp,%rbp
374d44: 41 54 push %r12
374d46: 49 89 fc mov %rdi ,%r12
374d49: 53 push %rbx
374d4a: 48 8d 5d a0 lea -0x60(%rbp),%rbx
374d4e: 48 89 df mov %rbx,%rdi
374d51: 48 83 ec 50 sub $0x50,%rsp
374d5 5: 48 8b 76 08 mov 0x8(%rsi),%rsi ,,,, stuck in this line, the current value of rsi is 0,

Guess you like

Origin blog.csdn.net/qq_36428903/article/details/132735548