When Microsoft OS/2 1.3 boots up, it prints a prominent message “U.S. Patent No. 4779187; 4825358”. What are those patents? As it turns out, it’s really just one invention, which for reasons perhaps clear to a patent lawyer was essentially assigned two patent numbers.
The application for patent 4779287 was filed on April 10, 1985 by James Letwin of Kirkland, WA. James Letwin is better known under his middle name, Gordon. Gordon Letwin was Microsoft’s chief architect of OS/2, although in April 1985 no one had heard of OS/2 and the entire project was in very early planning stages. The patent was granted on October 18, 1988, around the time OS/2 1.1 was released.
Patent 4825358 was applied for on June 18, 1987. At that time, OS/2 1.0 had not yet been released but the project had a very firm outline, with the first betas already shipped. This later patent was granted on April 25th, 1989, several months before OS/2 1.2 was released. Patent 4825358 contains the verbatim text and all drawings of patent 4825358, with several additional claims.
The title of both patents is “Method and Operating System for Executing Programs in a Multi-Mode Microprocessor”. The patent describes a protected-mode operating system designed to run on an Intel 286 processor and supporting the execution of both real-mode and protected-mode applications.
As is widely known, the 286 CPU starts up in real mode and can switch to protected mode, but cannot switch back except by resetting the CPU. Gordon Letwin is sometimes credited with inventing the method of switching from protected to real mode, but that is untrue. The basic method was built into the BIOS of the IBM PC/AT—when it booted up, the AT needed to check extended memory, and to do that, it had to run in protected mode. The BIOS would switch to protected mode, test a block of memory, and then reset the CPU through the keyboard controller. A flag in memory indicated that the initialization code should not be executed, and there was a way to provide an address to jump back to.
What Letwin did was improve the switching speed by using a triple fault instead of the keyboard controller to initiate a CPU reset. In the IBM PC/AT the shutdown special cycle was wired to a circuit that would reset the processor. Even this method was not exactly new; it was mentioned as an aside, although not well explained and documented, in the Intel 286 programming manual.
Letwin’s real contribution, and the bulk of patent 4825358, was a way to make real and protected-mode software coexist and run with minimum performance penalty, and without consuming large amounts of memory. The key to achieve that is dual-mode or bi-modal code and data. Bi-modal code is program code which can be executed in either real or protected mode. This is accomplished by creating protected memory mappings for both program code and data such that a protected-mode selector:offset address refers to the same memory location as a real-mode segment:offset address.
Bi-modal code is especially useful for interrupt handling, where mode switching can be prohibitively expensive; there is a good reason why bi-modal interrupt handlers were also used with some DOS extenders. OS/2 1.x used Letwin’s patent and bi-modal code extensively, and therefore achieved decent performance in its DOS box. Many OS/2 1.x device drivers were dual-mode and hence a nightmare to write.
Interestingly, IBM did not feel the need to flaunt any patents in its OS/2 releases, with the quiet confidence of a company which holds a lot more patents than you do.