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