]>
Commit | Line | Data |
---|---|---|
10ec5117 AG |
1 | /* |
2 | * S/390 helpers | |
3 | * | |
4 | * Copyright (c) 2009 Ulrich Hecht | |
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 | |
70539e18 | 17 | * License along with this library; if not, see <http://www.gnu.org/licenses/>. |
10ec5117 AG |
18 | */ |
19 | ||
20 | #include <stdio.h> | |
21 | #include <stdlib.h> | |
22 | #include <string.h> | |
23 | ||
24 | #include "cpu.h" | |
25 | #include "exec-all.h" | |
26 | #include "gdbstub.h" | |
27 | #include "qemu-common.h" | |
28 | ||
10c339a0 AG |
29 | #include <linux/kvm.h> |
30 | #include "kvm.h" | |
31 | ||
10ec5117 AG |
32 | CPUS390XState *cpu_s390x_init(const char *cpu_model) |
33 | { | |
34 | CPUS390XState *env; | |
35 | static int inited = 0; | |
36 | ||
37 | env = qemu_mallocz(sizeof(CPUS390XState)); | |
38 | cpu_exec_init(env); | |
39 | if (!inited) { | |
40 | inited = 1; | |
41 | } | |
42 | ||
43 | env->cpu_model_str = cpu_model; | |
44 | cpu_reset(env); | |
45 | qemu_init_vcpu(env); | |
46 | return env; | |
47 | } | |
48 | ||
10ec5117 AG |
49 | void cpu_reset(CPUS390XState *env) |
50 | { | |
51 | if (qemu_loglevel_mask(CPU_LOG_RESET)) { | |
52 | qemu_log("CPU Reset (CPU %d)\n", env->cpu_index); | |
53 | log_cpu_state(env, 0); | |
54 | } | |
55 | ||
56 | memset(env, 0, offsetof(CPUS390XState, breakpoints)); | |
57 | /* FIXME: reset vector? */ | |
58 | tlb_flush(env, 1); | |
59 | } | |
10c339a0 | 60 | |
c92114b1 AG |
61 | target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr) |
62 | { | |
63 | return 0; | |
64 | } | |
65 | ||
10c339a0 AG |
66 | #ifndef CONFIG_USER_ONLY |
67 | ||
68 | int cpu_s390x_handle_mmu_fault (CPUState *env, target_ulong address, int rw, | |
69 | int mmu_idx, int is_softmmu) | |
70 | { | |
71 | target_ulong phys; | |
72 | int prot; | |
73 | ||
74 | /* XXX: implement mmu */ | |
75 | ||
76 | phys = address; | |
d4c430a8 | 77 | prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; |
10c339a0 | 78 | |
d4c430a8 PB |
79 | tlb_set_page(env, address & TARGET_PAGE_MASK, |
80 | phys & TARGET_PAGE_MASK, prot, | |
81 | mmu_idx, TARGET_PAGE_SIZE); | |
82 | return 0; | |
10c339a0 AG |
83 | } |
84 | #endif /* CONFIG_USER_ONLY */ |