root / target-s390x / op_helper.c @ 44e4c0ba
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 | 10ec5117 | Alexander Graf | * License along with this library; if not, write to the Free Software
|
18 | 10ec5117 | Alexander Graf | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
|
19 | 10ec5117 | Alexander Graf | */
|
20 | 10ec5117 | Alexander Graf | |
21 | 10ec5117 | Alexander Graf | #include "exec.h" |
22 | 10ec5117 | Alexander Graf | |
23 | 10ec5117 | Alexander Graf | /*****************************************************************************/
|
24 | 10ec5117 | Alexander Graf | /* Softmmu support */
|
25 | 10ec5117 | Alexander Graf | #if !defined (CONFIG_USER_ONLY)
|
26 | 10ec5117 | Alexander Graf | |
27 | 10ec5117 | Alexander Graf | #define MMUSUFFIX _mmu
|
28 | 10ec5117 | Alexander Graf | |
29 | 10ec5117 | Alexander Graf | #define SHIFT 0 |
30 | 10ec5117 | Alexander Graf | #include "softmmu_template.h" |
31 | 10ec5117 | Alexander Graf | |
32 | 10ec5117 | Alexander Graf | #define SHIFT 1 |
33 | 10ec5117 | Alexander Graf | #include "softmmu_template.h" |
34 | 10ec5117 | Alexander Graf | |
35 | 10ec5117 | Alexander Graf | #define SHIFT 2 |
36 | 10ec5117 | Alexander Graf | #include "softmmu_template.h" |
37 | 10ec5117 | Alexander Graf | |
38 | 10ec5117 | Alexander Graf | #define SHIFT 3 |
39 | 10ec5117 | Alexander Graf | #include "softmmu_template.h" |
40 | 10ec5117 | Alexander Graf | |
41 | 10ec5117 | Alexander Graf | /* try to fill the TLB and return an exception if error. If retaddr is
|
42 | 10ec5117 | Alexander Graf | NULL, it means that the function was called in C code (i.e. not
|
43 | 10ec5117 | Alexander Graf | from generated code or from helper.c) */
|
44 | 10ec5117 | Alexander Graf | /* XXX: fix it to restore all registers */
|
45 | 10ec5117 | Alexander Graf | void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) |
46 | 10ec5117 | Alexander Graf | { |
47 | 10ec5117 | Alexander Graf | TranslationBlock *tb; |
48 | 10ec5117 | Alexander Graf | CPUState *saved_env; |
49 | 10ec5117 | Alexander Graf | unsigned long pc; |
50 | 10ec5117 | Alexander Graf | int ret;
|
51 | 10ec5117 | Alexander Graf | |
52 | 10ec5117 | Alexander Graf | /* XXX: hack to restore env in all cases, even if not called from
|
53 | 10ec5117 | Alexander Graf | generated code */
|
54 | 10ec5117 | Alexander Graf | saved_env = env; |
55 | 10ec5117 | Alexander Graf | env = cpu_single_env; |
56 | 10ec5117 | Alexander Graf | ret = cpu_s390x_handle_mmu_fault(env, addr, is_write, mmu_idx, 1);
|
57 | 10ec5117 | Alexander Graf | if (unlikely(ret != 0)) { |
58 | 10ec5117 | Alexander Graf | if (likely(retaddr)) {
|
59 | 10ec5117 | Alexander Graf | /* now we have a real cpu fault */
|
60 | 10ec5117 | Alexander Graf | pc = (unsigned long)retaddr; |
61 | 10ec5117 | Alexander Graf | tb = tb_find_pc(pc); |
62 | 10ec5117 | Alexander Graf | if (likely(tb)) {
|
63 | 10ec5117 | Alexander Graf | /* the PC is inside the translated code. It means that we have
|
64 | 10ec5117 | Alexander Graf | a virtual CPU fault */
|
65 | 10ec5117 | Alexander Graf | cpu_restore_state(tb, env, pc, NULL);
|
66 | 10ec5117 | Alexander Graf | } |
67 | 10ec5117 | Alexander Graf | } |
68 | 10ec5117 | Alexander Graf | /* XXX */
|
69 | 10ec5117 | Alexander Graf | /* helper_raise_exception_err(env->exception_index, env->error_code); */
|
70 | 10ec5117 | Alexander Graf | } |
71 | 10ec5117 | Alexander Graf | env = saved_env; |
72 | 10ec5117 | Alexander Graf | } |
73 | 10ec5117 | Alexander Graf | |
74 | 10ec5117 | Alexander Graf | #endif |