]> git.proxmox.com Git - mirror_qemu.git/blame - target/moxie/cpu.h
Use DECLARE_*CHECKER* macros
[mirror_qemu.git] / target / moxie / cpu.h
CommitLineData
525bd324
AG
1/*
2 * Moxie emulation
3 *
4 * Copyright (c) 2008, 2010, 2013 Anthony Green
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
70c9483a 9 * version 2.1 of the License, or (at your option) any later version.
525bd324
AG
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 *
70c9483a 16 * You should have received a copy of the GNU Lesser General Public License
525bd324
AG
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
07f5a258
MA
19
20#ifndef MOXIE_CPU_H
21#define MOXIE_CPU_H
525bd324 22
74433bf0 23#include "exec/cpu-defs.h"
db1015e9 24#include "qom/object.h"
525bd324 25
525bd324
AG
26#define MOXIE_EX_DIV0 0
27#define MOXIE_EX_BAD 1
28#define MOXIE_EX_IRQ 2
29#define MOXIE_EX_SWI 3
30#define MOXIE_EX_MMU_MISS 4
31#define MOXIE_EX_BREAK 16
32
525bd324
AG
33typedef struct CPUMoxieState {
34
35 uint32_t flags; /* general execution flags */
36 uint32_t gregs[16]; /* general registers */
37 uint32_t sregs[256]; /* special registers */
38 uint32_t pc; /* program counter */
39 /* Instead of saving the cc value, we save the cmp arguments
40 and compute cc on demand. */
41 uint32_t cc_a; /* reg a for condition code calculation */
42 uint32_t cc_b; /* reg b for condition code calculation */
43
44 void *irq[8];
45
1f5c00cf
AB
46 /* Fields up to this point are cleared by a CPU reset */
47 struct {} end_reset_fields;
525bd324
AG
48} CPUMoxieState;
49
2e5b09fd 50#include "hw/core/cpu.h"
525bd324
AG
51
52#define TYPE_MOXIE_CPU "moxie-cpu"
53
db1015e9
EH
54typedef struct MoxieCPU MoxieCPU;
55typedef struct MoxieCPUClass MoxieCPUClass;
8110fa1d
EH
56DECLARE_OBJ_CHECKERS(MoxieCPU, MoxieCPUClass,
57 MOXIE_CPU, TYPE_MOXIE_CPU)
525bd324
AG
58
59/**
60 * MoxieCPUClass:
61 * @parent_reset: The parent class' reset handler.
62 *
63 * A Moxie CPU model.
64 */
db1015e9 65struct MoxieCPUClass {
525bd324
AG
66 /*< private >*/
67 CPUClass parent_class;
68 /*< public >*/
69
70 DeviceRealize parent_realize;
781c67ca 71 DeviceReset parent_reset;
db1015e9 72};
525bd324
AG
73
74/**
75 * MoxieCPU:
76 * @env: #CPUMoxieState
77 *
78 * A Moxie CPU.
79 */
db1015e9 80struct MoxieCPU {
525bd324
AG
81 /*< private >*/
82 CPUState parent_obj;
83 /*< public >*/
84
5b146dc7 85 CPUNegativeOffsetState neg;
525bd324 86 CPUMoxieState env;
db1015e9 87};
525bd324 88
525bd324 89
53574064 90void moxie_cpu_do_interrupt(CPUState *cs);
90c84c56 91void moxie_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
00b941e5 92hwaddr moxie_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
525bd324
AG
93void moxie_translate_init(void);
94int cpu_moxie_signal_handler(int host_signum, void *pinfo,
95 void *puc);
96
0255db23
IM
97#define MOXIE_CPU_TYPE_SUFFIX "-" TYPE_MOXIE_CPU
98#define MOXIE_CPU_TYPE_NAME(model) model MOXIE_CPU_TYPE_SUFFIX
0dacec87 99#define CPU_RESOLVING_TYPE TYPE_MOXIE_CPU
0255db23 100
525bd324
AG
101#define cpu_signal_handler cpu_moxie_signal_handler
102
97ed5ccd 103static inline int cpu_mmu_index(CPUMoxieState *env, bool ifetch)
525bd324
AG
104{
105 return 0;
106}
107
4f7c64b3 108typedef CPUMoxieState CPUArchState;
2161a612 109typedef MoxieCPU ArchCPU;
4f7c64b3 110
525bd324 111#include "exec/cpu-all.h"
525bd324 112
525bd324 113static inline void cpu_get_tb_cpu_state(CPUMoxieState *env, target_ulong *pc,
89fee74a 114 target_ulong *cs_base, uint32_t *flags)
525bd324
AG
115{
116 *pc = env->pc;
117 *cs_base = 0;
118 *flags = 0;
119}
120
ccfd61fc
RH
121bool moxie_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
122 MMUAccessType access_type, int mmu_idx,
123 bool probe, uintptr_t retaddr);
525bd324 124
07f5a258 125#endif /* MOXIE_CPU_H */