1*83726b77SMark Corbin /* 2*83726b77SMark Corbin * RISC-V CPU related code 3*83726b77SMark Corbin * 4*83726b77SMark Corbin * Copyright (c) 2019 Mark Corbin 5*83726b77SMark Corbin * 6*83726b77SMark Corbin * This program is free software; you can redistribute it and/or modify 7*83726b77SMark Corbin * it under the terms of the GNU General Public License as published by 8*83726b77SMark Corbin * the Free Software Foundation; either version 2 of the License, or 9*83726b77SMark Corbin * (at your option) any later version. 10*83726b77SMark Corbin * 11*83726b77SMark Corbin * This program is distributed in the hope that it will be useful, 12*83726b77SMark Corbin * but WITHOUT ANY WARRANTY; without even the implied warranty of 13*83726b77SMark Corbin * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14*83726b77SMark Corbin * GNU General Public License for more details. 15*83726b77SMark Corbin * 16*83726b77SMark Corbin * You should have received a copy of the GNU General Public License 17*83726b77SMark Corbin * along with this program; if not, see <http://www.gnu.org/licenses/>. 18*83726b77SMark Corbin */ 19*83726b77SMark Corbin #include "qemu/osdep.h" 20*83726b77SMark Corbin 21*83726b77SMark Corbin #include "target_arch.h" 22*83726b77SMark Corbin 23*83726b77SMark Corbin #define TP_OFFSET 16 24*83726b77SMark Corbin 25*83726b77SMark Corbin /* Compare with cpu_set_user_tls() in riscv/riscv/vm_machdep.c */ target_cpu_set_tls(CPURISCVState * env,target_ulong newtls)26*83726b77SMark Corbinvoid target_cpu_set_tls(CPURISCVState *env, target_ulong newtls) 27*83726b77SMark Corbin { 28*83726b77SMark Corbin env->gpr[xTP] = newtls + TP_OFFSET; 29*83726b77SMark Corbin } 30