Process-Exception control flow failure, termination

Source: Internet
Author: User
Tags terminates

Process-Exception control flow failure, termination

One, Exceptions (exception) and system call (System calls)
1.1 Failure

The fault is caused by an error condition and may be corrected by the fault handler . When a failure occurs, the processor transfers control to the fault handler. If the handler corrects the error condition, it returns control to the command that caused the failure and then executes it again. Otherwise, the handler returns to the abort routine in the kernel, and the abort routine terminates the application that caused the failure.



Fault handling. Depending on whether the fault can be repaired, the fault handler either re-executes the instruction that caused the failure or terminates.

A classic Failure example is a page fault, when the instruction refers to a virtual address, and the physical pages corresponding to that address are not in memory, and therefore must be removed from the disk when a failure occurs. The page fault handler loads the appropriate pages from the disk and then returns control to the instruction that caused the failure. When the instruction is executed again, the corresponding physical page is already residing in memory, and the instruction can be run without failure.



1.2 Termination

Termination is the result of an unrecoverable fatal error , usually a hardware error, such as a parity error that occurs when a dram or SRAM bit is damaged. The terminating handler never returns control to the application.



Invalid Memory Reference:



Ii. Exceptions (Exception) and system call (systems calls) overview

It's time to smooth out the anomaly.

Interrupt routines who provide, where.

As previously mentioned, the exception is located in the hardware and operating system interface, part of it is hardware implementation, part of the operating system implementation. Each of the possible types of exceptions in the system is assigned a unique, non-negative integer (exception number). Some of these numbers are assigned by the designer of the processor , and other numbers are assigned by the designer of the operating system kernel (the part of the operating system resident memory) . Here's a little more specific.

2.1 Processor Designer

The part of the processor designer that is responsible for the BIOS (Basic inputoutput system), the Chinese name is the basic input and output system, is written in the system board ROM (it is non-volatile) in a set of programs.



BIOS programs mainly include:

A) post power-on self-test routines

After power on the system's key hardware to detect 1, mainly check the quality of hardware. The errors found in the power-on self-test are usually fatal, so the system does not start properly.



b) BIOS system Setup Routines

Extended System Configuration Data escd is stored in a writable CMOS chip, which mainly holds information about the basic situation of the system, CPU characteristics, soft hard disk drives and other components. The System Setup program is installed in the BIOS ROM chip, mainly to set the parameters in the CMOS. This program can enter the setting state and provide a good interface after the post self-test process is completed by pressing a key (F12).







You can set the startup disk here. Typically, the BIOS would allow the user to configure a boot order. If The boot order is set to "first, the DVD drive; Second, the hard disk drive, then the BIOS would try to boot from the DVD drive, and if this fails (e.g. because there are No DVD in the drive), it'll try to boot from the local hard drive.

c) BIOS interrupt Service Routines

Provides basic interrupt services for I/O operations on hardware devices, as well as some other hardware-related interrupt service programs. In the interrupt service routine, the part where the processor designer is responsible is here, and the rest of the service routines outside this section have nothing to do with the processor's designer, mainly with the operating system kernel.

2.2 OS kernel designer

It's time to figure out how the operating system was loaded into PC memory.

2.2.1 Computer boot process (boot sequence)

Memory and disk layout when you start your computer: After the bare metal power-up, the value of Cs:ip is OXF000:FFF0, this is the address of the first instruction, the instruction in this address is a jump instruction, will jump to the BIOS to perform the BIOS program.



After the BIOS finishes initializing the hardware, it will eventually find the loader 2 on the disk and load the operating system-related loader into memory, then jump to the loader's start address to execute the loader, and the rest will be given to the loader, which will load the operating system from disk into memory. and transfer control to the operating system kernel.


Center>

2.2.2 instance: The basic process of MBR-based operating system startup



After the operating system starts, the computer is running under protected Mode, at which point the exception table base register has been initialized, pointing to the exception vector table, the BIOS, and the operating system's interrupt service routine, the entry address has been registered to the exception vector table.



Since then, the exception system portion of the exception control flow has been described as finished.

    1. Complete post self-test includes CPU, System motherboard, basic 640KB memory, 1MB of extended memory, System ROM BIOS testing, System configuration verification in CMOS, initializing video controller, testing video memory, verifying video signal and synchronizing signal, testing CRT interface Check the keyboard, floppy drive, hard disk and CD-ROM subsystem, and check the parallel port (printer) and serial port (RS232). If an error is found in the self-test, it will be handled in two cases: for a serious failure (fatal failure) is stopped, at this time due to a variety of initialization operation has not been completed, can not give any hint or signal, for non-serious failure to give a hint or sound alarm signal, waiting for the user to process. When the self-test is complete, the system goes to the next step in the BIOS: look for the operating system from a-drive, C-drive or CD-ROM, and a network server to start, and then give control to the operating system. More content?
    2. Specifically how to find the boot loader is the implementation of the process, different implementations, find the boot loader way may not be the same. For more details, refer to "Full anatomy of the Linux kernel" and "deep understanding of the Linux kernel" Appendix I?

Process-Exception control flow failure, termination

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.