Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

page_table.h

00001 /*
00002 Copyright (C) 2003-2004 Douglas Thain and the University of Wisconsin
00003 Copyright (C) 2005- The University of Notre Dame
00004 This software is distributed under a BSD-style license.
00005 See the file COPYING for details.
00006 */
00007 
00008 #ifndef PAGE_TABLE_H
00009 #define PAGE_TABLE_H
00010 
00011 /* There exists a struct page_table, but it is opaque to the user */
00012 struct page_table;
00013 
00014 /* This type defines a handler function to be called during a page fault */
00015 typedef void (*page_table_handler_t) ( struct page_table *pt, int page, void *arg );
00016 
00017 /* This type defines a handler to be called by page_table_iterate */
00018 typedef int (*page_table_iterator_t) ( struct page_table *pt, void *arg );
00019 
00020 /* Create a page_table to manage the data area given by "base" and "pages".  The memory will have initial permissions given by "access", and "handler" will be called during a page fault on this table. */
00021 
00022 struct page_table * page_table_create( char *base, int pages, int access, page_table_handler_t handler, void *handler_arg );
00023 
00024 /* Delete this page_table.  Deleting a page_table will set the memory permissions back to "ALL" */
00025 void page_table_delete( struct page_table *pt );
00026 
00027 /* Get the base address of the memory managed by this page_table */
00028 char *page_table_base( struct page_table *pt );
00029 
00030 /* Or, get the page table that has this base address */
00031 struct page_table * page_table_from_base( char *base );
00032 
00033 /* Get the number of pages in this table */
00034 int page_table_pages( struct page_table *pt );
00035 
00036 /* Get a pointer to the data in page "page" */
00037 char *page_table_data( struct page_table *pt, int page );
00038 
00039 /* Set the access permissions for a set of pages in this table */
00040 int page_table_access_set( struct page_table *pt, int page, int npages, int access );
00041 
00042 /* Get the access permission for a page in this table */
00043 int page_table_access_get( struct page_table *pt, int page );
00044 
00045 /* Get the default page size */
00046 int page_table_pagesize();
00047 
00048 /* Perform an action on all existing page tables */
00049 int page_table_iterate( page_table_iterator_t iter, void *arg );
00050 
00051 #define PAGE_TABLE_ACCESS_READ 1
00052 #define PAGE_TABLE_ACCESS_WRITE 2
00053 #define PAGE_TABLE_ACCESS_EXEC 4
00054 
00055 #define PAGE_TABLE_ACCESS_NONE 0
00056 #define PAGE_TABLE_ACCESS_ALL (PAGE_TABLE_ACCESS_READ|PAGE_TABLE_ACCESS_WRITE|PAGE_TABLE_ACCESS_EXEC)
00057 
00058 #endif

Generated on Fri Oct 31 16:58:30 2008 for cctools by  doxygen 1.3.9.1