]>
git.proxmox.com Git - mirror_qemu.git/blob - target-s390x/cpu.h
2 * S/390 virtual CPU header
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
23 #define TARGET_LONG_BITS 64
25 #define ELF_MACHINE EM_S390
27 #define CPUState struct CPUS390XState
31 #include "softfloat.h"
33 #define NB_MMU_MODES 2 // guess
34 #define MMU_USER_IDX 0 // guess
38 #ifdef WORDS_BIGENDIAN
50 typedef struct CPUS390XState
{
51 uint64_t regs
[16]; /* GP registers */
53 uint32_t aregs
[16]; /* access registers */
55 uint32_t fpc
; /* floating-point control register */
56 FPReg fregs
[16]; /* FP registers */
57 float_status fpu_status
; /* passed to softfloat lib */
64 int cc
; /* condition code (0-3) */
71 #if defined(CONFIG_USER_ONLY)
72 static inline void cpu_clone_regs(CPUState
*env
, target_ulong newsp
)
75 env
->regs
[15] = newsp
;
80 CPUS390XState
*cpu_s390x_init(const char *cpu_model
);
81 int cpu_s390x_exec(CPUS390XState
*s
);
82 void cpu_s390x_close(CPUS390XState
*s
);
84 /* you can call this signal handler from your SIGBUS and SIGSEGV
85 signal handlers to inform the virtual CPU of exceptions. non zero
86 is returned if the signal was handled by the virtual CPU. */
87 int cpu_s390x_signal_handler(int host_signum
, void *pinfo
,
89 int cpu_s390x_handle_mmu_fault (CPUS390XState
*env
, target_ulong address
, int rw
,
90 int mmu_idx
, int is_softmuu
);
91 #define cpu_handle_mmu_fault cpu_s390x_handle_mmu_fault
93 #define TARGET_PAGE_BITS 12
95 #define cpu_init cpu_s390x_init
96 #define cpu_exec cpu_s390x_exec
97 #define cpu_gen_code cpu_s390x_gen_code
100 #include "exec-all.h"
102 #define EXCP_OPEX 1 /* operation exception (sigill) */
103 #define EXCP_SVC 2 /* supervisor call (syscall) */
104 #define EXCP_ADDR 5 /* addressing exception */
105 #define EXCP_EXECUTE_SVC 0xff00000 /* supervisor call via execute insn */
107 static inline void cpu_pc_from_tb(CPUState
*env
, TranslationBlock
* tb
)
109 env
->psw
.addr
= tb
->pc
;
112 static inline void cpu_get_tb_cpu_state(CPUState
* env
, target_ulong
*pc
,
113 target_ulong
*cs_base
, int *flags
)
116 /* XXX this is correct for user-mode emulation, but needs
117 * the asce register information as well when softmmu
118 * is implemented in the future */
120 *flags
= env
->psw
.mask
;