18c98705bSWarner Losh /* 28c98705bSWarner Losh * arm cpu related code 38c98705bSWarner Losh * 48c98705bSWarner Losh * Copyright (c) 2013 Stacey D. Son 58c98705bSWarner Losh * 68c98705bSWarner Losh * This program is free software; you can redistribute it and/or modify 78c98705bSWarner Losh * it under the terms of the GNU General Public License as published by 88c98705bSWarner Losh * the Free Software Foundation; either version 2 of the License, or 98c98705bSWarner Losh * (at your option) any later version. 108c98705bSWarner Losh * 118c98705bSWarner Losh * This program is distributed in the hope that it will be useful, 128c98705bSWarner Losh * but WITHOUT ANY WARRANTY; without even the implied warranty of 138c98705bSWarner Losh * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 148c98705bSWarner Losh * GNU General Public License for more details. 158c98705bSWarner Losh * 168c98705bSWarner Losh * You should have received a copy of the GNU General Public License 178c98705bSWarner Losh * along with this program; if not, see <http://www.gnu.org/licenses/>. 188c98705bSWarner Losh */ 19*48e438a3SMarkus Armbruster 20*48e438a3SMarkus Armbruster #include "qemu/osdep.h" 218c98705bSWarner Losh #include "target_arch.h" 228c98705bSWarner Losh target_cpu_set_tls(CPUARMState * env,target_ulong newtls)238c98705bSWarner Loshvoid target_cpu_set_tls(CPUARMState *env, target_ulong newtls) 248c98705bSWarner Losh { 258c98705bSWarner Losh if (access_secure_reg(env)) { 268c98705bSWarner Losh env->cp15.tpidrurw_s = newtls; 278c98705bSWarner Losh env->cp15.tpidruro_s = newtls; 288c98705bSWarner Losh return; 298c98705bSWarner Losh } 308c98705bSWarner Losh 318c98705bSWarner Losh env->cp15.tpidr_el[0] = newtls; 328c98705bSWarner Losh env->cp15.tpidrro_el[0] = newtls; 338c98705bSWarner Losh } 348c98705bSWarner Losh target_cpu_get_tls(CPUARMState * env)358c98705bSWarner Loshtarget_ulong target_cpu_get_tls(CPUARMState *env) 368c98705bSWarner Losh { 378c98705bSWarner Losh if (access_secure_reg(env)) { 388c98705bSWarner Losh return env->cp15.tpidruro_s; 398c98705bSWarner Losh } 408c98705bSWarner Losh return env->cp15.tpidrro_el[0]; 418c98705bSWarner Losh } 42