Summary of the eighth cycle of the Design foundation of information security system

Source: Internet
Author: User
Tags touch command

Summary of the eighth cycle of the Design foundation of information security system

"Learning Time: 12 Hours"

"Learning content: chapter1--chapter7 content focus; Analysis of questions and test errors; Review of the difficulties in the experimental process"

First, the content of the textbook Chapter focus (i) Chapter 1. The information is "bit + context".

"Understanding: The representation of the information itself is relatively fixed, in the Linux system (and other operating systems), operating information, data information, etc. are stored in binary form, how these bits understand, how to divide, depends on the context of the requirements of the decision. The two are linked together to form the concept of "information". 】

2. Hardware composition of the system
    • Bus: Carries information bytes and is responsible for passing between parts, fixed-length byte block, i.e. word. The number of bytes (that is, the word length) is a basic system parameter.
    • I/O devices
    • Main memory, consisting of a set of DRAM
3. Two basic functions of the operating system: to prevent the hardware from being abused by runaway applications; provides simple and consistent mechanisms for controlling complex low-level hardware devices 4. Operating system three basic abstraction: file <--i/o device; virtual memory <--main memory, disk I/O device; process <- -processor, main memory, I/O device (ii) Chapter II 5.gcc-m32 can generate 32-bit code 6 on a 64-bit machine. Two representations of byte order: The small end is "high-to-high, low-to-low", The big-endian is the opposite. 7. Integer: Negative-1 in the complement code, the same as the UMAX encoding (each bit is 1) 8. Almost all machines use a complement; In general, most numbers are signed by default. However, in an expression, if there is an unsigned argument, Then the other one will default to the unsigned number 9. Digit truncation: The number (binary) of a W-bit number discarded before the K-bit is: 2^w mod 2^k, it is possible to overflow. 10. Complement of non: except x=-2^ (w-1) and 0 are not themselves, Other numbers of non (additive inverses) can be obtained by 2^w-x. In 11.C languages, the multiplication of signed numbers is achieved by truncating the 2w bits to w bits. namely: X y-u2t ((xY) mod 2 ^w)

"The difficulty: it can be understood that the number represented by two complement, the result of multiplying the unsigned number of their binary representation to intercept the former w bit; so that the result is the same as the result of the unsigned number multiplication"

12. For negative numbers divided by 2^k, we can use a "bias" to correct the improper rounding: using x/y= (x+y-1)/y13. Floating-point number construction

IEEE floating-point standard-encodes a number with v= ( -1) ^sM2^e. which

Symbol: s Determines whether the number is negative (S=1) or positive (s=0), and the sign bit with the value 0 is interpreted as a special case.

Mantissa: M is a binary decimal.

Order code: E is weighted against floating-point numbers and can be negative.

"Difficulty: How to convert a decimal number into a floating point?"

Steps: The original number is expressed in binary, the left side of the decimal point n is normalized, and the left part of the decimal point is 0 to construct the small number field, and the result of the offset amount plus n is represented by the binary system to obtain the order code bit, preceded by a bit of the sign, together can be "

(iii) Chapter III 14.gcc-s XXX.C can get the assembler code produced by the C language compiler, but will not do any other work; with the "-C" command, GCC compiles and assembles the code to get the binary file XXX.O. 15. General formula for addressing: Valid addresses can be represented as imm+r[eb]+r[ei]*s. IMM is the immediate number offset; EB is the base register; EI is the variable address register; s is a scale factor. Such as:

1) ea--operation value: R[ea]

2) (Ea)--Operation value: M (R[ea]) "The difficulty: this means that the content in this storage unit needs to be addressed as an address"

3) Imm (Ea)--Operation value: M (Imm+r[ea])

16.SUB s,d--sends the results of D-S to the D17.set class instruction to set a byte (destination operand) to 0 or 118 based on the condition code set by the result of the t=a-b. IA32 uses the program stack to support process calls (including data and control). stack frames for the portion of the stack allocated for a single process. The bottommost (maximum address)%EBP is the frame pointer, and the topmost (least address)%ESP is the stack pointer. When the program executes, the stack pointer can be moved. 19. Transfer Control--

