Statistics
| Branch: | Revision:

root / target-arm / cpu.h @ a316d335

History | View | Annotate | Download (2.9 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 TARGET_HAS_ICE 1
30

    
31
#define EXCP_UDEF            1   /* undefined instruction */
32
#define EXCP_SWI             2   /* software interrupt */
33
#define EXCP_PREFETCH_ABORT  3
34
#define EXCP_DATA_ABORT      4
35

    
36
/* We currently assume float and double are IEEE single and double
37
   precision respectively.
38
   Doing runtime conversions is tricky because VFP registers may contain
39
   integer values (eg. as the result of a FTOSI instruction).
40
   s<2n> maps to the least significant half of d<n>
41
   s<2n+1> maps to the most significant half of d<n>
42
 */
43

    
44
typedef struct CPUARMState {
45
    uint32_t regs[16];
46
    uint32_t cpsr;
47
    
48
    /* cpsr flag cache for faster execution */
49
    uint32_t CF; /* 0 or 1 */
50
    uint32_t VF; /* V is the bit 31. All other bits are undefined */
51
    uint32_t NZF; /* N is bit 31. Z is computed from NZF */
52
    uint32_t QF; /* 0 or 1 */
53

    
54
    int thumb; /* 0 = arm mode, 1 = thumb mode */
55

    
56
    /* coprocessor 15 (MMU) status */
57
    uint32_t cp15_6;
58
    
59
    /* exception/interrupt handling */
60
    jmp_buf jmp_env;
61
    int exception_index;
62
    int interrupt_request;
63
    int user_mode_only;
64
    uint32_t address;
65

    
66
    /* VFP coprocessor state.  */
67
    struct {
68
        float64 regs[16];
69

    
70
        /* We store these fpcsr fields separately for convenience.  */
71
        int vec_len;
72
        int vec_stride;
73

    
74
        uint32_t fpscr;
75

    
76
        /* Temporary variables if we don't have spare fp regs.  */
77
        float32 tmp0s, tmp1s;
78
        float64 tmp0d, tmp1d;
79
        
80
        float_status fp_status;
81
    } vfp;
82

    
83
    CPU_COMMON
84

    
85
} CPUARMState;
86

    
87
CPUARMState *cpu_arm_init(void);
88
int cpu_arm_exec(CPUARMState *s);
89
void cpu_arm_close(CPUARMState *s);
90
/* you can call this signal handler from your SIGBUS and SIGSEGV
91
   signal handlers to inform the virtual CPU of exceptions. non zero
92
   is returned if the signal was handled by the virtual CPU.  */
93
struct siginfo;
94
int cpu_arm_signal_handler(int host_signum, struct siginfo *info, 
95
                           void *puc);
96

    
97
#define TARGET_PAGE_BITS 12
98
#include "cpu-all.h"
99

    
100
#endif