Combinational circuits, by their very nature, do not store any information. Instead, they simply react to the signals at their inputs, generating outputs equal to some function of the inputs. (查看原文)
To create sequential circuits, that is, systems that have state, and perform computations on that state, we must introduce devices that store information represented as bits. (查看原文)
A key point is that the registers serve as barriers between the combinational logic in different parts of the circuit. Values only propagate from a register input to its output once every clock cycle at the rising clock edge. (查看原文)
In general, processing an instruction involves a number of operations. We organize them in a particular sequence of stages, attempting to make all instructions follow a uniform sequence, even though the instructions differ greatly in their actions. (查看原文)
Informal description of instruction processing stage:
Fetch: reads bytes of an instruction from memory, using the program counter (PC) as the memory address.
Decode: reads up to two operands from the register file, giving values valA and/or valB.
Execute: the arithmetic/logic unit (ALU) either performs the operations specified by the instruction, computes the effective address of a memory reference, or increments or decrements the stack pointer, giving the result valE.
Memory: may write data to memory, or read data from memory (valM).
Write back: writes back up to 2 results to the register file.
PC update: the PC is set to the address of the next instruction. (查看原文)
The cost of duplicating blocks of logic in hardware is much higher than the cost of having multiple copies of code in software. It is also more difficult to deal with many special cases and idiosyncrasies in a hardware system than with software. (查看原文)
Devising a partitioning of the system computation into a series of stages having uniform delays can be a major challenge for hardware designers. (查看原文)
How linkers resolve Multiply defined global symbols
Rules
1. Multiply strong symbols are not allowed
2. Given a strong symbol and multiple weak symbols, choose the strong one.
3. Given multiple weak symbols, choose any of them. (查看原文)
Relocation consists of two steps
1. Relocating sections and symbol definitions. After this step, every instruction and global variable in the program has a unique run-time memory address.
2. Relocating symbol reference within sections. To perform this step, the linker relies on data structures in the relocatable object module known as the relocatable entries. (查看原文)
First, in any given file system, there is exactly one .so file for a particular library.
Second, a single copy of the .text section of a shared library in memory can be shared by different running processes. (查看原文)
How can multiple process share a single copy of code?
Compile library code that it can be loaded and executed at any address. Such code is known as position-independent code(PIC) (查看原文)
Tools for manipulating object files
AR: Creates static libraries, and inserts, deletes, lists, and extracts members.
STRINGS: Lists all of the printable strings contained in an object file.
STRIP: Delete symbol table information from an object file.
NM: Lists the names and sizes of the sections in an object file.
SIZE: Lists the name and sections in an object file.
READELF: Displays the complete structure of an object file, including all of the information encoded in the ELF header, subsumed the functionality of SIZE and NM.
OBJDUMP: The mother of all library tools. Can display all the information in an object file. It's most useful function is disassembling the binary instructions in the .text section.
LDD: list the shared libraries that is needed at run time. (查看原文)
1. The handler returns control to the current instruction, the instruction that was executing when event occurred.
2. The handler returns control to next, the instruction that would have executed next had the exception not occurred.
3. The handler aborts the interrupted program. (查看原文)