kvm: qemu: report paravirt features on cpuid
[kvm-userspace.git] / qemu / target-cris / op_helper.c
blob458b0585de7aed7d962bcbbef11c1b61bb65b881
1 /*
2 * CRIS helper routines
4 * Copyright (c) 2007 AXIS Communications
5 * Written by Edgar E. Iglesias
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include <assert.h>
23 #include "exec.h"
25 #define MMUSUFFIX _mmu
26 #ifdef __s390__
27 # define GETPC() ((void*)((unsigned long)__builtin_return_address(0) & 0x7fffffffUL))
28 #else
29 # define GETPC() (__builtin_return_address(0))
30 #endif
32 #define SHIFT 0
33 #include "softmmu_template.h"
35 #define SHIFT 1
36 #include "softmmu_template.h"
38 #define SHIFT 2
39 #include "softmmu_template.h"
41 #define SHIFT 3
42 #include "softmmu_template.h"
44 /* Try to fill the TLB and return an exception if error. If retaddr is
45 NULL, it means that the function was called in C code (i.e. not
46 from generated code or from helper.c) */
47 /* XXX: fix it to restore all registers */
48 void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr)
50 TranslationBlock *tb;
51 CPUState *saved_env;
52 unsigned long pc;
53 int ret;
55 /* XXX: hack to restore env in all cases, even if not called from
56 generated code */
57 saved_env = env;
58 env = cpu_single_env;
59 ret = cpu_cris_handle_mmu_fault(env, addr, is_write, mmu_idx, 1);
60 if (__builtin_expect(ret, 0)) {
61 if (retaddr) {
62 /* now we have a real cpu fault */
63 pc = (unsigned long)retaddr;
64 tb = tb_find_pc(pc);
65 if (tb) {
66 /* the PC is inside the translated code. It means that we have
67 a virtual CPU fault */
68 cpu_restore_state(tb, env, pc, NULL);
71 cpu_loop_exit();
73 env = saved_env;
76 void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,
77 int is_asi)