Add S390x virtio machine description
[qemu.git] / target-s390x / helper.c
blob4c2dc821156887fee269083afc868fd3b17183e6
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, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <string.h>
25 #include "cpu.h"
26 #include "exec-all.h"
27 #include "gdbstub.h"
28 #include "qemu-common.h"
30 #include <linux/kvm.h>
31 #include "kvm.h"
33 CPUS390XState *cpu_s390x_init(const char *cpu_model)
35 CPUS390XState *env;
36 static int inited = 0;
38 env = qemu_mallocz(sizeof(CPUS390XState));
39 cpu_exec_init(env);
40 if (!inited) {
41 inited = 1;
44 env->cpu_model_str = cpu_model;
45 cpu_reset(env);
46 qemu_init_vcpu(env);
47 return env;
50 target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr)
52 return addr;
55 void cpu_reset(CPUS390XState *env)
57 if (qemu_loglevel_mask(CPU_LOG_RESET)) {
58 qemu_log("CPU Reset (CPU %d)\n", env->cpu_index);
59 log_cpu_state(env, 0);
62 memset(env, 0, offsetof(CPUS390XState, breakpoints));
63 /* FIXME: reset vector? */
64 tlb_flush(env, 1);
67 #ifndef CONFIG_USER_ONLY
69 int cpu_s390x_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
70 int mmu_idx, int is_softmmu)
72 target_ulong phys;
73 int prot;
75 /* XXX: implement mmu */
77 phys = address;
78 prot = PAGE_READ | PAGE_WRITE;
80 return tlb_set_page(env, address & TARGET_PAGE_MASK,
81 phys & TARGET_PAGE_MASK, prot,
82 mmu_idx, is_softmmu);
84 #endif /* CONFIG_USER_ONLY */