If the processor detects a protection violation it stops executing the code and sends a General Protection Fault interrupt. In most cases the operating system will simply remove the failing process from the execution queue, signal the user and continue executing another program. If however the operating system fails to catch the General Protection Fault, i.e. another protection violation occurs before the operating system returns from the previous General Protection Fault-interrupt, the processor will signal a double fault (interrupt vector 8, a typical BSOD scenario). If yet another failure occurs, the processor will shut down. It will then only respond to a reset or init (that is, pressing the reset-button, or rebooting the entire system) and NMI-interrupts (unless it has previously failed when handing NMI-interrupts, in which case it will ignore these too).
In some versions of Microsoft Windows, the general protection fault is indeed reported as a "general protection fault". However, in other versions, the errors may be reported by other messages such as:
In the case of a memory error, the program attempts to perform an action which would result in accessing a portion of memory which should not be accessed. This can include:
However, in the case of operating systems that utilize paging instead of segmentation for controlling accesses to memory, most invalid memory references are actually reported via a page fault exception as opposed to a general protection fault. Many modern operating systems implement their memory access-control schemes via paging instead of segmentation, so it is often the case that invalid memory references in operating systems such as Windows are reported via page faults instead of general protection faults. Operating systems typically provide an abstraction layer (such as exception handling or signals) that hides whatever internal processor mechanism was used to raise a memory access error from a program, for the purposes of providing a standard interface for handling many different types of processor-generated error conditions.
In terms of the x86 architecture, general protection faults are specific to segmentation-based protection when it comes to memory accesses. However, general protection faults are still used to report other protection violations (aside from memory access violations) when paging is used, such as the use of instructions not accessible from the current privilege level.
While it is theoretically possible for an operating system to utilize both paging and segmentation, for the most part, common operating systems typically rely on paging for the bulk of their memory access control needs.
There are some things on a computer which are reserved for the exclusive use of the operating system. If a program which is not part of the operating system attempts to use one of these features, it may cause a general protection fault.
Additionally, there are storage locations which are reserved both for the operating system and the processor itself. As a consequence of their reservation, they are read-only and an attempt to write data to them by an unprivileged program is an error.
General protection faults can occur for several reasons, including:
RAD tools, techniques take graphic direction; user demand for GUI-based applications raising uncertainty about how to develop. (rapid application development changes with graphical user interface-based computing)
Apr 01, 1992; Rapid application development (RAD) tools and techniques, such as prototyping and joint-application development (JAD), are...