United States Patent (19) 11 Patent Number: 4,926,322 Stimac Et Al
Total Page:16
File Type:pdf, Size:1020Kb
United States Patent (19) 11 Patent Number: 4,926,322 Stimac et al. 45 Date of Patent: May 15, 1990 54, SOFTWARE EMULATION OF 4,601,018 7/1986 Baum et al. ......................... 365/189 BANK-SWITCHED MEMORY USNGA 4,609,996 9/1986 Kummer ...... ... 364/900 AND 4,615,006 9/1986 Hirano ................. ... 364/200 NEEE PAGED 4,707,803 11/1987 Anthony, Jr. et al ... 364/900 4,723,205 2/1988 Fukuda et al. ...... ... 364/200 75 Inventors: Gary A. Stimac William C. Crosswy, 4,727,480 2/1988 Albright et al. ... 364/200 both of Houston; Stephen B. Preston, 4,727,485 2/1988 Keslear et al. ... ... 364/200 irrro Flanni 4,742,450 5/1988 Duvall et al. ... ... 364/200 Sisimes S. gan, Cypress, 4,744,048 5/1988 Blanset et al. ... ... 364/900 4,747,040 5/1988 Blanset et al. ....... ... 364/200 73 Assignee: Com Computer Corporatio 4,777,589 10/1988 Boettner et al. ... 364/200 73 gn E. rporation, 4,779,187 10/1988 Letwin ................. ... 364/200 4,831,522 5/1989 Henderson et al. ... 364/200 21 Appl. No.: 81,325 4,849,875 7/1989 Fairman et al....... ... 364/200 22 Filed: Aug. 3, 1987 OTHER PUBLICATIONS 51 Int. Cl. ........................ G06F 9/00; G06F 13/00; Randall L. Hyde, "Overview of Memory Manage G06F 11/30 ment', Byte Apr. 88, pp. 219–225. 52 U.S. C. .................................................... 364/200 Carl Hensler & Ken Sarno, "Marrying Unix and the 58 Field of Search. 364/200 MS File, 900 MS File, 80836", Byte Apr. 88, pp. 237-244. 364/300 Primary Examiner-Andrew J. James 56 References Cited Assistant Examiner-Viet Q. Nguyen U.S. PATENT DOCUMENTS Attorney, Agent, or Firm-Arnold, White & Durkee 4,279,014 7/1987 Cassonnet et al. .................. 364/200 57 ABSTRACT 4,285,039 8/1981 Patterson et al. .... ... 364/200 A virtual DOS monitor uses the paging hardware of a 4,285,040 8/1981 Carlson et al.... ... 364/200 processor such as the Intel 80386 microprocessor in 3. 2. Mytil al". - A ,2. conjunction with its Virtual-8086 mode of operation to 4,449,181y 5/1984 Young etete al. ............s ...a 364/200 SE pi memory using ed memory. 4449, 84 5/1984 Pohlman II et a 364/200 upport for application programs which access ex 4.481570 li M1984 Wilker ... 364/200 panded memory is thereby provided without the need 4503,491 3/1985 Lushake a... ... so for additional memory boards or other hardware. 4,520,453 5/1985 Chow .................................. 364/900 4,545,010 10/1985 Salas et al. .......................... 364/200 31 Claims, 9 Drawing Sheets NEAR ADDRESS 80386 (ASSEEN BY PAGING PHYSICAL PROGRAM) MECHANISM MEMORY PAGES 4GB PROGRAM CODE AND DATA U.S. Patent May 15, 1990 Sheet 1 of 9 4,926,322 U.S. Patent May 15, 1990 Sheet 2 of 9 4926,322 LINEAR ADDRESS 31 21 O DIRECTORY PAGE OFFSET DR. ENTRY PAGE TABLE (PAGE TABLE DRECTORY DRECTORY BASE) (1024, ENTRIES) A ye5 PAGE ABES 0 PHYSICAL (102A ENTRES EACH) ADDRESS SPACE ATTRIBUTES PRESENT RGHTS PRIVE LEGE ACCESSED DRY (USER-DEFINED) — Az7.27 U.S. Patent May 15, 1990 Sheet 3 of 9 4,926,322 OPERATING|8086 NY/2 Eggs SSTEM 3. SIYITASK1 PAGE TABLE PAGE DIRECTORY PAGE DIRECTORY VIRTUAL TASK2 TASK 1 VIRTUAL 8086 TASK AS E. 8086 TASK O TASK 1 MEMORY I 8086 OPERATING SYSTEM MEMORY TASK2 MEMORY 33 80386 OPERATING SYSTEM MEMORY AZvas DESCRIPTOR TABLES AZ7-6 LOGICAL ADDRESS LINEAR ADDRESS SEGMENT TRANSLATION PHYSICAL ADDRESS PAGE TRANSLATION LINEAR ADDRESS PHYSICAL ADDRESS U.S. Patent May 15, 1990 Sheet 4 of 9 4,926,322 BEGIN AUTO UPDATE ROUTINE NO S EMM N AUTO MODE AZ77-7 ARE ANY EMM HANDLES ACTIVE 2 HAS HAS LM FUNCION LM FUNCTON 10 BEE) CALLED O BEEN CALLED RESET STAY ACTIVE FLAG SET STAY ACTIVE FLAG RETURN FROM AUTO UPDATE AND O.S.USERS A 77-7 OEM SERVICES OS. SERVICES O.S. KERNEL USER O B. SUPERVISOR/USER PROTECTION C. FOUR LEVELS OF PROTECTION U.S. Patent May 15, 1990 Sheet 5 of 9 4,926,322 REAL MODE STACK REAL MODE SS: SP - - POINTED TO HERE BEFORE REAL MODE FLAGS BEFORE INTERRUPT + 4 THE INTERRUPT. REAL MODE CS BEFORE INTERRUPT 42 REAL MODE | P BEFORE INTERRUPT 39 - REAL MODE SS-SP AT BEGIN OF INTERRUPT AA 3 HA NDLER EXECUTIONX ION. PROTECTED MODE STACK HIWORD LOWORD OFFSETdim-m-m-mo TOP OF RING O STACK p??? 32 (DECMAL) ???? +28 ???? 424 p?? - 20 pop? + 16 + 12 08 2??? 04 99 - PROTECTED MODE SS:ESP PONTS A BEGIN OF INTERRUPT HANDLER EXECUTION. AAz79 U.S. Patent May 15, 1990 Sheet 6 of 9 4,926,322 PROTECTED MODE STACK (RING O STACK) HIWORD LOWORD OFFSET VIRTUAL MODE GS +32 (DECIMAL) VIRTUAL MODE FS 28 22?? VIRTUAL MODE DS +24 2222 WRTUAL MODE ES 420 222 VIRTUAL MODESS 16 NEW VIRTUAL MODE ESP (OLD ESP-6) 12 EFLAGS (F AND TF CLEARED) 08 CS OF WIRTUAL MODE INTERRUPT HANDLER 04, EP OF VIRTUAL MODE INTERRUPT HANDLER PROTECTED MOD SS : ESP POINTS TO HERE. VIRTUAL MODE STACK VIRTUAL MODE SS: ESP -- POINTED TO HERE BEFORE VIRTUAL MODE FLAGS BEFORE INTERRUPT + 4 NTERRUPT. VIRTUAL MODE CS BEFORE INTERRUPT + 2 VIRTUAL MODE 1 P BEFORE INTERRUPT 38-VIRTUAL MODESS:ESPN RING O STACK POINTS TO HERE. Z77O U.S. Patent May 15, 1990 Sheet 7 of 9 4926,322 EMM PAGE LOGICAL PAGE OFOR HANDLE LOGICAL PAGE 1 FOR HANDLE LOGICAL PAGEN- 1 FOR HANDLE LOGICAL PAGE O FOR HANDLE LOGICAL PAGE 1 FOR HANDLE LOGICAL PAGE Nj-1 FOR HANDLE EMMPT START-> FREE ENTRY IN EMMPAGE LAST FREE ENTRY IN EMMPAGE EMM FREE UN USED ENTRY FREE TOP-a- FRST FREE PAGE IN FREE STACK LAST FREE PAGE IN FREE STACK TOTALPAGES Az7. Z2 U.S. Patent May 15, 1990 Sheet 8 of 9 4,926,322 NT 67H IN REAL MODE REAL MODE EMM NT 67H HANDLER IS EMM SET YES TO MODE OFF ? NO GO TO PROTECTED MODE CALL EMM FUNCTION HANDLER ROUTINE EXECUTE EMM FUNCTION WAS THIS YES A LM FUNCTION NUMBER 4, 6, OR 10 ? CALL AUTO UPDATE FUNCTION RETURN FROM EMM FUNCTION S EMM N AUTO MODE YES S STAY AWE FLAG SET 2 YES RETURN FROM RETURN FROM NT 67H N NT 67H IN Az775 REAL MODE VIRTUAL MODE U.S. Patent May 15, 1990 Sheet 9 of 9 4,926,322 NT 67H IN VIRTUAL MODE PROTECTED MODE EMM NT 67H HANDLER CALL EMM FUNCT ON HANDLER ROUT NE EXECUTE EMM FUNCTION WAS THIS YES A LM FUNCTON NUMBER 4, 6, OR 10 ? CALL AUTO UPDATE FUNCTION RETURN FROM EMM FUNCTION iS EMM N NO AUTO MODE 1. YES S STAY ALIVE FLAG SET 2 NO RETURN FROM RETURN FROM 77 |NT 67H IN |NT 67H N AZ775 VIRTUAL MODE REAL MODE 4,926,322 1. 2 By convention, a 20-bit address can be shown broken SOFTWARE EMULATION OF BANK-SWITCHED down into its segment and offset parts using the notation MEMORY USNG AWIRTUAL DOS MONTOR 0000:0000, the segment being to the left of the colon and AND PAGED MEMORY MANAGEMENT the offset on the right. For example, a 20-bit address written as FFE6E in hexadecimal notation could be BACKGROUND OF THE INVENTION written as FFE4:002E in segmented notation. Depend 1. Field of the Invention ing upon which segment (or "segment paragraph') is This invention relates to computer memory manage chosen, a single 20-bit address can be expressed in a ment. More particularly, it relates to application pro variety of ways using segmented notation. For example, 10 the physical address 00030 can be accessed by all the gram access to expanded memory via the Lotus/Intel/- following segments and offsets (segment paragraphs Microsoft Expanded Memory Specification on comput and relative offsets): 0000:0030; 0001:0020; 0002:0010; ers having extended memory and memory paging capa and, 0003:0000. bilities. Each of the four segment registers in the 8086 defines 2. Description of the Related Art 15 a 64KB block of memory called a "segment.' If all the Many popular personal computers (PCs) are based segment registers are kept constant and equal, then the on Intel microprocessors (Intel Corporation, 3065 Bow microprocessor can access only 64KB of memory, just ers Ave. Santa Clara, Calif. 95051). These include the like the 8080. model 8080, introduced in 1974, the 8088 which is used The 80286 and 80386 microprocessors both support in the Compaq Portable and the IBM-PC, the 8086 used 20 and go beyond the segmented addressing scheme of the in the Compaq Deskpro, the 80286 used in both the 8086. When first powered up, they operate in "real Compaq Deskpro 286 and the IBM-PC AT, and the mode,' which uses segment and offset registers in the 80386 processor of the Compaq Deskpro 386. These same way as the 8086 to access the same one megabyte microprocessors have been designed for upward com of memory. Thus the 80286 and 80386 microprocessors patibility-programs written for the 8088 and/or the 25 are upwardly compatible with the addressing scheme of 8086 can be run on computers having 80286 or 80386 the 8086 chip. processors and programs written for the 80286 proces In addition to real mode operation, the 80286 and sor can be run by the 80386. 80386 can operate in "protected mode.” The difference The amount of physical memory a microprocessor with protected mode is that the segment register is no can access depends on the number of address lines that 30 longer a real (i.e., physical) address.