root / target-arm / cpu.h @ b7a100da
History | View | Annotate | Download (3.4 kB)
1 |
/*
|
---|---|
2 |
* ARM virtual CPU header
|
3 |
*
|
4 |
* Copyright (c) 2003 Fabrice Bellard
|
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
|
9 |
* version 2 of the License, or (at your option) any later version.
|
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 |
*
|
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19 |
*/
|
20 |
#ifndef CPU_ARM_H
|
21 |
#define CPU_ARM_H
|
22 |
|
23 |
#define TARGET_LONG_BITS 32 |
24 |
|
25 |
#include "cpu-defs.h" |
26 |
|
27 |
#include "softfloat.h" |
28 |
|
29 |
#define EXCP_UDEF 1 /* undefined instruction */ |
30 |
#define EXCP_SWI 2 /* software interrupt */ |
31 |
#define EXCP_PREFETCH_ABORT 3 |
32 |
#define EXCP_DATA_ABORT 4 |
33 |
|
34 |
/* We currently assume float and double are IEEE single and double
|
35 |
precision respectively.
|
36 |
Doing runtime conversions is tricky because VFP registers may contain
|
37 |
integer values (eg. as the result of a FTOSI instruction).
|
38 |
A double precision register load/store must also load/store the
|
39 |
corresponding single precision pair, although it is undefined how
|
40 |
these overlap. */
|
41 |
|
42 |
typedef struct CPUARMState { |
43 |
uint32_t regs[16];
|
44 |
uint32_t cpsr; |
45 |
|
46 |
/* cpsr flag cache for faster execution */
|
47 |
uint32_t CF; /* 0 or 1 */
|
48 |
uint32_t VF; /* V is the bit 31. All other bits are undefined */
|
49 |
uint32_t NZF; /* N is bit 31. Z is computed from NZF */
|
50 |
uint32_t QF; /* 0 or 1 */
|
51 |
|
52 |
int thumb; /* 0 = arm mode, 1 = thumb mode */ |
53 |
|
54 |
/* coprocessor 15 (MMU) status */
|
55 |
uint32_t cp15_6; |
56 |
|
57 |
/* exception/interrupt handling */
|
58 |
jmp_buf jmp_env; |
59 |
int exception_index;
|
60 |
int interrupt_request;
|
61 |
struct TranslationBlock *current_tb;
|
62 |
int user_mode_only;
|
63 |
uint32_t address; |
64 |
|
65 |
/* in order to avoid passing too many arguments to the memory
|
66 |
write helpers, we store some rarely used information in the CPU
|
67 |
context) */
|
68 |
unsigned long mem_write_pc; /* host pc at which the memory was |
69 |
written */
|
70 |
unsigned long mem_write_vaddr; /* target virtual addr at which the |
71 |
memory was written */
|
72 |
/* VFP coprocessor state. */
|
73 |
struct {
|
74 |
union {
|
75 |
float32 s[32];
|
76 |
float64 d[16];
|
77 |
} regs; |
78 |
|
79 |
/* We store these fpcsr fields separately for convenience. */
|
80 |
int vec_len;
|
81 |
int vec_stride;
|
82 |
|
83 |
uint32_t fpscr; |
84 |
|
85 |
/* Temporary variables if we don't have spare fp regs. */
|
86 |
float32 tmp0s, tmp1s; |
87 |
float64 tmp0d, tmp1d; |
88 |
|
89 |
float_status fp_status; |
90 |
} vfp; |
91 |
|
92 |
/* user data */
|
93 |
void *opaque;
|
94 |
} CPUARMState; |
95 |
|
96 |
CPUARMState *cpu_arm_init(void);
|
97 |
int cpu_arm_exec(CPUARMState *s);
|
98 |
void cpu_arm_close(CPUARMState *s);
|
99 |
/* you can call this signal handler from your SIGBUS and SIGSEGV
|
100 |
signal handlers to inform the virtual CPU of exceptions. non zero
|
101 |
is returned if the signal was handled by the virtual CPU. */
|
102 |
struct siginfo;
|
103 |
int cpu_arm_signal_handler(int host_signum, struct siginfo *info, |
104 |
void *puc);
|
105 |
|
106 |
#define TARGET_PAGE_BITS 12 |
107 |
#include "cpu-all.h" |
108 |
|
109 |
#endif
|