In-depth understanding of computer systems - Chapter III -3.4 access information

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/weixin_40199047/article/details/102474613

X86-64 a central processing unit (CPU) 16 contains a set of 64-bit values stored in general-purpose registers . These registers; and pointers for storing integer data.
Write pictures described here
1 and 2 for the generation of byte instruction byte number of holding remaining byte unchanged ; generating a 4-byte number of the instruction will high-order 4 bytes set to zero .

3.4.1 Number of operational indicators

Most instructions have one or more numbers (the operand) operation , source data value indicating a performed operation to be used, and placing the results object position. The possibility of various operands are divided into three types . The first is immediate (immediate) ; a second register (Register) ; a third memory references .
There are many different addressing modes .
Write pictures described here

3.4.2 Data transfer instructions

Is the most frequently used instructions to copy data from one location to another location command.
The most simple data transfer instruction - MOV class .
Write pictures described here
Example MOV instruction:
Write pictures described here
Write pictures described here
moving packed instruction following:
Write pictures described here
extension:
Write pictures described here
tips: Assembler always quadword register memory references.

movb  $0xF, (%eax)

Behind the operand of an instruction is wrong.

3.4.3 Data transfer Example

Write pictures described here
Good practice:
Here Insert Picture Description
answer (reverse):
Here Insert Picture Description

3.4.4 push and pop the stack data

Write pictures described here
A quadword value pushed onto the stack, the stack pointer is decremented first of all to 8, the value is then written to the new stack address. E.g:

pushq %rbp

Equivalent to

Decrement stack pointer
subq $8, %rsp
Store %rbp on stack
movq %rbp, (%rsp)

Specific process is as follows:
Write pictures described here

Guess you like

Origin blog.csdn.net/weixin_40199047/article/details/102474613