target-mips: microMIPS ASE support
[qemu.git] / target-s390x / op_helper.c
blob402df2d85e50819e71c754d361d68e5b1e00b56f
1 /*
2 * S/390 helper routines
4 * Copyright (c) 2009 Alexander Graf
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 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 <http://www.gnu.org/licenses/>.
20 #include "exec.h"
22 /*****************************************************************************/
23 /* Softmmu support */
24 #if !defined (CONFIG_USER_ONLY)
26 #define MMUSUFFIX _mmu
28 #define SHIFT 0
29 #include "softmmu_template.h"
31 #define SHIFT 1
32 #include "softmmu_template.h"
34 #define SHIFT 2
35 #include "softmmu_template.h"
37 #define SHIFT 3
38 #include "softmmu_template.h"
40 /* try to fill the TLB and return an exception if error. If retaddr is
41 NULL, it means that the function was called in C code (i.e. not
42 from generated code or from helper.c) */
43 /* XXX: fix it to restore all registers */
44 void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr)
46 TranslationBlock *tb;
47 CPUState *saved_env;
48 unsigned long pc;
49 int ret;
51 /* XXX: hack to restore env in all cases, even if not called from
52 generated code */
53 saved_env = env;
54 env = cpu_single_env;
55 ret = cpu_s390x_handle_mmu_fault(env, addr, is_write, mmu_idx, 1);
56 if (unlikely(ret != 0)) {
57 if (likely(retaddr)) {
58 /* now we have a real cpu fault */
59 pc = (unsigned long)retaddr;
60 tb = tb_find_pc(pc);
61 if (likely(tb)) {
62 /* the PC is inside the translated code. It means that we have
63 a virtual CPU fault */
64 cpu_restore_state(tb, env, pc, NULL);
67 /* XXX */
68 /* helper_raise_exception_err(env->exception_index, env->error_code); */
70 env = saved_env;
73 #endif