[367] | 1 | /* |
---|
| 2 | * hal_switch.h - TSAR architecture context switch function |
---|
| 3 | * |
---|
| 4 | * Copyright (c) 2008,2009,2010,2011,2012 Ghassan Almaless |
---|
| 5 | * Copyright (c) 2011,2012 UPMC Sorbonne Universites |
---|
| 6 | * |
---|
| 7 | * This file is part of ALMOS-kernel. |
---|
| 8 | * |
---|
| 9 | * ALMOS-kernel is free software; you can redistribute it and/or modify it |
---|
| 10 | * under the terms of the GNU General Public License as published by |
---|
| 11 | * the Free Software Foundation; version 2.0 of the License. |
---|
| 12 | * |
---|
| 13 | * ALMOS-kernel is distributed in the hope that it will be useful, but |
---|
| 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 16 | * General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with ALMOS-kernel; if not, write to the Free Software Foundation, |
---|
| 20 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
| 21 | */ |
---|
| 22 | |
---|
| 23 | #ifndef _HAL_SWITCH_H_ |
---|
| 24 | #define _HAL_SWITCH_H_ |
---|
| 25 | |
---|
| 26 | /************************************************************************************* |
---|
| 27 | * The hal_do_switch() function is an assembly level code called by the |
---|
| 28 | * hal_cpu_context_switch() function to make the actual context swich. |
---|
| 29 | * The hal_cpu_context_t structure used to store a core context is defined |
---|
| 30 | * in the TSAR specific hal_context.c file. |
---|
| 31 | * The following core registers are saved in the old context & and restored |
---|
| 32 | * from the new context: |
---|
| 33 | * - GPR : all, but (zero, k0, k1), plus (hi, lo) |
---|
| 34 | * - CP0 : c0_th , c0_sr |
---|
| 35 | * - CP2 : c2_ptpr , C2_mode, C2_epc |
---|
| 36 | * When the switch is completed, it jumps to address contained in register $31 |
---|
| 37 | * of the new context. |
---|
| 38 | ************************************************************************************* |
---|
| 39 | * @ ctx_old : local pointer on the old thread context. |
---|
| 40 | * @ ctx_new : local pointer on the new thread context. |
---|
| 41 | ************************************************************************************/ |
---|
| 42 | void hal_do_switch( void * ctx_old, |
---|
| 43 | void * ctx_new ); |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | #endif /* _HAL_SWITCH_H_ */ |
---|