Electrical computers and digital processing systems: processing – Processing control – Branching
Reexamination Certificate
1998-12-14
2001-03-13
Pan, Daniel H. (Department: 2183)
Electrical computers and digital processing systems: processing
Processing control
Branching
C717S152000, C717S152000, C703S023000
Reexamination Certificate
active
06202145
ABSTRACT:
FIELD OF THE INVENTION
The present invention relates to the field of information handling systems, and, more particularly, to a system and method for instruction patching in protected mode in order to eliminate a ring transition.
BACKGROUND OF THE INVENTION
As microprocessors have evolved over time, different operating modes have been developed. Earlier microprocessors, such as the Intel 8088, Intel 8086, Intel 80188, and Intel 80186, operate only in real mode. In real mode, addresses are generated by shifting the value of a 16-bit segment register by four bits, and then adding a 16-bit address offset. Later microprocessors, beginning with the Intel 80286, add a second operating mode, referred to as protected mode. In protected mode, the segment registers do not contain real (i.e. physical) addresses. Rather, each segment register contains an index into a table of segment descriptors. A segment descriptor contains the start address (i.e. base address) of the segment, along with memory protection information, such as an offset limit, and read and write permission bits. An address is generated by adding an offset to the start address of the segment. Note that a segment start address in the 80286 is a 24-bit base address, while a segment start address in the 80386 is a 32-bit base address. Later microprocessors, such as the 80286 and 80386, operate in real mode when first powered up. Protected mode may be enabled by software. In addition, the 80286, 80386, and later microprocessors are designed to be upwardly compatible with the addressing scheme of earlier microprocessors.
Various features of the 80386 support multitasking. The 80386 includes memory paging hardware, which allows the implementation of a virtual memory system. The 80386's memory management capabilities may be used to isolate tasks from each other, and to prevent one task from corrupting another task's data or code areas. Note that a task is a program or group of programs which uses a particular set of resources (e.g., address space, registers, etc.). The 80386 further includes privilege level protection, which is used to selectively protect various portions of the operating system and other software (e.g., device drivers) from application programs. Privilege level protection may also be used to protect some parts of the operating system from other parts of the operating system, or for protecting a task from some of its own errors.
The privilege level protection of the 80386 is based on a privilege hierarchy. Privilege levels are typically referred to as rings, with Ring
0
being the most privileged level, and Ring
3
being the least privileged level. A program assigned to a particular privilege level can only access data and other programs which are assigned to the same or a higher privilege level. Thus, a Ring
2
program can call other Ring
2
programs and Ring
3
programs, but can not make a direct call to a Ring
1
or Ring
0
program. One typical manner for assigning privilege in a computer system is to assign the operating system kernel to Ring
0
, other operating system services to Ring
1
, original equipment manufacturers (OEMs) software (e.g., device drivers) to Ring
2
, and user applications to Ring
3
.
Whenever an application program executes an interrupt or an I/O instruction, the processor generates an exception which forces an execution mode switch. Usually, this is a switch from Ring
3
to Ring
0
in order to allow the system to handle the exception. Note that I/O instructions do not always generate an exception. Exceptions occur if the I/O privilege level of an application does not allow it to access ports normally and/or the I/O permission bit map does not grant access to the port. Also, many newer application programs do not use interrupts to request system services. However, a large number of legacy DOS programs exist and are used extensively in today's information handling systems. The IBM Personal Computer, and other early personal computers (PCs), utilized the Intel 8088 microprocessor. The primary operating system for early PCs was the Disk Operating System (DOS). A large amount of software is still in use that was originally written to operate in a DOS environment on an 8088-based PC.
Due to the large amount of execution state information that must be saved during a ring transition, exception handling for these instructions requires a large number of clock cycles. Consequently, it would be desirable to have a system and method for eliminating unnecessary ring transitions in an information handling system, executing in protected mode. It would also be desirable to handle software interrupts and exceptions as quickly as possible.
SUMMARY OF THE INVENTION
Accordingly, the present invention is directed to a system, method, and computer readable medium for eliminating unnecessary ring transitions. Often, a requested system service or I/O operation can be performed entirely at a higher ring level, such as Ring
3
, with no need to transition to a lower ring. In these cases, the software interrupt or I/O instruction which generates the ring transition is replaced by a call to a program executing at the higher ring level. Thus, the software interrupt instruction or I/O instruction is redirected to code that resides at the same protection level and emulates the effects of the instruction, resulting in improved execution speed. In the Intel 80×86 family of microprocessors, both the software interrupt instruction and the I/O instruction take two bytes to encode. It is thus possible to replace the instruction with the op-code for a segment:offset far call, letting the instruction stream dictate the offset for the call. By manipulating the base address of the segment, the target entry point can be controlled, and no ring transitions are needed to process the resulting call.
After an instruction has been patched once, it remains patched for each subsequent execution. Thus, each software interrupt instruction and/or I/O instruction need only be patched once.
An advantage of the present invention is that unnecessary ring transitions are eliminated in programs executing in protected mode. A further advantage of the present invention is that software interrupts and exceptions are handled quickly and efficiently.
REFERENCES:
patent: 5729728 (1998-03-01), Colwell et al.
patent: 5740248 (1998-04-01), Fieres et al.
patent: 5742794 (1998-04-01), Potter
Barnes Stacey Alan
Bennett Craig
Lita Christian
Ridgeway Martin Daniel
International Business Machines - Corporation
Leeuwen Leslie A. Van
Pan Daniel H.
LandOfFree
System and method for eliminating a ring transition while... does not yet have a rating. At this time, there are no reviews or comments for this patent.
If you have personal experience with System and method for eliminating a ring transition while..., we encourage you to share that experience with our LandOfFree.com community. Your opinion is very important and System and method for eliminating a ring transition while... will most certainly appreciate the feedback.
Profile ID: LFUS-PAI-O-2538866