| 1 | ;
|
|---|
| 2 | ; PAGING.INC -- Manage page tables
|
|---|
| 3 | ;
|
|---|
| 4 | ; Copyright (c) 1991-1999 by Eberhard Mattes
|
|---|
| 5 | ;
|
|---|
| 6 | ; This file is part of emx.
|
|---|
| 7 | ;
|
|---|
| 8 | ; emx is free software; you can redistribute it and/or modify it
|
|---|
| 9 | ; under the terms of the GNU General Public License as published by
|
|---|
| 10 | ; the Free Software Foundation; either version 2, or (at your option)
|
|---|
| 11 | ; any later version.
|
|---|
| 12 | ;
|
|---|
| 13 | ; emx is distributed in the hope that it will be useful,
|
|---|
| 14 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 15 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 16 | ; GNU General Public License for more details.
|
|---|
| 17 | ;
|
|---|
| 18 | ; You should have received a copy of the GNU General Public License
|
|---|
| 19 | ; along with emx; see the file COPYING. If not, write to
|
|---|
| 20 | ; the Free Software Foundation, 59 Temple Place - Suite 330,
|
|---|
| 21 | ; Boston, MA 02111-1307, USA.
|
|---|
| 22 | ;
|
|---|
| 23 | ; See emx.asm for a special exception.
|
|---|
| 24 | ;
|
|---|
| 25 |
|
|---|
| 26 | ;
|
|---|
| 27 | ; Bits in a page table entry which are used by the processor
|
|---|
| 28 | ;
|
|---|
| 29 | PAGE_PRESENT = 01H ; Page present
|
|---|
| 30 | PAGE_WRITE = 02H ; Page writable
|
|---|
| 31 | PAGE_USER = 04H ; Not a supervisor page
|
|---|
| 32 | PAGE_ACCESSED = 20H ; Page has been accessed
|
|---|
| 33 | PAGE_DIRTY = 40H ; Page is dirty
|
|---|
| 34 | ;
|
|---|
| 35 | ; Bits in a page table entry which are available for OS use
|
|---|
| 36 | ;
|
|---|
| 37 | PAGE_LOCKED = 200H ; Page not swappable
|
|---|
| 38 | PAGE_ALLOC = 400H ; Memory allocated
|
|---|
| 39 | PAGE_UNUSED_2 = 800H ; Unused
|
|---|
| 40 |
|
|---|
| 41 | ;
|
|---|
| 42 | ; PAGE_CLEAR is used with AND for clearing the address and the
|
|---|
| 43 | ; present, dirty, and accessed bits of a page table entry
|
|---|
| 44 | ;
|
|---|
| 45 | PAGE_PDA = PAGE_PRESENT OR PAGE_DIRTY OR PAGE_ACCESSED
|
|---|
| 46 | PAGE_CLEAR = 0FFFH AND NOT PAGE_PDA
|
|---|
| 47 |
|
|---|
| 48 | ;
|
|---|
| 49 | ; User ID for supervisor (used in swapper table entries)
|
|---|
| 50 | ;
|
|---|
| 51 | PIDX_SV = 0FFH ; Supervisor page
|
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 | IFNDEF __PAGING
|
|---|
| 55 |
|
|---|
| 56 | SV_DATA SEGMENT
|
|---|
| 57 |
|
|---|
| 58 | EXTRN LIN_START:DWORD ; First usable linear address
|
|---|
| 59 | EXTRN PAGE_DIR_PHYS:DWORD ; Phys. addr. of page directory
|
|---|
| 60 | EXTRN PAGE_DIR_SEG:WORD ; Segment of page directory
|
|---|
| 61 | EXTRN PAGING:BYTE ; Paging enabled
|
|---|
| 62 | EXTRN PAGE_TAB0_SEG:WORD ; Seg. of 0th page table (VCPI)
|
|---|
| 63 |
|
|---|
| 64 | SV_DATA ENDS
|
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 | SV_CODE SEGMENT
|
|---|
| 68 |
|
|---|
| 69 | EXTRN INIT_PAGES:NEAR, ALLOC_PAGES:NEAR, INIT_PAGE_BMAP:NEAR
|
|---|
| 70 | EXTRN SET_PAGES:NEAR, CLEAR_TLB:NEAR, INIT_LIN_MAP:NEAR
|
|---|
| 71 | EXTRN FREE_LIN:NEAR, FREE_PAGES:NEAR, GET_FREE_PAGE:NEAR
|
|---|
| 72 | EXTRN FREE_AVAIL:NEAR, CLEAR_DIRTY:NEAR
|
|---|
| 73 | EXTRN MAYBE_MAP_PAGE:NEAR
|
|---|
| 74 |
|
|---|
| 75 | SV_CODE ENDS
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 | INIT_CODE SEGMENT
|
|---|
| 79 |
|
|---|
| 80 | EXTRN INIT_PAGING:NEAR, MAP_PAGES:NEAR, RM_TO_PHYS:NEAR
|
|---|
| 81 |
|
|---|
| 82 | INIT_CODE ENDS
|
|---|
| 83 |
|
|---|
| 84 | ENDIF
|
|---|