QMP: Use QERR_QMP_BAD_INPUT_OBJECT_MEMBER
[qemu/ar7.git] / target-s390x / helper.c
blob4a5297be181ef9bf193327f2088844112edb0e6a
1 /*
2 * S/390 helpers
4 * Copyright (c) 2009 Ulrich Hecht
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.
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.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <string.h>
24 #include "cpu.h"
25 #include "exec-all.h"
26 #include "gdbstub.h"
27 #include "qemu-common.h"
29 #include <linux/kvm.h>
30 #include "kvm.h"
32 CPUS390XState *cpu_s390x_init(const char *cpu_model)
34 CPUS390XState *env;
35 static int inited = 0;
37 env = qemu_mallocz(sizeof(CPUS390XState));
38 cpu_exec_init(env);
39 if (!inited) {
40 inited = 1;
43 env->cpu_model_str = cpu_model;
44 cpu_reset(env);
45 qemu_init_vcpu(env);
46 return env;
49 void cpu_reset(CPUS390XState *env)
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);
56 memset(env, 0, offsetof(CPUS390XState, breakpoints));
57 /* FIXME: reset vector? */
58 tlb_flush(env, 1);
61 target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr)
63 return 0;
66 #ifndef CONFIG_USER_ONLY
68 int cpu_s390x_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
69 int mmu_idx, int is_softmmu)
71 target_ulong phys;
72 int prot;
74 /* XXX: implement mmu */
76 phys = address;
77 prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
79 tlb_set_page(env, address & TARGET_PAGE_MASK,
80 phys & TARGET_PAGE_MASK, prot,
81 mmu_idx, TARGET_PAGE_SIZE);
82 return 0;
84 #endif /* CONFIG_USER_ONLY */