|
[ source navigation ] [ diff markup ] [ identifier search ] [ general search ] |
|||
|
001 /* Copyright (C) 2005 David Decotigny 002 003 This program is free software; you can redistribute it and/or 004 modify it under the terms of the GNU General Public License 005 as published by the Free Software Foundation; either version 2 006 of the License, or (at your option) any later version. 007 008 This program is distributed in the hope that it will be useful, 009 but WITHOUT ANY WARRANTY; without even the implied warranty of 010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 011 GNU General Public License for more details. 012 013 You should have received a copy of the GNU General Public License 014 along with this program; if not, write to the Free Software 015 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 016 USA. 017 */ 018 #ifndef _SOS_MMCTXT_H_ 019 #define _SOS_MMCTXT_H_ 020 021 022 /** 023 * @file mm_context.h 024 * 025 * Low level API to manage multiple MMU translation tables. The API 026 * (not its implementation) should be some kind of 027 * architecture-independent. 028 * 029 * The goal of this API is: 030 * - To provide a simple arch-independent API to change the current 031 * address space configured in the MMU 032 * - To make sure that ALL the kernel space mappings are always kept 033 * IDENTICAL among all the address spaces in the whole system. That 034 * way, a virtual address in the kernel space refers to EXACTLY the 035 * same physical memory location for all the address spaces. 036 */ 037 038 #include <sos/types.h> 039 #include <sos/errno.h> 040 041 042 /** 043 * Declaration of an MMU context. Opaque structure defined in 044 * mm_context.c 045 */ 046 struct sos_mm_context; 047 048 049 /** 050 * Setup the MMU context management subsystem 051 */ 052 sos_ret_t sos_mm_context_subsystem_setup(); 053 054 055 /** 056 * Public function to allocate a new MMU context. 057 * 058 * Allocate a new PD, map it into kernel virtual address space and 059 * initialize its PDE for the Kernel space so that the Kernel space is 060 * kept identical between ALL the MMU context in the system. 061 */ 062 struct sos_mm_context * sos_mm_context_create(void); 063 064 065 /** 066 * Public function to release the given MMU context (based on 067 * reference counting). Only the virtual page that maps the PD of the 068 * MMU context is released. All the other user-space pages are 069 * expected to be already released by the parent process. 070 */ 071 sos_ret_t sos_mm_context_unref(struct sos_mm_context *mmctxt); 072 073 074 /** 075 * Reconfigure the MMU to use a different MMU context. mmctxt MUST 076 * NOT be NULL. 077 */ 078 sos_ret_t sos_mm_context_switch_to(struct sos_mm_context *mmctxt); 079 080 081 /* ****************************************************** 082 * Reserved functions 083 */ 084 085 086 /** 087 * Reserved function to increase the reference count of the given MMU 088 * context (based on reference counting). 089 */ 090 sos_ret_t sos_mm_context_ref(struct sos_mm_context *mmctxt); 091 092 093 /** 094 * Restricted function reserved to paging.c to synchronize all the PDEs 095 * accross all the MMU contexts in the system. This is limited to PDEs 096 * pertaining to the kernel space. 097 */ 098 sos_ret_t sos_mm_context_synch_kernel_PDE(unsigned int index_in_pd, 099 sos_ui32_t pde); 100 101 #endif /* _SOS_MMCTXT_H_ */
[ source navigation ] | [ diff markup ] | [ identifier search ] | [ general search ] |