1) Call command: The address of the command that is followed by the beginning of the called procedure. The effect is to put the return address into the stack and jump to the beginning of the called procedure.

2) ret instruction: POPs the address from the stack and jumps to this position.

"Difficulty: How to understand?"

In conjunction with each other, the function calls are connected: that is, call is similar to the first explorer, the address of the maze entrance to a safe place, and then explore the maze (function), ret similar to the protection of personnel, after the completion of the expedition to take out the address, to lead the program back to the original entrance, Follow the road (main program) "

(iv) 20. Y86

A simple set of instructions that can be called a subset of the IA32 instruction set, including only four-byte integer operations, with fewer addressing methods. The instruction encoding length varies from 1--6 bytes. One importance of the instruction set is only that the byte encoding must have a unique interpretation.

With respect to the instruction structure, the first byte of each instruction indicates the type of instruction; This byte is divided into two parts, four bits per part: High Four bits is the code part (0--0XB), and fourth bit is the function part. Some abbreviations are added here: immediate count (i), register (R), memory (m). The register designator byte appended to the instruction is the data source (if the number is immediate, set this bit to 0xf), the destination register/base register. Some instructions need to append four bytes of constant number, using the small-end method (reverse) encoding

21.PUSHL will reduce the stack pointer by 4 and write a register value to the memory. Therefore, the results of executing PUSHL%ESP and popl%esp are not fixed. 22. Stage of processing operations--
    • Fetch: Reads the instruction byte from the register, the address is the value of the program counter. Calculates the next instruction address equal to the value in the PC plus the length of the removed instruction;
    • Decoding: Reads up to two operands from the register file, reads the registers indicated by the instruction Ra and the RB, but some of them are read register%ESP;
    • Execution: The ALU performs the specified action, the valid address of the reference, or the modified stack pointer, and the resulting value is called Vale;
    • Access: Writes data to the memory or reads data from the memory, the readout data is called Valm;
    • Write back: Write two results to a register file;
    • Update PC: Set the PC to the next instruction address.
23. Note on the implementation phase of some directives
    • The OPI,RRMOVL,IRMOVL instruction does not operate at the time of the visit, moreover, the IRMOVL is a long instruction format, so the PC should be added 6;
    • RMMOVL,MRMOVL The register value is Vala to the memory or read out from memory at the time of the fetch Valm
    • The call instruction and the RET instruction are similar to POPL and PUSHL, and for the call instruction, the Valp (the address of the instruction after the call) is pressed into the stack
24.SEQ timing (Gradual deepening)
    • To control the timing of the active in the processor, only the clock control of registers and memory is required
    • In addition to the instruction memory only for reading instructions can be considered as a combination of logic, the remaining program counters, condition code registers, data memory and register files need to be controlled by a clock signal (control timing)
    • In each clock cycle, the program counter loads a new instruction address, and the condition code register is loaded only when an integer operation instruction is executed. The data memory is only written when the Rmmovl,pushl,call is executed.
    • The essence of the Y86 instruction set follows an organizational principle: the processor never needs to read the state updated by the instruction in order to complete the execution of an instruction "how to understand?" In other words, if some of the instructions that the processor "handles" can change the state of the organization, then it must change the state before executing the instruction. This ensures the timing of the operation (preventing the command from being reversed) "
(iii) Chapter sixth 25. About DRAM
    • The cells in the DRAM chip are divided into D-units, each of which consists of a W DRAM unit. A d*w DRAM stores information about the DW bits in total. The cells are organized into a rectangular array of R row C columns, where rc = d. The information flows into and out of the chip through the external connector of the PIN.
    • Each DRAM chip is connected to a circuit called a storage controller that can transmit the W bit to each DRAM chip at once or the W bit from each chip in turn. One reason for circuit designers to organize DRAM into two-dimensional rather than linear arrays is to reduce the number of address pins on the chip.
26. The data stream flows through the shared electronic circuitry of the bus between the processor and the DRAM, including read transactions (from main memory to CPU) and write transactions. The bus is a parallel line that can carry data, control signals and addresses (data bus, address bus, control bus). 27. Disk Structure
    • A disk is a storage device that holds large amounts of data, but is slow to read.
    • Disks are made up of several platters, sealed in containers (disk drives), and each platter has a set of concentric circles called tracks, each of which is separated by some gaps into a set of equal capacity tracks (usually 512 bytes), and a formatted bit that identifies the sector is stored in the gap. Two.
    • Cylinder: The set of tracks equal to the center of the spindle at all the disc surfaces
