Statistics
| Branch: | Revision:

root / target-xtensa / cpu-qom.h @ ef5b2344

History | View | Annotate | Download (2.6 kB)

1 a4633e16 Andreas Färber
/*
2 a4633e16 Andreas Färber
 * QEMU Xtensa CPU
3 a4633e16 Andreas Färber
 *
4 a4633e16 Andreas Färber
 * Copyright (c) 2012 SUSE LINUX Products GmbH
5 a4633e16 Andreas Färber
 * All rights reserved.
6 a4633e16 Andreas Färber
 *
7 a4633e16 Andreas Färber
 * Redistribution and use in source and binary forms, with or without
8 a4633e16 Andreas Färber
 * modification, are permitted provided that the following conditions are met:
9 a4633e16 Andreas Färber
 *     * Redistributions of source code must retain the above copyright
10 a4633e16 Andreas Färber
 *       notice, this list of conditions and the following disclaimer.
11 a4633e16 Andreas Färber
 *     * Redistributions in binary form must reproduce the above copyright
12 a4633e16 Andreas Färber
 *       notice, this list of conditions and the following disclaimer in the
13 a4633e16 Andreas Färber
 *       documentation and/or other materials provided with the distribution.
14 a4633e16 Andreas Färber
 *     * Neither the name of the Open Source and Linux Lab nor the
15 a4633e16 Andreas Färber
 *       names of its contributors may be used to endorse or promote products
16 a4633e16 Andreas Färber
 *       derived from this software without specific prior written permission.
17 a4633e16 Andreas Färber
 *
18 a4633e16 Andreas Färber
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 a4633e16 Andreas Färber
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 a4633e16 Andreas Färber
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 a4633e16 Andreas Färber
 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
22 a4633e16 Andreas Färber
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 a4633e16 Andreas Färber
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 a4633e16 Andreas Färber
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 a4633e16 Andreas Färber
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 a4633e16 Andreas Färber
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 a4633e16 Andreas Färber
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 a4633e16 Andreas Färber
 */
29 a4633e16 Andreas Färber
#ifndef QEMU_XTENSA_CPU_QOM_H
30 a4633e16 Andreas Färber
#define QEMU_XTENSA_CPU_QOM_H
31 a4633e16 Andreas Färber
32 a4633e16 Andreas Färber
#include "qemu/cpu.h"
33 a4633e16 Andreas Färber
#include "cpu.h"
34 a4633e16 Andreas Färber
35 a4633e16 Andreas Färber
#define TYPE_XTENSA_CPU "xtensa-cpu"
36 a4633e16 Andreas Färber
37 a4633e16 Andreas Färber
#define XTENSA_CPU_CLASS(class) \
38 a4633e16 Andreas Färber
    OBJECT_CLASS_CHECK(XtensaCPUClass, (class), TYPE_XTENSA_CPU)
39 a4633e16 Andreas Färber
#define XTENSA_CPU(obj) \
40 a4633e16 Andreas Färber
    OBJECT_CHECK(XtensaCPU, (obj), TYPE_XTENSA_CPU)
41 a4633e16 Andreas Färber
#define XTENSA_CPU_GET_CLASS(obj) \
42 a4633e16 Andreas Färber
    OBJECT_GET_CLASS(XtensaCPUClass, (obj), TYPE_XTENSA_CPU)
43 a4633e16 Andreas Färber
44 a4633e16 Andreas Färber
/**
45 a4633e16 Andreas Färber
 * XtensaCPUClass:
46 a4633e16 Andreas Färber
 * @parent_reset: The parent class' reset handler.
47 a4633e16 Andreas Färber
 *
48 a4633e16 Andreas Färber
 * An Xtensa CPU model.
49 a4633e16 Andreas Färber
 */
50 a4633e16 Andreas Färber
typedef struct XtensaCPUClass {
51 a4633e16 Andreas Färber
    /*< private >*/
52 a4633e16 Andreas Färber
    CPUClass parent_class;
53 a4633e16 Andreas Färber
    /*< public >*/
54 a4633e16 Andreas Färber
55 a4633e16 Andreas Färber
    void (*parent_reset)(CPUState *cpu);
56 a4633e16 Andreas Färber
} XtensaCPUClass;
57 a4633e16 Andreas Färber
58 a4633e16 Andreas Färber
/**
59 a4633e16 Andreas Färber
 * XtensaCPU:
60 a4633e16 Andreas Färber
 * @env: #CPUXtensaState
61 a4633e16 Andreas Färber
 *
62 a4633e16 Andreas Färber
 * An Xtensa CPU.
63 a4633e16 Andreas Färber
 */
64 a4633e16 Andreas Färber
typedef struct XtensaCPU {
65 a4633e16 Andreas Färber
    /*< private >*/
66 a4633e16 Andreas Färber
    CPUState parent_obj;
67 a4633e16 Andreas Färber
    /*< public >*/
68 a4633e16 Andreas Färber
69 a4633e16 Andreas Färber
    CPUXtensaState env;
70 a4633e16 Andreas Färber
} XtensaCPU;
71 a4633e16 Andreas Färber
72 a4633e16 Andreas Färber
static inline XtensaCPU *xtensa_env_get_cpu(const CPUXtensaState *env)
73 a4633e16 Andreas Färber
{
74 a4633e16 Andreas Färber
    return XTENSA_CPU(container_of(env, XtensaCPU, env));
75 a4633e16 Andreas Färber
}
76 a4633e16 Andreas Färber
77 a4633e16 Andreas Färber
#define ENV_GET_CPU(e) CPU(xtensa_env_get_cpu(e))
78 a4633e16 Andreas Färber
79 a4633e16 Andreas Färber
80 a4633e16 Andreas Färber
#endif