page.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2001-2004 Jakub Jermar
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  *
00009  * - Redistributions of source code must retain the above copyright
00010  *   notice, this list of conditions and the following disclaimer.
00011  * - Redistributions in binary form must reproduce the above copyright
00012  *   notice, this list of conditions and the following disclaimer in the
00013  *   documentation and/or other materials provided with the distribution.
00014  * - The name of the author may not be used to endorse or promote products
00015  *   derived from this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00018  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00019  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00020  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
00021  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00022  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00023  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00024  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00026  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  */
00028 
00035 #ifndef __PAGE_H__
00036 #define __PAGE_H__
00037 
00038 #include <arch/mm/asid.h>
00039 #include <arch/types.h>
00040 #include <typedefs.h>
00041 #include <memstr.h>
00042 
00043 #define PAGE_CACHEABLE_SHIFT            0
00044 #define PAGE_NOT_CACHEABLE_SHIFT        PAGE_CACHEABLE_SHIFT
00045 #define PAGE_PRESENT_SHIFT              1
00046 #define PAGE_NOT_PRESENT_SHIFT          PAGE_PRESENT_SHIFT
00047 #define PAGE_USER_SHIFT                 2
00048 #define PAGE_KERNEL_SHIFT               PAGE_USER_SHIFT
00049 #define PAGE_READ_SHIFT                 3
00050 #define PAGE_WRITE_SHIFT                4
00051 #define PAGE_EXEC_SHIFT                 5
00052 #define PAGE_GLOBAL_SHIFT               6
00053 
00054 #define PAGE_NOT_CACHEABLE      (0<<PAGE_CACHEABLE_SHIFT)
00055 #define PAGE_CACHEABLE          (1<<PAGE_CACHEABLE_SHIFT)
00056 
00057 #define PAGE_PRESENT            (0<<PAGE_PRESENT_SHIFT)
00058 #define PAGE_NOT_PRESENT        (1<<PAGE_PRESENT_SHIFT)
00059 
00060 #define PAGE_USER               (1<<PAGE_USER_SHIFT)
00061 #define PAGE_KERNEL             (0<<PAGE_USER_SHIFT)
00062 
00063 #define PAGE_READ               (1<<PAGE_READ_SHIFT)
00064 #define PAGE_WRITE              (1<<PAGE_WRITE_SHIFT)
00065 #define PAGE_EXEC               (1<<PAGE_EXEC_SHIFT)
00066 
00067 #define PAGE_GLOBAL             (1<<PAGE_GLOBAL_SHIFT)
00068 
00070 enum pf_access {
00071         PF_ACCESS_READ,
00072         PF_ACCESS_WRITE,
00073         PF_ACCESS_EXEC
00074 };
00075 typedef enum pf_access pf_access_t;
00076 
00078 struct page_mapping_operations {
00079         void (* mapping_insert)(as_t *as, __address page, __address frame, int flags);
00080         void (* mapping_remove)(as_t *as, __address page);
00081         pte_t *(* mapping_find)(as_t *as, __address page);
00082 };
00083 typedef struct page_mapping_operations page_mapping_operations_t;
00084 
00085 extern page_mapping_operations_t *page_mapping_operations;
00086 
00087 extern void page_init(void);
00088 extern void page_table_lock(as_t *as, bool lock);
00089 extern void page_table_unlock(as_t *as, bool unlock);
00090 extern void page_mapping_insert(as_t *as, __address page, __address frame, int flags);
00091 extern void page_mapping_remove(as_t *as, __address page);
00092 extern pte_t *page_mapping_find(as_t *as, __address page);
00093 extern pte_t *page_table_create(int flags);
00094 extern void page_table_destroy(pte_t *page_table);
00095 extern void map_structure(__address s, size_t size);
00096 extern __address hw_map(__address physaddr, size_t size);
00097 
00098 #endif
00099 

Generated on Sun Jun 18 17:28:03 2006 for HelenOS Kernel (ppc64) by  doxygen 1.4.6