Changeset 445 for trunk/libs/libalmosmkh/almosmkh.h
- Timestamp:
- May 29, 2018, 9:27:23 AM (6 years ago)
- Location:
- trunk/libs/libalmosmkh
- Files:
-
- 1 copied
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/libs/libalmosmkh/almosmkh.h
r444 r445 1 /* 2 * almosmkh.h - User level ALMOS-MKH specific library definition. 3 * 4 * Author Alain Greiner (2016,2017,2018) 5 * 6 * Copyright (c) UPMC Sorbonne Universites 7 * 8 * This file is part of ALMOS-MKH. 9 * 10 * ALMOS-MKH is free software; you can redistribute it and/or modify it 11 * under the terms of the GNU General Public License as published by 12 * the Free Software Foundation; version 2.0 of the License. 13 * 14 * ALMOS-MKH is distributed in the hope that it will be useful, but 15 * WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 * General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with ALMOS-MKH; if not, write to the Free Software Foundation, 21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 22 */ 23 1 24 #ifndef _LIBALMOSMKH_H_ 2 25 #define _LIBALMOSMKH_H_ 3 26 4 #include <almos-mkh/almos-mkh.h> 27 /*************************************************************************************** 28 * various the user level, ALMOS-MKH specific library. It contains: 29 * - non standard system calls. 30 * - debug functions. 31 * - remote malloc extensions. 32 **************************************************************************************/ 33 5 34 #include <pthread.h> 6 7 /****************** Non standard (ALMOS_MKH specific) system calls **********************/ 8 9 10 /***************************************************************************************** 35 #include <shared_almos.h> 36 37 /****************** Non standard (ALMOS_MKH specific) system calls ********************/ 38 39 40 /*************************************************************************************** 11 41 * This function is used to give the process identified by the <pid> argument the 12 42 * exclusive ownership of the attached TXT_RX terminal. 13 *************************************************************************************** **43 *************************************************************************************** 14 44 * @ pid : process identifier. 15 45 * @ returns O if success / returns -1 if process not found. 16 ************************************************************************************** **/46 **************************************************************************************/ 17 47 int fg( unsigned int pid ); 18 48 … … 49 79 50 80 /*************************************************************************************** 81 * This function implement the operations related to User Thread Local Storage. 82 *************************************************************************************** 83 * @ operation : UTLS operation type as defined in "shared_sycalls.h" file. 84 * @ value : argument value for the UTLS_SET operation. 85 * @ return value for the UTLS_GET and UTLS_GET_ERRNO / return -1 if failure. 86 **************************************************************************************/ 87 int utls( unsigned int operation, 88 unsigned int value ); 89 90 /*************************************************************************************** 91 * This function returns a positive integer fom the standard "stdin" stream. 92 *************************************************************************************** 93 * returns the integer value if success / returns -1 if failure. 94 **************************************************************************************/ 95 int getint(); 96 97 98 /***************** Non standard (ALMOS-MKH specific) debug functions ******************/ 99 100 101 /*************************************************************************************** 51 102 * This debug function displays on the kernel terminal TXT0 52 103 * the thread / process / core identifiers, the current cycle, plus a user defined … … 91 142 /*************************************************************************************** 92 143 * This debug function displays on the kernel terminal TXT0 144 * the list of processes attached to a given TXT channel. 145 * It can be called by any thread running in any cluster. 146 *************************************************************************************** 147 * @ txt_id : [in] TXT terminal indes. 148 * @ return 0 if success / return -1 if illegal argument. 149 **************************************************************************************/ 150 int display_txt_processes( unsigned int txt_id ); 151 152 /*************************************************************************************** 153 * This debug function displays on the kernel terminal TXT0 93 154 * the list of channel devices available in the architecture. 94 155 * It can be called by any thread running in any cluster. … … 108 169 109 170 /*************************************************************************************** 110 * This debug function displays on the kernel terminal TXT0 111 * the list of processes attached to a given TXT channel. 112 * It can be called by any thread running in any cluster. 113 *************************************************************************************** 114 * @ return always 0. 115 **************************************************************************************/ 116 int display_txt_processes( unsigned int txt_id ); 171 * This debug function displays on the kernel terminal TXT0 the current DQDT state. 172 * It can be called by any thread running in any cluster. 173 *************************************************************************************** 174 * @ return always 0. 175 **************************************************************************************/ 176 int display_dqdt(); 117 177 118 178 /***************************************************************************************** … … 126 186 * @ returns O if success / returns -1 if illegal arguments. 127 187 ****************************************************************************************/ 128 129 188 int trace( unsigned int active, 130 189 unsigned int pid, 131 190 unsigned int trdid ); 132 191 133 /***************************************************************************************** 134 * This function implement the operations related to User Thread Local Storage. 135 ***************************************************************************************** 136 * @ operation : UTLS operation type as defined in "shared_sycalls.h" file. 137 * @ value : argument value for the UTLS_SET operation. 138 * @ return value for the UTLS_GET and UTLS_GET_ERRNO / return -1 if failure. 139 ****************************************************************************************/ 140 int utls( unsigned int operation, 141 unsigned int value ); 142 143 /********************************************************************************************* 144 * This function returns a positive integer fom the standard "stdin" stream. 145 ********************************************************************************************* 146 * returns the integer value if success / returns -1 if failure. 147 ********************************************************************************************/ 148 int getint(); 149 150 151 /////// Non-standard memory operations //////////// 152 //////////////////////////////////////////////////////////////////////////////// 192 /**************************************************************************************** 193 * This blocking function implements an user-level interactive debugger that can be 194 * introduced in any user application to display various kernel distributed structures. 195 * The supported commands are: 196 * - p (cxy) : display all processes descriptors in a given cluster. 197 * - s (cxy,lid) : display all threads attached to a given core in a given cluster. 198 * - v (cxy) : display the calling process VMM in a given cluster. 199 * - t (tid) : display all owner process descriptors attached to a TXT terminal. 200 * - x : force the calling process to exit. 201 * - c : continue calling process execution. 202 * - h : list the supported commands 203 ***************************************************************************************/ 204 void idbg(); 205 206 207 /****************** Non standard (ALMOS-MKH specific) malloc operations ***************/ 208 209 ///////////////////////////////////////////////////////////////////////////////////////// 153 210 // General principles: 154 211 // - In user space the HEAP zone spread between the ELF zone and the STACK zone, … … 168 225 // We should introduce the possibility to dynamically allocate 169 226 // several vsegs in each cluster, using several mmap when required. 170 //////////////////////////////////////////////////////////////////////////////// 227 ///////////////////////////////////////////////////////////////////////////////////////// 171 228 // Free blocks organisation in each cluster : 172 229 // - All free blocks have a size that is a power of 2, larger or equal … … 179 236 // - The pointers on the first free block for each size are stored in an 180 237 // array of pointers free[32] in the storage(x,y) descriptor. 181 //////////////////////////////////////////////////////////////////////////////// 238 ///////////////////////////////////////////////////////////////////////////////////////// 182 239 // Allocation policy: 183 240 // - The block size required by the user can be any value, but the allocated … … 200 257 // If the vseg is aligned (the vseg base is a multiple of the 201 258 // vseg size), all allocated blocks are aligned on the actual_size. 202 //////////////////////////////////////////////////////////////////////////////// 259 ///////////////////////////////////////////////////////////////////////////////////////// 203 260 // Free policy: 204 261 // - Each allocated block is registered in an alloc[] array of unsigned char. … … 213 270 // - The alloc[] array is stored at the end of heap segment. This consume 214 271 // (1 / MALLOC_MIN_BLOCK_SIZE) of the total storage capacity. 215 //////////////////////////////////////////////////////////////////////////////// 272 ///////////////////////////////////////////////////////////////////////////////////////// 216 273 217 274 … … 221 278 #define MALLOC_MAX_CLUSTERS 0x100 // 256 clusters 222 279 223 //////////////////////////////////////////////////////////////////////////////// 224 // store(x,y) descriptor (one per cluster)225 //////////////////////////////////////////////////////////////////////////////// 280 ///////////////////////////////////////////////////////////////////////////////////////// 281 // store(x,y) descriptor (one per cluster) 282 ///////////////////////////////////////////////////////////////////////////////////////// 226 283 227 284 typedef struct malloc_store_s 228 285 { 229 pthread_mutex_t mutex; // lock protecting exclusive access 286 pthread_mutex_t mutex; // lock protecting exclusive access to local heap 230 287 unsigned int initialized; // initialised when value == MALLOC_INITIALIZED 231 288 unsigned int cxy; // cluster identifier … … 276 333 unsigned int size, 277 334 unsigned int cxy ); 335 278 336 /***************************************************************************************** 279 337 * This function allocates enough space for <count> objects that are <size> bytes … … 290 348 unsigned int cxy ); 291 349 292 /*********************************************************************************************293 * This blocking function implements an user-level interactive debugger that can be294 * introduced in any user application to display various kernel distributed structures295 * related to the calling process. The supported commands are:296 * - p (cxy) : display all processes descriptors in a given cluster.297 * - s (cxy,lid) : display all threads attached to a given core in a given cluster.298 * - v (cxy) : display the calling process VMM in a given cluster.299 * - t (tid) : display all owner process descriptors attached to a given TXT terminal.300 * - x : force the calling process to exit.301 * - c : continue calling process execution.302 *********************************************************************************************303 * @ return an integer value between 0 and RAND_MAX.304 ********************************************************************************************/305 void idbg();306 307 350 #endif /* _LIBALMOSMKH_H_ */ 308 351
Note: See TracChangeset
for help on using the changeset viewer.