home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2MISC / CSDPMI3S.ZIP / SRC / CWSDPMI / PAGING.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-27  |  2.2 KB  |  60 lines

  1. /* Copyright (C) 1995,1996 CW Sandmann (sandmann@clio.rice.edu) 1206 Braelinn, Sugarland, TX 77479
  2. ** Copyright (C) 1993 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954
  3. **
  4. ** This file is distributed under the terms listed in the document
  5. ** "copying.cws", available from CW Sandmann at the address above.
  6. ** A copy of "copying.cws" should accompany this file; if not, a copy
  7. ** should be available from where this file was obtained.  This file
  8. ** may not be distributed without a verbatim copy of "copying.cws".
  9. **
  10. ** This file is distributed WITHOUT ANY WARRANTY; without even the implied
  11. ** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. */
  13.  
  14. /* active if set */
  15. #define PT_P    0x001    /* present (else not) */
  16. #define PT_W    0x002    /* writable (else read-only) */
  17. #define    PT_U    0x004    /* user mode (else kernel mode) */
  18. #define    PT_T    0x008    /* page write-through (else write-back) */
  19. #define    PT_CD    0x010    /* page caching disabled (else enabled) */
  20. #define PT_A    0x020    /* accessed (else not) */
  21. #define PT_D    0x040    /* dirty (else clean) */
  22. #define PT_I    0x200    /* Initialized (else contents undefined) USERDEF */
  23. #define PT_S    0x400    /* Swappable (else not) USERDEF */
  24. #define    PT_C    0x800    /* Candidate for swapping USERDEF */
  25.  
  26. /* Page table bit definitions:
  27.     In memory:        P  I  -
  28.     Mapped:           P !I !S
  29.     In swapfile:     !P  I  S
  30.     Not yet touched: !P !I  S
  31.     Uncommitted:     !P  - !S
  32.     Unused:           P !I  S
  33.     If dirty or PT_C save contents, else discard on swapout
  34. */
  35.  
  36. void paging_setup(void);
  37. word32 ptr2linear(void far *ptr);
  38.  
  39. int page_in(void);
  40. unsigned page_out(void);
  41. unsigned page_out_640(void);
  42. int page_is_valid(word32 vaddr);
  43. void physical_map(word32 vaddr, word32 size, word32 where);
  44. int lock_memory(word32 vaddr, word32 size, word8 unlock);
  45. void free_memory(word32 vaddr, word32 vlast);
  46. int free_memory_area(word32 vaddr);
  47. int page_attributes(word8 set, word32 start, word16 count);
  48. void move_pt(word32 vorig, word32 vend, word32 vnew);
  49. int cant_ask_for(int32 amount);
  50.  
  51. typedef struct AREAS {    /* in linear space, not program space */
  52.   word32 first_addr;
  53.   word32 last_addr;
  54.   struct AREAS *next;
  55.   } AREAS;
  56.  
  57. extern AREAS *firstarea;
  58. extern word32 far *vcpi_pt;
  59. extern word32 reserved;
  60.