root / target-arm / cpu.h @ 7a962d30
History | View | Annotate | Download (3.5 kB)
1 | 2c0262af | bellard | /*
|
---|---|---|---|
2 | 2c0262af | bellard | * ARM virtual CPU header
|
3 | 2c0262af | bellard | *
|
4 | 2c0262af | bellard | * Copyright (c) 2003 Fabrice Bellard
|
5 | 2c0262af | bellard | *
|
6 | 2c0262af | bellard | * This library is free software; you can redistribute it and/or
|
7 | 2c0262af | bellard | * modify it under the terms of the GNU Lesser General Public
|
8 | 2c0262af | bellard | * License as published by the Free Software Foundation; either
|
9 | 2c0262af | bellard | * version 2 of the License, or (at your option) any later version.
|
10 | 2c0262af | bellard | *
|
11 | 2c0262af | bellard | * This library is distributed in the hope that it will be useful,
|
12 | 2c0262af | bellard | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | 2c0262af | bellard | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 | 2c0262af | bellard | * Lesser General Public License for more details.
|
15 | 2c0262af | bellard | *
|
16 | 2c0262af | bellard | * You should have received a copy of the GNU Lesser General Public
|
17 | 2c0262af | bellard | * License along with this library; if not, write to the Free Software
|
18 | 2c0262af | bellard | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19 | 2c0262af | bellard | */
|
20 | 2c0262af | bellard | #ifndef CPU_ARM_H
|
21 | 2c0262af | bellard | #define CPU_ARM_H
|
22 | 2c0262af | bellard | |
23 | 3cf1e035 | bellard | #define TARGET_LONG_BITS 32 |
24 | 3cf1e035 | bellard | |
25 | 2c0262af | bellard | #include "cpu-defs.h" |
26 | 2c0262af | bellard | |
27 | 53cd6637 | bellard | #include "softfloat.h" |
28 | 53cd6637 | bellard | |
29 | 1fddef4b | bellard | #define TARGET_HAS_ICE 1 |
30 | 1fddef4b | bellard | |
31 | b8a9e8f1 | bellard | #define EXCP_UDEF 1 /* undefined instruction */ |
32 | b8a9e8f1 | bellard | #define EXCP_SWI 2 /* software interrupt */ |
33 | b8a9e8f1 | bellard | #define EXCP_PREFETCH_ABORT 3 |
34 | b8a9e8f1 | bellard | #define EXCP_DATA_ABORT 4 |
35 | 2c0262af | bellard | |
36 | b7bcbe95 | bellard | /* We currently assume float and double are IEEE single and double
|
37 | b7bcbe95 | bellard | precision respectively.
|
38 | b7bcbe95 | bellard | Doing runtime conversions is tricky because VFP registers may contain
|
39 | b7bcbe95 | bellard | integer values (eg. as the result of a FTOSI instruction).
|
40 | 8e96005d | bellard | s<2n> maps to the least significant half of d<n>
|
41 | 8e96005d | bellard | s<2n+1> maps to the most significant half of d<n>
|
42 | 8e96005d | bellard | */
|
43 | b7bcbe95 | bellard | |
44 | 2c0262af | bellard | typedef struct CPUARMState { |
45 | 2c0262af | bellard | uint32_t regs[16];
|
46 | 2c0262af | bellard | uint32_t cpsr; |
47 | 2c0262af | bellard | |
48 | 2c0262af | bellard | /* cpsr flag cache for faster execution */
|
49 | 2c0262af | bellard | uint32_t CF; /* 0 or 1 */
|
50 | 2c0262af | bellard | uint32_t VF; /* V is the bit 31. All other bits are undefined */
|
51 | 2c0262af | bellard | uint32_t NZF; /* N is bit 31. Z is computed from NZF */
|
52 | 99c475ab | bellard | uint32_t QF; /* 0 or 1 */
|
53 | 99c475ab | bellard | |
54 | 99c475ab | bellard | int thumb; /* 0 = arm mode, 1 = thumb mode */ |
55 | 2c0262af | bellard | |
56 | b8a9e8f1 | bellard | /* coprocessor 15 (MMU) status */
|
57 | b8a9e8f1 | bellard | uint32_t cp15_6; |
58 | b8a9e8f1 | bellard | |
59 | 2c0262af | bellard | /* exception/interrupt handling */
|
60 | 2c0262af | bellard | jmp_buf jmp_env; |
61 | 2c0262af | bellard | int exception_index;
|
62 | 2c0262af | bellard | int interrupt_request;
|
63 | 2c0262af | bellard | struct TranslationBlock *current_tb;
|
64 | 2c0262af | bellard | int user_mode_only;
|
65 | b7bcbe95 | bellard | uint32_t address; |
66 | 2c0262af | bellard | |
67 | 1fddef4b | bellard | /* ICE debug support. */
|
68 | 1fddef4b | bellard | target_ulong breakpoints[MAX_BREAKPOINTS]; |
69 | 1fddef4b | bellard | int nb_breakpoints;
|
70 | 1fddef4b | bellard | int singlestep_enabled;
|
71 | 1fddef4b | bellard | |
72 | d720b93d | bellard | /* in order to avoid passing too many arguments to the memory
|
73 | d720b93d | bellard | write helpers, we store some rarely used information in the CPU
|
74 | d720b93d | bellard | context) */
|
75 | d720b93d | bellard | unsigned long mem_write_pc; /* host pc at which the memory was |
76 | d720b93d | bellard | written */
|
77 | d720b93d | bellard | unsigned long mem_write_vaddr; /* target virtual addr at which the |
78 | d720b93d | bellard | memory was written */
|
79 | b7bcbe95 | bellard | /* VFP coprocessor state. */
|
80 | b7bcbe95 | bellard | struct {
|
81 | 8e96005d | bellard | float64 regs[16];
|
82 | b7bcbe95 | bellard | |
83 | b7bcbe95 | bellard | /* We store these fpcsr fields separately for convenience. */
|
84 | b7bcbe95 | bellard | int vec_len;
|
85 | b7bcbe95 | bellard | int vec_stride;
|
86 | b7bcbe95 | bellard | |
87 | b7bcbe95 | bellard | uint32_t fpscr; |
88 | b7bcbe95 | bellard | |
89 | b7bcbe95 | bellard | /* Temporary variables if we don't have spare fp regs. */
|
90 | 53cd6637 | bellard | float32 tmp0s, tmp1s; |
91 | 53cd6637 | bellard | float64 tmp0d, tmp1d; |
92 | 53cd6637 | bellard | |
93 | 53cd6637 | bellard | float_status fp_status; |
94 | b7bcbe95 | bellard | } vfp; |
95 | b7bcbe95 | bellard | |
96 | 2c0262af | bellard | /* user data */
|
97 | 2c0262af | bellard | void *opaque;
|
98 | 2c0262af | bellard | } CPUARMState; |
99 | 2c0262af | bellard | |
100 | 2c0262af | bellard | CPUARMState *cpu_arm_init(void);
|
101 | 2c0262af | bellard | int cpu_arm_exec(CPUARMState *s);
|
102 | 2c0262af | bellard | void cpu_arm_close(CPUARMState *s);
|
103 | 2c0262af | bellard | /* you can call this signal handler from your SIGBUS and SIGSEGV
|
104 | 2c0262af | bellard | signal handlers to inform the virtual CPU of exceptions. non zero
|
105 | 2c0262af | bellard | is returned if the signal was handled by the virtual CPU. */
|
106 | 2c0262af | bellard | struct siginfo;
|
107 | 2c0262af | bellard | int cpu_arm_signal_handler(int host_signum, struct siginfo *info, |
108 | 2c0262af | bellard | void *puc);
|
109 | 2c0262af | bellard | |
110 | 2c0262af | bellard | #define TARGET_PAGE_BITS 12 |
111 | 2c0262af | bellard | #include "cpu-all.h" |
112 | 2c0262af | bellard | |
113 | 2c0262af | bellard | #endif |