disassembly

Understanding disassembled C code: dec %eax and movl $0x0,-0x8(%ebp)

我是研究僧i 提交于 2020-07-09 19:52:17
问题 I'm trying to understand the lines in a piece of disassembled code as shown below. I'd like to know the following: dec %eax : Why is the eax register being decremented? What is the initial value of the eax register? movl $0x0,-0x8(%ebp) : Why are we moving the value 0x0 onto the stack? Doesn't movl store a 32-bit value (4 bytes)? If so, why is the value being stored 8 bytes below the base pointer instead of 4 bytes? Here's the disassembled binary: Contents of section .text: 0000 554889e5

Understanding disassembled C code: dec %eax and movl $0x0,-0x8(%ebp)

核能气质少年 提交于 2020-07-09 19:51:03
问题 I'm trying to understand the lines in a piece of disassembled code as shown below. I'd like to know the following: dec %eax : Why is the eax register being decremented? What is the initial value of the eax register? movl $0x0,-0x8(%ebp) : Why are we moving the value 0x0 onto the stack? Doesn't movl store a 32-bit value (4 bytes)? If so, why is the value being stored 8 bytes below the base pointer instead of 4 bytes? Here's the disassembled binary: Contents of section .text: 0000 554889e5

How does this x86 Assembly code create a string?

女生的网名这么多〃 提交于 2020-06-09 04:28:05
问题 I'm studying the x86 assembly language. In order to better understand what's going on behind the scenes of string creation, I have a sample program that just prints a string. GCC produced the following Assembly program, and I'm having trouble understanding the compiler's output: Assembly Code: Dump of assembler code for function main: 0x0000000000400596 <+0>: push %rbp 0x0000000000400597 <+1>: mov %rsp,%rbp 0x000000000040059a <+4>: sub $0x10,%rsp 0x000000000040059e <+8>: movq $0x400668,-0x8(

X86 encode near call relative offset

丶灬走出姿态 提交于 2020-06-08 18:58:52
问题 Let's say I've the following set of instructions: 00E79E00 | E8 AE580000 CALL someprocess.00E7F6B3 00E79E05 | 85C0 TEST EAX, EAX (output taken from OllyDbg) How do I encode the rel32 offset from the near call(0xE8) so I can get the absolute position I can jump to? I know that the offset is relative to the next instruction and is calculated by subtracting the target with it. My question is: how do I 'reverse' this so I get the function addres 00E7F6B3 from the relative offset AE580000 回答1: You