exec.h 2.4 KB
Newer Older
B
bellard 已提交
1
/*
2
 *  PowerPC emulation definitions for qemu.
3
 *
4
 *  Copyright (c) 2003-2007 Jocelyn Mayer
B
bellard 已提交
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
#if !defined (__PPC_H__)
#define __PPC_H__

23 24
#include "config.h"

B
bellard 已提交
25 26
#include "dyngen-exec.h"

27 28
#include "cpu.h"
#include "exec-all.h"
29

30 31 32 33
/* For normal operations, precise emulation should not be needed */
//#define USE_PRECISE_EMULATION 1
#define USE_PRECISE_EMULATION 0

B
bellard 已提交
34
register struct CPUPPCState *env asm(AREG0);
35 36 37
#if TARGET_LONG_BITS > HOST_LONG_BITS
/* no registers can be used */
#define T0 (env->t0)
38
#define TDX "%016" PRIx64
39
#else
A
aurel32 已提交
40
register target_ulong T0 asm(AREG1);
41
#define TDX "%016lx"
42
#endif
B
bellard 已提交
43

44
#if defined (DEBUG_OP)
T
ths 已提交
45
# define RETURN() __asm__ __volatile__("nop" : : : "memory");
46
#else
T
ths 已提交
47
# define RETURN() __asm__ __volatile__("" : : : "memory");
48
#endif
B
bellard 已提交
49

50
#if !defined(CONFIG_USER_ONLY)
51
#include "softmmu_exec.h"
52
#endif /* !defined(CONFIG_USER_ONLY) */
B
bellard 已提交
53

54 55
void raise_exception_err (CPUState *env, int exception, int error_code);
void raise_exception (CPUState *env, int exception);
B
bellard 已提交
56

57
int get_physical_address (CPUState *env, mmu_ctx_t *ctx, target_ulong vaddr,
J
j_mayer 已提交
58
                          int rw, int access_type);
B
bellard 已提交
59

60 61
void ppc6xx_tlb_store (CPUState *env, target_ulong EPN, int way, int is_code,
                       target_ulong pte0, target_ulong pte1);
62

63
static always_inline void env_to_regs (void)
B
bellard 已提交
64 65 66
{
}

67
static always_inline void regs_to_env (void)
B
bellard 已提交
68 69 70
{
}

71
int cpu_ppc_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
72
                              int mmu_idx, int is_softmmu);
B
bellard 已提交
73

74
static always_inline int cpu_halted (CPUState *env)
75
{
76 77
    if (!env->halted)
        return 0;
78
    if (msr_ee && (env->interrupt_request & CPU_INTERRUPT_HARD)) {
79 80 81 82 83 84
        env->halted = 0;
        return 0;
    }
    return EXCP_HALTED;
}

B
bellard 已提交
85
#endif /* !defined (__PPC_H__) */