Skip to content

Commit

Permalink
ARM VFP support (Paul Brook)
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1309 c046a42c-6fe2-441c-8c8c-71466251a162
  • Loading branch information
bellard committed Feb 22, 2005
1 parent 55754d9 commit b7bcbe9
Show file tree
Hide file tree
Showing 8 changed files with 1,104 additions and 14 deletions.
1 change: 1 addition & 0 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ version 0.6.2:
- PC parallel port support (Mark Jonckheere)
- initial SPARC64 support (Blue Swirl)
- armv5te user mode support (Paul Brook)
- ARM VFP support (Paul Brook)

version 0.6.1:

Expand Down
4 changes: 4 additions & 0 deletions Makefile.target
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ ifeq ($(TARGET_BASE_ARCH), sparc)
LIBOBJS+= op_helper.o helper.o
endif

ifeq ($(TARGET_BASE_ARCH), arm)
LIBOBJS+= op_helper.o
endif

# NOTE: the disassembler code is only needed for debugging
LIBOBJS+=disas.o
ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
Expand Down
4 changes: 3 additions & 1 deletion cpu-exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,8 @@ int cpu_exec(CPUState *env1)
cs_base = env->segs[R_CS].base;
pc = cs_base + env->eip;
#elif defined(TARGET_ARM)
flags = env->thumb;
flags = env->thumb | (env->vfp.vec_len << 1)
| (env->vfp.vec_stride << 4);
cs_base = 0;
pc = env->regs[15];
#elif defined(TARGET_SPARC)
Expand Down Expand Up @@ -619,6 +620,7 @@ int cpu_exec(CPUState *env1)
#endif
#elif defined(TARGET_ARM)
env->cpsr = compute_cpsr();
/* XXX: Save/restore host fpu exception state?. */
#elif defined(TARGET_SPARC)
#elif defined(TARGET_PPC)
#else
Expand Down
28 changes: 28 additions & 0 deletions target-arm/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
#define EXCP_PREFETCH_ABORT 3
#define EXCP_DATA_ABORT 4

/* We currently assume float and double are IEEE single and double
precision respectively.
Doing runtime conversions is tricky because VFP registers may contain
integer values (eg. as the result of a FTOSI instruction).
A double precision register load/store must also load/store the
corresponding single precision pair, although it is undefined how
these overlap. */

typedef struct CPUARMState {
uint32_t regs[16];
uint32_t cpsr;
Expand All @@ -50,6 +58,7 @@ typedef struct CPUARMState {
int interrupt_request;
struct TranslationBlock *current_tb;
int user_mode_only;
uint32_t address;

/* in order to avoid passing too many arguments to the memory
write helpers, we store some rarely used information in the CPU
Expand All @@ -58,6 +67,25 @@ typedef struct CPUARMState {
written */
unsigned long mem_write_vaddr; /* target virtual addr at which the
memory was written */
/* VFP coprocessor state. */
struct {
union {
float s[32];
double d[16];
} regs;

/* We store these fpcsr fields separately for convenience. */
int vec_len;
int vec_stride;

uint32_t fpscr;

/* Temporary variables if we don't have spare fp regs. */
float tmp0s, tmp1s;
double tmp0d, tmp1d;

} vfp;

/* user data */
void *opaque;
} CPUARMState;
Expand Down
32 changes: 28 additions & 4 deletions target-arm/exec.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@ register uint32_t T0 asm(AREG1);
register uint32_t T1 asm(AREG2);
register uint32_t T2 asm(AREG3);

/* TODO: Put these in FP regs on targets that have such things. */
/* It is ok for FT0s and FT0d to overlap. Likewise FT1s and FT1d. */
#define FT0s env->vfp.tmp0s
#define FT1s env->vfp.tmp1s
#define FT0d env->vfp.tmp0d
#define FT1d env->vfp.tmp1d

#include "cpu.h"
#include "exec-all.h"

void cpu_lock(void);
void cpu_unlock(void);
void cpu_loop_exit(void);

/* Implemented CPSR bits. */
#define CACHED_CPSR_BITS 0xf8000000
static inline int compute_cpsr(void)
Expand All @@ -51,3 +54,24 @@ static inline void regs_to_env(void)

int cpu_arm_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
int is_user, int is_softmmu);

/* In op_helper.c */

void cpu_lock(void);
void cpu_unlock(void);
void cpu_loop_exit(void);

void raise_exception(int);

void do_vfp_abss(void);
void do_vfp_absd(void);
void do_vfp_negs(void);
void do_vfp_negd(void);
void do_vfp_sqrts(void);
void do_vfp_sqrtd(void);
void do_vfp_cmps(void);
void do_vfp_cmpd(void);
void do_vfp_cmpes(void);
void do_vfp_cmped(void);
void do_vfp_set_fpscr(void);
void do_vfp_get_fpscr(void);
Loading

0 comments on commit b7bcbe9

Please sign in to comment.