|
[ 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(void); 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 create a new MMU context, copy of another one. 067 * 068 * Allocate a new PD, map it into kernel virtual address space, 069 * initialize its PDE for the Kernel space so that the Kernel space is 070 * kept identical between ALL the MMU context in the system and copy 071 * the PDE/PT of the user space to match that of the model mm_context. 072 */ 073 struct sos_mm_context * 074 sos_mm_context_duplicate(const struct sos_mm_context *model); 075 076 077 /** 078 * Public function to release the given MMU context (based on 079 * reference counting). Only the virtual page that maps the PD of the 080 * MMU context is released. All the other user-space pages are 081 * expected to be already released by the parent process. 082 */ 083 sos_ret_t sos_mm_context_unref(struct sos_mm_context *mmctxt); 084 085 086 /** 087 * Reconfigure the MMU to use a different MMU context. mmctxt MUST 088 * NOT be NULL. 089 */ 090 sos_ret_t sos_mm_context_switch_to(struct sos_mm_context *mmctxt); 091 092 093 /* ****************************************************** 094 * Reserved functions 095 */ 096 097 098 /** 099 * Reserved function to increase the reference count of the given MMU 100 * context (based on reference counting). 101 */ 102 sos_ret_t sos_mm_context_ref(struct sos_mm_context *mmctxt); 103 104 105 /** 106 * Restricted function reserved to paging.c to synchronize all the PDEs 107 * accross all the MMU contexts in the system. This is limited to PDEs 108 * pertaining to the kernel space. 109 */ 110 sos_ret_t sos_mm_context_synch_kernel_PDE(unsigned int index_in_pd, 111 sos_ui32_t pde); 112 113 #endif /* _SOS_MMCTXT_H_ */
[ source navigation ] | [ diff markup ] | [ identifier search ] | [ general search ] |