setspc.c
来自「嵌入式操作系统T-Kernel 完整代码」· C语言 代码 · 共 63 行
C
63 行
/* *---------------------------------------------------------------------- * T-Kernel * * Copyright (C) 2004 by Ken Sakamura. All rights reserved. * T-Kernel is distributed under the T-License. *---------------------------------------------------------------------- * * Version: 1.01.00 * Released by T-Engine Forum(http://www.t-engine.org) at 2004/6/28. * *---------------------------------------------------------------------- *//* * @(#)setspc.c (libtk/S1C38K) * * Address space control */#include <basic.h>#include <tk/tkernel.h>#include <tk/sysdef.h>#include "getsvcenv.h"/* * Set task address space */EXPORT ER SetTaskSpace( ID taskid ){ UW taskmode; ER er; if ( taskid == TSK_SELF ) { /* Set current CPL in RPL */ taskmode = getsvcenv(); SCInfo.taskmode ^= (taskmode ^ (taskmode << 16)) & TMF_PPL(3); } else { T_EIT r_eit; T_CREGS r_cregs; T_TSKSPC tskspc; /* Get logical space/taskmode for taskid tasks */ er = tk_get_reg(taskid, NULL, &r_eit, &r_cregs); if ( er < E_OK ) goto err_ret; /* Change to logical space for nominated tasks */ tskspc.uatb = r_cregs.uatb; tskspc.lsid = r_cregs.lsid; er = tk_set_tsp(TSK_SELF, &tskspc); if ( er < E_OK ) goto err_ret; /* Change to PPL for nominted tasks */ taskmode = getsvcenv(); SCInfo.taskmode ^= (taskmode ^ r_eit.taskmode) & TMF_PPL(3); } return E_OK;err_ret: return er;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?