]> Git Repo - qemu.git/blame - target/moxie/cpu.h
Move QOM typedefs and add missing includes
[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;
525bd324
AG
56#define MOXIE_CPU_CLASS(klass) \
57 OBJECT_CLASS_CHECK(MoxieCPUClass, (klass), TYPE_MOXIE_CPU)
58#define MOXIE_CPU(obj) \
59 OBJECT_CHECK(MoxieCPU, (obj), TYPE_MOXIE_CPU)
60#define MOXIE_CPU_GET_CLASS(obj) \
61 OBJECT_GET_CLASS(MoxieCPUClass, (obj), TYPE_MOXIE_CPU)
62
63/**
64 * MoxieCPUClass:
65 * @parent_reset: The parent class' reset handler.
66 *
67 * A Moxie CPU model.
68 */
db1015e9 69struct MoxieCPUClass {
525bd324
AG
70 /*< private >*/
71 CPUClass parent_class;
72 /*< public >*/
73
74 DeviceRealize parent_realize;
781c67ca 75 DeviceReset parent_reset;
db1015e9 76};
525bd324
AG
77
78/**
79 * MoxieCPU:
80 * @env: #CPUMoxieState
81 *
82 * A Moxie CPU.
83 */
db1015e9 84struct MoxieCPU {
525bd324
AG
85 /*< private >*/
86 CPUState parent_obj;
87 /*< public >*/
88
5b146dc7 89 CPUNegativeOffsetState neg;
525bd324 90 CPUMoxieState env;
db1015e9 91};
525bd324 92
525bd324 93
53574064 94void moxie_cpu_do_interrupt(CPUState *cs);
90c84c56 95void moxie_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
00b941e5 96hwaddr moxie_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
525bd324
AG
97void moxie_translate_init(void);
98int cpu_moxie_signal_handler(int host_signum, void *pinfo,
99 void *puc);
100
0255db23
IM
101#define MOXIE_CPU_TYPE_SUFFIX "-" TYPE_MOXIE_CPU
102#define MOXIE_CPU_TYPE_NAME(model) model MOXIE_CPU_TYPE_SUFFIX
0dacec87 103#define CPU_RESOLVING_TYPE TYPE_MOXIE_CPU
0255db23 104
525bd324
AG
105#define cpu_signal_handler cpu_moxie_signal_handler
106
97ed5ccd 107static inline int cpu_mmu_index(CPUMoxieState *env, bool ifetch)
525bd324
AG
108{
109 return 0;
110}
111
4f7c64b3 112typedef CPUMoxieState CPUArchState;
2161a612 113typedef MoxieCPU ArchCPU;
4f7c64b3 114
525bd324 115#include "exec/cpu-all.h"
525bd324 116
525bd324 117static inline void cpu_get_tb_cpu_state(CPUMoxieState *env, target_ulong *pc,
89fee74a 118 target_ulong *cs_base, uint32_t *flags)
525bd324
AG
119{
120 *pc = env->pc;
121 *cs_base = 0;
122 *flags = 0;
123}
124
ccfd61fc
RH
125bool moxie_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
126 MMUAccessType access_type, int mmu_idx,
127 bool probe, uintptr_t retaddr);
525bd324 128
07f5a258 129#endif /* MOXIE_CPU_H */
This page took 0.362357 seconds and 4 git commands to generate.