mm.h

00001 /***************************************************************************
00002                           mm.h  -  description
00003                              -------------------
00004     begin                : Thu Dec 25 2003
00005     copyright            : (C) 2003 by Dynacube Team
00006     email                : 
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 
00019 #ifndef __MM_H
00020 #define __MM_H
00021 
00022   #include "common/ktypes.h"
00023   #include "common/kconst.h"
00024   #include "proc/proc.h"
00025 
00026   
00027   typedef struct
00028   {
00029     DB p:1;
00030     DB r_w:1;
00031     DB u_s:1; //S = 1 U = 0
00032     DB pwt:1;
00033     DB pcd:1;
00034     DB a:1;
00035     DB d:1; //Dirty = 0
00036     DB ps:1;
00037     DB g:1;
00038     DB avl:3;
00039     DW base_low;
00040     DB base_hi:4;
00041   } PGDE; //Page Directory Entry
00042 
00043   typedef struct
00044   {
00045     DB p:1;
00046     DB r_w:1;
00047     DB u_s:1;
00048     DB pwt:1;
00049     DB pcd:1;
00050     DB a:1;
00051     DB d:1; //Dirty
00052     DB pat:1;
00053     DB g:1;
00054     DB avl:3;
00055     DW base_low;
00056     DB base_hi:4;
00057   } PGTE; //Page Table Entry
00058 
00059   extern DD _kpgde[1024];
00060   extern DD _kpgte[PHYS_MEM/_4MB][1024]; //PHYS_MEM/4Mb
00061     
00062   extern DD _pgde[1024];
00063   extern DD _pgte[MAX_PROC][1024]; //MAX_PROC
00064 
00065   extern DD _svgapgte[1024]; //PHYS_MEM/4Mb
00066 
00067   extern DD frmlist[PHYS_MEM/(0x20*_4KB)];
00068 
00069  struct MHEADER
00070   {
00071     struct MHEADER *ptr;
00072     size_t size;    
00073   };
00074   
00075   extern struct MHEADER base;
00076   extern struct MHEADER *freep;
00077   
00078     
00079   void mm_init();
00080   SDD findpage();
00081   void freepage(DD index);
00082   DD lin_to_phy(SDW pid ,DD linear_addr);
00083   DD logi_to_lin(SDW pid ,DW seg_sel, DD offset);
00084   void *kmalloc(size_t s);
00085   void free(void *ptr);
00086   void map_linear(DD addr);
00087   DD get_phys(DW pid,DD ptr);
00088 
00089 #endif

Generated on Thu Jul 27 23:52:27 2006 for Dynacube by  doxygen 1.4.7