paging.h

Go to the documentation of this file.
00001 /*****************************************************************************************
00002  Copyright (c) 2002-2004 The UbixOS Project
00003  All rights reserved.
00004 
00005  Redistribution and use in source and binary forms, with or without modification, are
00006  permitted provided that the following conditions are met:
00007 
00008  Redistributions of source code must retain the above copyright notice, this list of
00009  conditions, the following disclaimer and the list of authors.  Redistributions in binary
00010  form must reproduce the above copyright notice, this list of conditions, the following
00011  disclaimer and the list of authors in the documentation and/or other materials provided
00012  with the distribution. Neither the name of the UbixOS Project nor the names of its
00013  contributors may be used to endorse or promote products derived from this software
00014  without specific prior written permission.
00015 
00016  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
00017  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00018  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
00019  THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00020  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00021  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00022  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
00023  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00024  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00025 
00026  $Id: paging_8h-source.html 88 2016-01-12 00:11:29Z reddawg $
00027 
00028 *****************************************************************************************/
00029 
00030 #ifndef _PAGING_H
00031 #define _PAGING_H
00032 
00033 #include <ubixos/types.h>
00034 #include <sys/sysproto.h>
00035 #include <sys/thread.h>
00036 
00037 #define VM_THRD           0
00038 #define VM_TASK           1
00039 
00040 #define pageLength        0x00000400
00041 #define pageSize          4096
00042 #define pageEntries       (pageSize/4)
00043 #define tablesBaseAddress   0xBFC00000
00044 #define parentPageDirAddr   0x100000
00045 
00046 #define PAGE_COW            0x00000200
00047 #define PAGE_STACK          0x00000400
00048 #define PAGE_WIRED          0x00000600
00049 #define PAGE_PRESENT        0x00000001
00050 #define PAGE_WRITE          0x00000002
00051 #define PAGE_USER           0x00000004
00052 #define PAGE_DEFAULT        (PAGE_PRESENT|PAGE_WRITE|PAGE_USER)
00053 #define KERNEL_PAGE_DEFAULT (PAGE_PRESENT|PAGE_WRITE)
00054 
00055 #define PAGE_SHIFT      12              /* LOG2(PAGE_SIZE) */
00056 #define PAGE_SIZE       (1<<PAGE_SHIFT) /* bytes/page */
00057 #define PAGE_MASK       (PAGE_SIZE-1)
00058 
00059 #define trunc_page(x)           ((x) & ~PAGE_MASK)
00060 #define round_page(x)   (((x) + PAGE_MASK) & ~PAGE_MASK)
00061 #define ctob(x)                 ((x)<<PAGE_SHIFT)
00062 #define btoc(x)                 (((vm_offset_t)(x)+PAGE_MASK)>>PAGE_SHIFT)
00063 
00064 
00065 int vmmClearVirtualPage(uInt32 pageAddr);
00066 
00067 void vmmUnmapPage(uInt32,int);
00068 void vmmUnmapPages(void *,uInt32);
00069 void *vmmMapFromTask(pidType,void *,uInt32);
00070 void *vmmCopyVirtualSpace(pidType);
00071 void *vmmGetFreePage(pidType);
00072 void *vmmGetFreeKernelPage(pidType pid,uInt16 count);
00073 void *vmmCreateVirtualSpace(pidType);
00074 void *vmmGetFreeVirtualPage(pidType,int,int);
00075 
00076 uInt32 vmm_getPhysicalAddr(uInt32);
00077 int    vmm_setPageAttributes(uInt32,uInt16);
00078 int    vmm_remapPage(uInt32,uInt32,uInt16);
00079 int    vmm_pagingInit();
00080 void  *vmm_getFreeMallocPage(uInt16 count);
00081 void   vmm_pageFault(uInt32,uInt32,uInt32);
00082 void  _vmm_pageFault();
00083 int mmap(struct thread *,struct mmap_args *);
00084 int obreak(struct thread *,struct obreak_args *);
00085 int munmap(struct thread *,struct munmap_args *);
00086 
00087 
00088 extern uInt32 *kernelPageDirectory;
00089 
00090 #endif
00091 
00092 /***
00093  END
00094  ***/
00095 

Generated on Fri Dec 15 11:18:55 2006 for UbixOS V2 by  doxygen 1.4.7