I. Chapter III main points of knowledge
1. Information storage
* The machine-level program treats the memory as a very large byte array and becomes the virtual memory; each byte of the memory is identified by a unique number and becomes his address.
* Hexadecimal notation/decimal and 16 binary conversions
* Two general rules for arranging bytes of an object: small-end method/big-endian method
* Three cases where byte is visible
* The string in the C language is encoded as a character array ending with a null character
* Bit-level arithmetic/logic operation/Shift operation
2. Integer representation
* Integer data type represents a finite range of integers
* unsigned encoding, signed encoding, unsigned number and signed number conversion
* Conversion principle between unsigned signed numbers in C language: the underlying bits remain unchanged
* 0 Extension: Add 0 at the beginning of an unsigned number representation
* Symbol Extension: Add a copy of the most significant bit value in the representation
* Truncation result of unsigned number/complement number
3. Integer arithmetic
* Unsigned addition/complement operation
4. Floating point number
* Understanding floating-point numbers from binary decimals
*IEEE floating-point format standard: P70
* According to EXP value, the encoded value can be divided into three kinds of cases
* The key issue for rounding is to determine the rounding direction in the middle of two possible values
* Floating point arithmetic
Two. Understanding of key points of knowledge (Lab building requirements)
1. Unsigned number, signed number (2 complement), floating point numbers, from the reverse angle to consider the cause of the vulnerability?
Any vulnerability arises because the system cannot change the limitations/unsigned number, signed number, the limitation/unsigned number of floating-point numbers, or the representation range of signed numbers, while floating-point numbers are of a large size but are imprecise
2.gcc-m32 can generate 32-bit code on a 64-bit machine
3. In C, all numeric constants beginning with 0X or 0x are often considered to be hexadecimal values
4. Two representations of byte order: The small end is "high-to-high, low-to-low", the opposite of the big-endian
5. Code Execution
6. Text data has better platform adaptability than binary data.
7. When the signed number is strongly converted to an unsigned number, the numeric value changes, but the bit representation is unchanged.
8. How do i make negative numbers equal to positive numbers?
After negative x plus u, you can convert it to (2^w+x)
9.0 extension is similar to logical left (right) shift
Converts an unsigned number to a larger data type and simply adds 0 to the front. The symbol extension is similar to the arithmetic left (right) shift. That is: To convert a complement number to a larger data type, add the most significant bit in the representation worth the copy.
10. Integers and floating-point numbers indicate the relationship of the same number
When an integer is represented by a floating-point number in a binary form, you can see that the number after the most significant bit of the integer equal to 1 is matched to the high point of the fractional portion of the float.
11. Integer and floating-point conversion rules
Integers are converted to binary representations, and then the decimal point is shifted to the left by a normalized representation, the number of decimal parts is removed, and the value of the fractional part is 0 to 23 bits, and the result of the Frac plus offset is expressed in binary notation, placed in front of the removed part, plus a sign bit.
Two. Chapter fourth knowledge points
1. Program coding and machine-level code
Program code:
gcc compiler, converting source code into executable code, c preprocessor-assembler-linker
Machine-Level code:
The format and behavior of the machine-level program, defining the "instruction set architecture Isa", defines the processor state, the instruction format, and the effect of the directive on the state
The machine-level program uses a virtual address for a practical storage address
2. Data format
Integer, Long integer stored in 4-byte format
Pointer type stored in 4-byte format
There are three types of floating-point numbers: Single, Double, extended, 4, 8, 10, respectively
3. Operand designator:
The first is the immediate number, which is the constant value
The second is a register that represents the contents of a register
The third is the memory, which accesses the memory location according to the calculated valid address.
4. operand format See textbook P113 "Note s factor must be 1, 2, 4 or 8"
5. Data transfer instructions: The different instructions are divided into instruction classes, the same class of instructions to perform the same operation "Different is the size of the operands"
The value of the instruction source operand in the 6.MOV class is copied to the destination operand "The specified value of the source operand is an immediate number, the destination operand specifies a location"
7. The stack is a data structure that can add or remove values and follow the LIFO principle.
8. Load the valid address "Leal": Read data from memory to register.
9. Unary operation and two Yuan operation
Unary operation: Only one operand, both source and destination
Binary operations: Where the second operand is both a meta and a destination
10. Shift operation: First give the shift amount, and then give the shift value, you can do arithmetic and logical right shift.
11. Condition Code: Register, which describes the properties of the most recent arithmetic or logical operation.
Most commonly used condition code: CF "Carry Mark", ZF "0 mark", SF "symbol symbol", "overflow mark"
12. Note: The CMP directive and the test instruction do not modify the values of any registers, only set the condition code.
13. Access Condition code: Three methods commonly used P125
14. Three cycles of "Do-while" "while" "for"
15. A process involves passing data and control from one part of the code to another, allocating space for local variables of the process at entry, and freeing space on exit.
16. Stack frame structure: The portion of the stack allocated for a single process is called a "stack frame"
When the program executes, the stack pointer can be moved, and most information access is for the frame pointer
17. Transfer control: Call instruction, leave instruction, RET directive P150
18. Recursive process P156. Program encoding and machine-level code
Program code:
gcc compiler, converting source code into executable code, c preprocessor-assembler-linker
Machine-Level code:
The format and behavior of the machine-level program, defining the "instruction set architecture Isa", defines the processor state, the instruction format, and the effect of the directive on the state
The machine-level program uses a virtual address for a practical storage address
2. Data format
Integer, Long integer stored in 4-byte format
Pointer type stored in 4-byte format
There are three types of floating-point numbers: Single, Double, extended, 4, 8, 10, respectively
3. Operand designator:
The first is the immediate number, which is the constant value
The second is a register that represents the contents of a register
The third is the memory, which accesses the memory location according to the calculated valid address.
4. operand format See textbook P113 "Note s factor must be 1, 2, 4 or 8"
5. Data transfer instructions: The different instructions are divided into instruction classes, the same class of instructions to perform the same operation "Different is the size of the operands"
The value of the instruction source operand in the 6.MOV class is copied to the destination operand "The specified value of the source operand is an immediate number, the destination operand specifies a location"
7. The stack is a data structure that can add or remove values and follow the LIFO principle.
8. Load the valid address "Leal": Read data from memory to register.
9. Unary operation and two Yuan operation
Unary operation: Only one operand, both source and destination
Binary operations: Where the second operand is both a meta and a destination
10. Shift operation: First give the shift amount, and then give the shift value, you can do arithmetic and logical right shift.
11. Condition Code: Register, which describes the properties of the most recent arithmetic or logical operation.
Most commonly used condition code: CF "Carry Mark", ZF "0 mark", SF "symbol symbol", "overflow mark"
12. Note: The CMP directive and the test instruction do not modify the values of any registers, only set the condition code.
13. Access Condition code: Three methods commonly used P125
14. Three cycles of "Do-while" "while" "for"
15. A process involves passing data and control from one part of the code to another, allocating space for local variables of the process at entry, and freeing space on exit.
16. Stack frame structure: The portion of the stack allocated for a single process is called a "stack frame"
When the program executes, the stack pointer can be moved, and most information access is for the frame pointer
17. Transfer control: Call instruction, leave instruction, RET directive P150
18. Recursive Process P156
20135219 Hong-Interim summary