root / target-s390x / op_helper.c @ d5a43964
History | View | Annotate | Download (2.3 kB)
1 | 10ec5117 | Alexander Graf | /*
|
---|---|---|---|
2 | 10ec5117 | Alexander Graf | * S/390 helper routines
|
3 | 10ec5117 | Alexander Graf | *
|
4 | 10ec5117 | Alexander Graf | * Copyright (c) 2009 Alexander Graf
|
5 | 10ec5117 | Alexander Graf | *
|
6 | 10ec5117 | Alexander Graf | * This library is free software; you can redistribute it and/or
|
7 | 10ec5117 | Alexander Graf | * modify it under the terms of the GNU Lesser General Public
|
8 | 10ec5117 | Alexander Graf | * License as published by the Free Software Foundation; either
|
9 | 10ec5117 | Alexander Graf | * version 2 of the License, or (at your option) any later version.
|
10 | 10ec5117 | Alexander Graf | *
|
11 | 10ec5117 | Alexander Graf | * This library is distributed in the hope that it will be useful,
|
12 | 10ec5117 | Alexander Graf | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | 10ec5117 | Alexander Graf | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 | 10ec5117 | Alexander Graf | * Lesser General Public License for more details.
|
15 | 10ec5117 | Alexander Graf | *
|
16 | 10ec5117 | Alexander Graf | * You should have received a copy of the GNU Lesser General Public
|
17 | 70539e18 | Blue Swirl | * License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
18 | 10ec5117 | Alexander Graf | */
|
19 | 10ec5117 | Alexander Graf | |
20 | 10ec5117 | Alexander Graf | #include "exec.h" |
21 | 10ec5117 | Alexander Graf | |
22 | 10ec5117 | Alexander Graf | /*****************************************************************************/
|
23 | 10ec5117 | Alexander Graf | /* Softmmu support */
|
24 | 10ec5117 | Alexander Graf | #if !defined (CONFIG_USER_ONLY)
|
25 | 10ec5117 | Alexander Graf | |
26 | 10ec5117 | Alexander Graf | #define MMUSUFFIX _mmu
|
27 | 10ec5117 | Alexander Graf | |
28 | 10ec5117 | Alexander Graf | #define SHIFT 0 |
29 | 10ec5117 | Alexander Graf | #include "softmmu_template.h" |
30 | 10ec5117 | Alexander Graf | |
31 | 10ec5117 | Alexander Graf | #define SHIFT 1 |
32 | 10ec5117 | Alexander Graf | #include "softmmu_template.h" |
33 | 10ec5117 | Alexander Graf | |
34 | 10ec5117 | Alexander Graf | #define SHIFT 2 |
35 | 10ec5117 | Alexander Graf | #include "softmmu_template.h" |
36 | 10ec5117 | Alexander Graf | |
37 | 10ec5117 | Alexander Graf | #define SHIFT 3 |
38 | 10ec5117 | Alexander Graf | #include "softmmu_template.h" |
39 | 10ec5117 | Alexander Graf | |
40 | 10ec5117 | Alexander Graf | /* try to fill the TLB and return an exception if error. If retaddr is
|
41 | 10ec5117 | Alexander Graf | NULL, it means that the function was called in C code (i.e. not
|
42 | 10ec5117 | Alexander Graf | from generated code or from helper.c) */
|
43 | 10ec5117 | Alexander Graf | /* XXX: fix it to restore all registers */
|
44 | 10ec5117 | Alexander Graf | void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) |
45 | 10ec5117 | Alexander Graf | { |
46 | 10ec5117 | Alexander Graf | TranslationBlock *tb; |
47 | 10ec5117 | Alexander Graf | CPUState *saved_env; |
48 | 10ec5117 | Alexander Graf | unsigned long pc; |
49 | 10ec5117 | Alexander Graf | int ret;
|
50 | 10ec5117 | Alexander Graf | |
51 | 10ec5117 | Alexander Graf | /* XXX: hack to restore env in all cases, even if not called from
|
52 | 10ec5117 | Alexander Graf | generated code */
|
53 | 10ec5117 | Alexander Graf | saved_env = env; |
54 | 10ec5117 | Alexander Graf | env = cpu_single_env; |
55 | 10ec5117 | Alexander Graf | ret = cpu_s390x_handle_mmu_fault(env, addr, is_write, mmu_idx, 1);
|
56 | 10ec5117 | Alexander Graf | if (unlikely(ret != 0)) { |
57 | 10ec5117 | Alexander Graf | if (likely(retaddr)) {
|
58 | 10ec5117 | Alexander Graf | /* now we have a real cpu fault */
|
59 | 10ec5117 | Alexander Graf | pc = (unsigned long)retaddr; |
60 | 10ec5117 | Alexander Graf | tb = tb_find_pc(pc); |
61 | 10ec5117 | Alexander Graf | if (likely(tb)) {
|
62 | 10ec5117 | Alexander Graf | /* the PC is inside the translated code. It means that we have
|
63 | 10ec5117 | Alexander Graf | a virtual CPU fault */
|
64 | 618ba8e6 | Stefan Weil | cpu_restore_state(tb, env, pc); |
65 | 10ec5117 | Alexander Graf | } |
66 | 10ec5117 | Alexander Graf | } |
67 | 10ec5117 | Alexander Graf | /* XXX */
|
68 | 10ec5117 | Alexander Graf | /* helper_raise_exception_err(env->exception_index, env->error_code); */
|
69 | 10ec5117 | Alexander Graf | } |
70 | 10ec5117 | Alexander Graf | env = saved_env; |
71 | 10ec5117 | Alexander Graf | } |
72 | 10ec5117 | Alexander Graf | |
73 | 10ec5117 | Alexander Graf | #endif
|
74 | d5a43964 | Alexander Graf | |
75 | d5a43964 | Alexander Graf | uint32_t calc_cc(CPUState *env, uint32_t cc_op, uint64_t src, uint64_t dst, |
76 | d5a43964 | Alexander Graf | uint64_t vr) |
77 | d5a43964 | Alexander Graf | { |
78 | d5a43964 | Alexander Graf | return 0; |
79 | d5a43964 | Alexander Graf | } |