target/nios2: Use hw/registerfields.h for CR_EXCEPTION fields
[qemu.git] / target / nios2 / op_helper.c
blob08ed3b4598ba9de85f2bb494c6571facd0f396b5
1 /*
2 * Altera Nios II helper routines.
4 * Copyright (C) 2012 Chris Wulff <crwulff@gmail.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see
18 * <http://www.gnu.org/licenses/lgpl-2.1.html>
21 #include "qemu/osdep.h"
22 #include "cpu.h"
23 #include "exec/helper-proto.h"
24 #include "exec/exec-all.h"
25 #include "qemu/main-loop.h"
27 void helper_raise_exception(CPUNios2State *env, uint32_t index)
29 CPUState *cs = env_cpu(env);
30 cs->exception_index = index;
31 cpu_loop_exit(cs);
34 #ifndef CONFIG_USER_ONLY
35 void helper_eret(CPUNios2State *env, uint32_t new_status, uint32_t new_pc)
37 env->ctrl[CR_STATUS] = new_status;
38 env->pc = new_pc;
39 cpu_loop_exit(env_cpu(env));
41 #endif /* !CONFIG_USER_ONLY */