bellard | 5898e81 | 2003-06-15 19:42:24 +0000 | [diff] [blame] | 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 | #include "config.h" |
| 24 | #include <setjmp.h> |
| 25 | |
| 26 | #define EXCP_UDEF 1 /* undefined instruction */ |
| 27 | #define EXCP_SWI 2 /* software interrupt */ |
| 28 | #define EXCP_INTERRUPT 256 /* async interruption */ |
| 29 | |
| 30 | typedef struct CPUARMState { |
| 31 | uint32_t regs[16]; |
| 32 | uint32_t cpsr; |
| 33 | |
| 34 | /* cpsr flag cache for faster execution */ |
| 35 | uint32_t CF; /* 0 or 1 */ |
| 36 | uint32_t VF; /* V is the bit 31. All other bits are undefined */ |
| 37 | uint32_t NZF; /* N is bit 31. Z is computed from NZF */ |
| 38 | |
| 39 | /* exception/interrupt handling */ |
| 40 | jmp_buf jmp_env; |
| 41 | int exception_index; |
| 42 | int interrupt_request; |
bellard | e2f2289 | 2003-06-25 16:09:48 +0000 | [diff] [blame] | 43 | struct TranslationBlock *current_tb; |
| 44 | int user_mode_only; |
bellard | 5898e81 | 2003-06-15 19:42:24 +0000 | [diff] [blame] | 45 | |
| 46 | /* user data */ |
| 47 | void *opaque; |
| 48 | } CPUARMState; |
| 49 | |
| 50 | CPUARMState *cpu_arm_init(void); |
| 51 | int cpu_arm_exec(CPUARMState *s); |
bellard | 5898e81 | 2003-06-15 19:42:24 +0000 | [diff] [blame] | 52 | void cpu_arm_close(CPUARMState *s); |
| 53 | /* you can call this signal handler from your SIGBUS and SIGSEGV |
| 54 | signal handlers to inform the virtual CPU of exceptions. non zero |
| 55 | is returned if the signal was handled by the virtual CPU. */ |
| 56 | struct siginfo; |
| 57 | int cpu_arm_signal_handler(int host_signum, struct siginfo *info, |
| 58 | void *puc); |
| 59 | |
| 60 | void cpu_arm_dump_state(CPUARMState *env, FILE *f, int flags); |
| 61 | |
| 62 | #define TARGET_PAGE_BITS 12 |
| 63 | #include "cpu-all.h" |
| 64 | |
| 65 | #endif |