]> git.proxmox.com Git - qemu.git/blame - target-s390x/helper.c
load_elf: replace the address addend by a translation function
[qemu.git] / target-s390x / helper.c
CommitLineData
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
32CPUS390XState *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
49void 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
AG
60
61#ifndef CONFIG_USER_ONLY
62
63int cpu_s390x_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
64 int mmu_idx, int is_softmmu)
65{
66 target_ulong phys;
67 int prot;
68
69 /* XXX: implement mmu */
70
71 phys = address;
72 prot = PAGE_READ | PAGE_WRITE;
73
74 return tlb_set_page(env, address & TARGET_PAGE_MASK,
75 phys & TARGET_PAGE_MASK, prot,
76 mmu_idx, is_softmmu);
77}
78#endif /* CONFIG_USER_ONLY */