原 著: david a rusling Translation: Banyan & FIFA (2001-04-27 13:53:43)
The first chapter hardware basic operating system must work closely with the basic hardware system. It requires those services that can only be provided by hardware. To fully understand the Linux operating system, you have to know some knowledge about hardware. This chapter will be a brief introduction to hardware: modern PC. When the "Popular Electronics" magazine in January 1975 was started with the picture of Altair 8080 as a cover. The Altair 8080 that household appliances can be assembled independently, and the price is only 397 mine. This 8080 processor with 256-byte memory has no display and keyboard, which is insignificant in today's standard. Its creator, ED ROBERTS, invented "Personal Computer" to describe his new invention. But now the term PC has been used to call the computer that you can carry. In this definition, a very strong computer, such as Alpha Ax, can also be referred to as a PC. The fanatical Hacker saw the huge potential of Altair, so they start writing software and design hardware for it. For the early pioneers, this isas of which are free; a freedom liberated from a stubborn super batch host. The wealth that is rolling will make many beautiful college students who are fascinated (a computer on the kitchen table). Many five-flowers of hardware begin to appear, and software HACKER is busy writing software for these new machines. Interesting is IBM first firmly streaming modern PC design and manufacturing and launching products in 1982. The constructor of this product is: 8080 CPU, 64K byte main memory, two floppy disk drives, and 25 rows of 80 columns color CGA displays. Although it is not how advanced thing in the current point of view, but the sales situation is very good. Immediately, in 1983, IBM PC-XT with expensive 10MB hard drive appeared. Soon after the IBM PC architecture has become a matter of fact soon, a large number of imitation people have appeared in Compaq. Due to the existence of this fact, multiple hardware companies have fiercely competitive in this rapidly growing market. But users benefit from low prices. Many early PCs have also retained in a modern PC system. For example, Intel's state-of-the-art Pentium Pro processor also retains the addressing mode of Intel 8086. When Linus Torvalds started writing Linux, he chose Intel 80386 PC that was widely used at the same time. Figure 1.1 Schematic of a typical PC motherboard. From the outside of the PC, the most striking is the chassis, keyboard, mouse, and displays. There are some buttons in front of the chassis, and a mini display shows some numbers, and there is a floppy drive. Today's machine also contains a CD ROM, in addition, if you want to protect your data, you can also add a tape drive as a backup. These devices are collectively referred to as external devices. Although the CPU is a system's total tube, it is just a smart device. All of these peripheral controllers have some level of intelligence, such as an IDE controller. Inside the PC, you can see a motherboard including a CPU or microprocessor, a main memory, and a number of ISA or PCI peripheral controller slots (Figure 1.1). Some controllers, such as the IDE disk controller must be built on the system board. Figure 1.1: Typical PC motherboard. 1.1 CPU CPU, or microprocessor, is the core of the computer system. The microprocessor performs calculation or logical operation and manages instructions from the main existence and execute it. In the early age of the computer, the functional components of the microprocessor are used to discrete components (large exterior). This is the origin of the term of the central processing unit. Modern microprocessor combines components into an integrated circuit on a small silicon sheet. There is the same meaning in the CPU and microprocessors and processors in this book. The object of the microprocessor is binary data; the data consists of 0 and 1. 1 and 0 correspond to the opening of the electronic switch and the open circuit.
As the decimal 42 indicates that there are 4 10 and one 2, a binary number is a series of binary numbers that represent 2 power. The binary 0001 corresponds to the decimal 1, binary 0010 corresponding to the decimal 2, binary 0011 representation 3, and 0100 corresponds to 4. The binary representation of the decimal 42 is expressed as 101010. However, in a computer program, people often use decimal instead of direct use of binary. When you need to use a binary, people tend to use the 16-based number. If the decimal number can only be used, the 16-in-weight number can be guided from 0, wherein 10 to 15 are represented by letters A, B, C, D, E, and F, respectively. Thus, the decimal of the 16-en-blended 2A is expressed as 42- 2 * 16 10 = 42. In the C program language, the prefix of the 16-based number is "0x"; 16-based 2A writes 0x2a. Microprocessors can perform logical operations such as adding, multiplication and except as "x." The execution of the processor is monitored by an external clock. This clock is called system clock, and it sends a pulse to the CPU every other time interval. On each clock pulse, the processor will do some work. For example, the processor performs a command on each clock pulse. The speed of the processor is generally described at the rate of the system clock. A 100MHz processor will receive 100,000,000 clocks per second. However, the ability to describe the CPU with the CPU's clock frequency is incorrect because the instructions they perform are different. However, fast clocks can represent high performance CPUs some extent. The command execution of the processor is very simple; for example, "read the contents of the contents X in the register y". The register is the internal storage component of the microprocessor to store data and perform certain instructions for the data. Some instructions may cause the processor to stop the current operation and jump to another instruction execution in the memory. The compact design of modern microprocessors makes it possible to perform millions or even hundreds of orders per second. The instruction must be taken from memory before execution. The data you want to use itself must also be taken out from the memory and placed in the appropriate place. The size, quantity, and type of registers in the microprocessor depends on the type of microprocessor. Intel 80486 processor and alpha axp have very different registers, the most obvious difference is that the Intel register is 32 bits and Alpha Ax is 64 bits. In general, any processor has many universal registers and a small number of dedicated registers. Many microprocessors have several specific registers. Program Counter (PC) This register contains the address executed by the following instructions. Whenever one instruction is retrieved, the content of the PC will be added automatically. Stack pointer (SP) microprocessor often needs to access external RAMs that store temporary data. Stack is a way to store temporary data, and the processor provides special instructions to press the numerical value into the stack and pop up from the stack. The stack will work in a first out (LIFO). In other words, if you press two values x and y, then perform the pop operation, you will take the value of Y. Some processors have a little opposite from the top of the memory. But some processors support these two ways, such as ARM. The execution of the processor status word (PS) instruction will be executed; for example, "content in register x is greater than the content in the register y?" Will be correct or error as a result. The PS register contains this information and other information about the current state of the processor. For example, most processors have at least two execution methods, cores (or homogeneous) and user mode. The PS register contains information indicating the current execution mode. 1.2 Memory All computer systems have a hierarchy consisting of different speeds and sizes. The fastest memory is a cache that is used to temporarily save the contents of the store. This memory speed is very fast but very expensive, and most processors have a small number of on-chip caches or place them on the motherboard. Some processors have a cache that contains both data and instructions, but some will be divided into two parts. The Alpha AXP processor has two internal caches, one for caches data (D-Cache) and the other for cache instructions (I-cache).