2018-2019-1 20165228 "Information Security system Design Fundamentals" Third Week study summary

Source: Internet
Author: User

2018-2019-1 20165228 "Fundamentals of Information Security system design" the third week of learning summary of the Learning Content Summary program machine-level representation: Two important abstractions of computer systems
    • ISA (Instruction set architecture): Instruction set architecture, machine-level program format and behavior. Defines the format of the processor status directives and the effect of each instruction on the state.
    • The memory address used by the machine-level program is a virtual address, and the provided memory model looks like a very large byte array. The actual performance of the memory system is to combine multiple hardware memory and operating system software.

      Assembly code and its characteristics
    • Direct processor-oriented programming language. The compiler translates the C language code into the basic instructions that the processor executes, and the assembly language is very close to the machine code.
    • Features: readability compared to machine code for better text format representation

      X86-64 directive

    • Instruction length: 1 to 15 bytes
    • Instruction format: OPER [DEST [, SRC]]; note

      How to get the assembler code for C language code
    • Run the GCC compiler to produce a compilation file code.s
gcc -Og -S code.c//-Og表示优化程度,比如-01表示使用第一级优化,优化的级别与编译时间和最终产生代码的形式都有关系。
    • With the-C command option, GCC compiles and assembles the code to get CODE.O
gcc -c code.c
    • Target code: Binary form, cannot be directly viewed, the machine actually executes the program is just a series of instructions to encode a sequence of bytes.

      How to get readable content based on the target code
    • Using the Disassembler (disassembler), a format similar to the assembly code can be produced according to the target code.
objdump -d code.o
    • Program Processor: Just the address of the next instruction to be executed in memory
    • Integer Register: Contains 16 named locations, each of which stores 64-bit values. Can be used to record certain file states or to hold temporary values.
    • Stripe Register: Holds state information for the most recently executed arithmetic or logical instruction.
    • Floating-point registers: A set of vector registers can hold one or more certificates or floating-point values.

      General purpose register of the processor
    • The central processing unit (CPU) of the x86-64 contains a set of 16 common purpose registers that store 64-bit values

      Assembly Instructions
    • MOV class instruction: The value of the source operand is copied into the destination operand.
    • Movb Transfer bytes
    • MOVW Transfer Word
    • MOVVL Transmission Double Word
    • Movz 0 Extension
    • Unary operation
    • INC plus a
    • DEC minus One
    • NEG take negative
    • Not take compensation
    • Binary operation
    • Add Plus
    • SUB minus
    • Imul Multiply
    • Xor different or
    • OR OR
    • And and
    • Control
Condition code
 ``` CF:进位标志 ZF:零标志 SF:符号标志 OF:溢出标志 ```
Loop (while, for)
     do    body-statement    while(test-expr);
     loop:    body-statement    t = test-expr;    if(t)        goto loop;
Addressing mode
    • Immediate number addressing: the operand is given directly in the instruction, only for the source operand and the length of the data should match the length of the destination operand.
    • Register Addressing: The number is placed in the internal registers of the CPU, the source operand and the length of the destination operand should be the same.
    • Memory addressing: The operand is stored in memory and the instruction gives the offset address information for the operand.

    • a specified set of parameters and an optional return value to implement a function.
    • Form: Functions, methods, subroutines, handler functions, and so on.
    • Machine-level support mechanisms required for implementation
    • delivery control
    • pass data
    • Allocate and free memory

      allocate and free memory local storage on
    • stack
    • Register The local storage space in the
      stack frame : A process activity record is a data structure used by the compiler to implement a procedure/function call. Logically, the stack frame is a function of the yellow essence: function parameters, functions of local variables, functions after the execution of the return to where and so on.
      extended by : The stack is extended from a high address to a low address. Each invocation of each function has its own stack frame, which maintains all the necessary information. Register EBP points to the point of the current stack frame (high address), register ESP points to the top of the current stack frame (low address).

      Heterogeneous data structure
    • The struct declaration of the C language creates a data type that aggregates objects that may be different types into an object. All components of the
    • Structure are stored in a contiguous region, and the pointer to the structure is the address of the first byte of the structure.

      Data Alignment
    • Maintaining data alignment is more efficient for most x86-64 directives, but it does not affect the behavior of the program.

      problems and resolutions in code debugging
    • Problem 1:gdb Debugging Problem "No source file named File.c. Make breakpoint pending on the future shared library load? " and "no symbol table is read." Use the "file" command "
    • Problem 1 Solution: At compile time, there is no option to add-g, resulting in no debug symbols.

      code-managed Learning progress bar
lines of code (new/cumulative) Blog Volume (Add/accumulate) Learning Time (new/cumulative) Important Growth
Goal 5000 rows 30 Articles 400 hours
First week 124/124 1/1 9/9

2018-2019-1 20165228 "Information Security system Design Fundamentals" Third Week study summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.