Statistics
| Branch: | Revision:

root / target-s390x / helper.c @ 10c339a0

History | View | Annotate | Download (2.1 kB)

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
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 <stdio.h>
22
#include <stdlib.h>
23
#include <string.h>
24

    
25
#include "cpu.h"
26
#include "exec-all.h"
27
#include "gdbstub.h"
28
#include "qemu-common.h"
29

    
30
#include <linux/kvm.h>
31
#include "kvm.h"
32

    
33
CPUS390XState *cpu_s390x_init(const char *cpu_model)
34
{
35
    CPUS390XState *env;
36
    static int inited = 0;
37

    
38
    env = qemu_mallocz(sizeof(CPUS390XState));
39
    cpu_exec_init(env);
40
    if (!inited) {
41
        inited = 1;
42
    }
43

    
44
    env->cpu_model_str = cpu_model;
45
    cpu_reset(env);
46
    qemu_init_vcpu(env);
47
    return env;
48
}
49

    
50
target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr)
51
{
52
    return addr;
53
}
54

    
55
void cpu_reset(CPUS390XState *env)
56
{
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);
60
    }
61

    
62
    memset(env, 0, offsetof(CPUS390XState, breakpoints));
63
    /* FIXME: reset vector? */
64
    tlb_flush(env, 1);
65
}
66

    
67
#ifndef CONFIG_USER_ONLY
68

    
69
int cpu_s390x_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
70
                                int mmu_idx, int is_softmmu)
71
{
72
    target_ulong phys;
73
    int prot;
74

    
75
    /* XXX: implement mmu */
76

    
77
    phys = address;
78
    prot = PAGE_READ | PAGE_WRITE;
79

    
80
    return tlb_set_page(env, address & TARGET_PAGE_MASK,
81
                        phys & TARGET_PAGE_MASK, prot,
82
                        mmu_idx, is_softmmu);
83
}
84
#endif /* CONFIG_USER_ONLY */