28. Access to sectors is mainly three parts:
- 寻道:将读写头定位到包含目标扇区的磁道上。Tseek取决于它以前的位置和传动臂在盘面上的移动速度。时间通常为3——9ms。- 旋转:一旦读写头定位到了期望的磁道,驱动器等待目标扇区的第一个位旋转到读写头下面。平均旋转时间是最大时间(等磁盘旋转一圈)- 传送:驱动器开始写或者读扇区的内容;时间长短取决于旋转速度和每条磁道的扇区数目。平均时延为 Tavg=1/RPM*1/(平均扇区数/磁道)*60secs/1min- 补充:访问一个磁盘扇区的512字节的主要时间在于寻道和旋转延迟。访问时间:磁盘>DRAM>SRAM
29.CPU uses a technique called memory-mapped I/O to issue commands to I/O devices. In the system in which it is used, there is one address in the address space reserved for communication with the I/O device; called I/O port 30. The central idea of the memory hierarchy is that for each k, a faster and smaller storage device located on the K-tier is cached as a larger, slower storage device at the (k+1) layer. 31. Cache Memory (S,E,B,M)
    • Each memory address has a M-bit, which forms m=2^m different addresses. This m-bit is divided into T-marker bits, S-Group index bits, and B-block-biased shifts.
    • The cache of such a machine is organized into an array of s=2^s cache groups, each containing an e cache line, each row consists of a b=2^b byte block, a valid bit (indicating whether the row contains valid information), t=m-(B+s) Tag bits, which uniquely identify blocks stored in this cache line
    • The cache size is c=sEB

"Understanding: from high to Low, m=2^m addresses are evenly divided into s=2^s groups, each group gets 2^ (m-s) address, i.e. (m-s) bit, minus T bit for tag block, and 2^ (m-t-s) address can represent a block, that is, a block can have 2^ (m-t-s) bytes of Information "

32. The term "jitter" describes the fact that the cache repeatedly loads and expels groups of the same cache block-one solution is to add a few bytes of padding at the end of each array. Second, the question and the examination wrong question analysis (a) Question feedback 1. Here to gcc hello print.c HelloWhat does the last command mean in the interpretation of Main.c–o hello? (guess: Is this the two. o file converted to an executable, named Hello file?) )

Explanation: Yes, you can see the step decomposition below. 】

2.P63:

By similar reasoning, we can conclude that for a bit pattern for [x (W-1), X (w-2),......, 0,......, 0] The complement number x, and any k within the 0<=k<=w range, the bit pattern is [x (W-k-1), X (w-k-2),......, 0,......, 0 ] is the complement of x*2^k

Why truncated the previous K-bit, after 0, is a multiplicative result of the complement expression?

Explanation: This includes the possibility of overflow (i.e. not getting the right result). That is, the result of this operation is the same as the result of actually getting it. 】

3.P66 exercises 2.42

Write a function div16, on any integer parameter, to return the value of X/16. You cannot use arithmetic and any conditional operators, comparison operators. (Assuming that your machine is 32 bits, using the complement means, the right shift is the arithmetic right shift)

