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