int div16(int x){    int bias = (x>>31)&0xf;//如果是负数,bias就会变成f    return (x+bias)>>4;}

If you do not understand how to prove negative arithmetic, add bias (that is, f) and then you can move directly to the right four-bit?

"Assuming that x is a negative number, then after adding bias=15, it is equivalent to (x+16-1)/16, which results in a bias." 】

4. Since Leal is the deformation of MOV, then all can use Leal the occasion can use MOV?

"The two are still different; The Leal instruction is to write the valid address directly to the destination register. 】

5.p383

Some systems also use error-correcting codes, where the word of a computer is encoded several bits (for example, 32-bit words may be encoded with 38 bits), so that the circuit can detect and correct any single error bit in a word.

Do not understand, so what is the cause and effect of the relationship?

Explained by Lou Teacher: Parity Check code is a typical application. 】

"Supplementary explanation: parity can be described as: to each code word plus a check bit, which is used to form a singular or even parity check." As can be seen, the additional code element D2, is simply used to make each word become even. Therefore, if a code element is wrong, it can be distinguished, because parity will become singular. The parity code makes the code distance 2 by adding a check bit to make the number of 1 in the encoding odd (odd) or even (even parity). 】

6.p402

On the other hand, because sum is a scalar, there is no spatial locality for sum.

Why does scalar have no spatial locality? (if a storage location is referenced once, then the program is likely to be referenced in a nearby memory location in the near future.)

"Explanation: It is because the scalar only refers to itself, not the amount of nearby locations." In contrast, vectors such as arrays can well represent spatial locality. 】

7.p403

In Figure 6-20

int sumaraycols(int a[M][N]){        ……    for(i=0;i<N;j++)        for(j=0;j<M;j++)            sum+=a[i][j];    ……}

Here, why is "I<n", "J<m"? Should I change it to "i<m", "J<n"?

"Here I refer to the photocopy version of" in-depth understanding of computer systems ", confirming that this is" i<m "," J<n ". 】

8.p253

Figure 4-19 shows the calculation of the RMMOVL and MRMOVL in the sequential implementation. In the memory stage, the register value Vala is written to the storage, or the Valm is read from the memory.

Why do you have to have this step? It seems that there is no need.

Lou Teacher explained: The function of the two instructions: RMMOVL write the value of the register to the memory, mrmove the memory of the data written to register, the implementation of an important step is to register the value Vala write to the memory, or read from the memory Valm, no two steps can not achieve the function of two instructions , is very necessary. 】

9.p249

The following figure shows a typical register file: ... The register file has two read ports and a write port.

So are both "read" and "write" input data into this register?

"Explanation: Read indicates output; write indicates input"

(b) Examination of the wrong problem analysis 1. In Linux bash, the man printf and man 1 printf functions are equivalent. (OK)

In Linux, the default Man printf operates on printf in a Linux system command (invoking a Help document about printf)

In 2.Linux Bash, the CD-command can be switched to the ' home ' directory. (x)

should be CD ~, CD-yes switch to the previous directory.

3.Linux bash, source and. The command function is equivalent. (OK)

Both are referred to as the root directory.

4.Linux Bash, the command to find files created in the home directory the day before yesterday is (find ~-ctime 2).

The Find command performs a lookup function, ~ Represents the home directory (root directory), and CTime 2 represents the file created 2 days ago (point in time, not time period).

5. There is a linear lookup algorithm in the data structure, the C standard library does not have this function function, but in Linux, this function is (Lfind or Lsearch)

Can be found with find

6. The two main tasks of the linker are (symbolic parsing and relocation). 7. (loader) Map the contents of the executable file to the memory and run the program. 8.~/test folder has a lot of C source files, find the main function in which File command (grep main *.c)

The grep command implements the filtering functionality, and the filter scope is all. c files. 】

9.C language: -2147483647-1u < -2147483647 (OK)

"The 2147483647-1 on the left is converted to an unsigned number when converted to (4294967296-2147483648) that is 2147483648, and 2147483647 to the unsigned number is also added 4294967296, is larger than the left. 】

10. Copy the word from the memory address at 0x4050 to the instruction at address 0x405c is MOVW ($0x4050), ($0x405c) (x)

It should be MOVW $0x4050, ($0x405c)

The loop structure in the 11.C language can be implemented using (conditional testing and jump combinations).

In other words, the condition test is responsible for the control loop in and out, while the jump is the execution loop body.

12. Implementing a digital system requires three components (combination logic, memory element, clock signal). Third, the experimental link highlights (a) Linux basic command 1. ctrl+d--keyboard input end or exit terminal; ctrl+s--tentative current program, pause and press any key to resume operation. 2.touch command to create a file. 3. Partitions on the man command: 1 General commands, 2 system calls, 3 library functions, covers the C standard function library. You can view the contents of the corresponding segment by adding a number to the corresponding section behind the man. 4. Knowing the role of a command, just want to quickly see some of its specific parameters of the role, then you can use the--help parameter, most of the commands will have this parameter. (The difference between--help and man is that the former focuses on the interpretation of command parameters)

5. In a Linux system, the root account has the supremacy of the entire system, such as new/added users. By default in the sudo user group, you can use the sudo command to get root privileges. 6. Create a new User: sudo adduser [username]; Switch User: su-l [user name]; View user group: groups [user]; Add user group (users in the sudo group have this right): sudo usermod [user group parameters] [user]7. A directory must have both read and Execute permissions to open, and a directory with write permission to allow other files to be created in it. 8. Change file owner: sudo chown [new owner] [file]; Change file permissions: chmod [owner permissions] [same user group user Rights] [other permissions] [file]9.echo [variable name]: View the value of a variable 10.cut command to print a field for each row.

Note:-d ': ' Indicates a delimiter with ":"

11.grep Command Parameters
    • The-r parameter indicates a recursive search for files in subdirectories;
    • -N indicates the print match line number;
    • -I means ignoring binary files
    • $ represents the end of a line, typically added after the keyword
12.WC (Statistics and output the number of rows, words, and bytes in a file) common parameters:
    • -L: Number of rows
    • -W: number of words
    • -M: Number of bytes
13. Examples of using regular expressions for simple answers

(Will match all strings beginning with ' Z ' ending with ' o ') echo ' Zero\nzo\nzoo ' | grep ' Z.*o '

(The match begins with ' Z ' ending with ' o ', and the middle contains a string of any character) echo ' Zero\nzo\nzoo ' | grep ' Z.O '

Echo ' Zero\nzo\nzoo ' (will match a string that begins with ' Z ' and ends with any number of ' O ') | grep ' zo* '

(Will match all the numbers) echo ' 1234\NABCD ' | grep ' [0-9] '

14. Extending the regular expression
    • Some inconvenience to write or have other special purpose of some inconvenience to write or have other special purposes of the "character, in front plus" character, in front plus \ "\" After the symbol, on behalf of the sign itself
    • "" The number of modifier modifiers "is placed behind the" "trimmed-up expression" ". such as: behind. such as: "[BCD][BCD]" "[BCD][BCD]" written as "[Bcd]{2}"
    • ^ matches where the string starts, does not match the character
    • $ matches the place where the string ends, does not match the character
(ii) GCC, GDB use 1.GCC compilation steps
    • GCC-E Hello.c-o hello.i
      Pretreatment
    • Gcc-c Hello.i-o hello.o
      Compiling hello.i to target code
    • GCC Hello.o-o Hello
      The GCC connector links the target file to an executable file, ending with an approximate compilation process
2. Writing code for debugging

Perform

3.GDB Commissioning
    1. Gcc–g [C source file]-o [executable]
    2. GDB [executable file]
    3. GdB L (listing C code) (Figure 6)
    4. Break [number of lines or other]--set breakpoints
    5. Info break--View breakpoint Information
    6. n--Single Step execution
    7. p [Variable]--the value of the print variable
    8. finish--Exit Function
    9. c--Continue execution
    10. Part of the debugging process

Iv. Summary and recommendations (i) deficiencies

In the course of this midterm summary, I found that I had a solid grasp of the fundamentals, but the need for hands-on practices such as Linux operations did need to be further improved-for example, I didn't spend a lot of time reviewing a book chapter, Because the focus of each chapter in the first learning process has been recorded by me and by doing a problem to consolidate, and in the review of the experimental part, I think "warm and know new", the process of review is more like picking up before or not understand the process of knowledge. Therefore, in the subsequent study, hands-on practice, is I should focus on the place.

(ii) Course recommendations

I think, the first "read first, then explain" the course learning mode may be difficult for a considerable number of students: first, because most students can not quickly adapt to the beginning of the course, the second is the textbook grasp is not good, the focus of energy input is also difficult to grasp. At this stage, the "first explanation, then read, after acceptance" model (in my opinion) can correct the problems before, promote efficient learning. In addition, I think, in class, as always, adhere to and strengthen the explanation of the operation of the content, for me this "poor hands-on" students are very helpful.

Summary of the eighth cycle of the Design foundation of information security system

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.