ARM patch queue
This is a pull request for various ARM related patches which have been on the list for a while (mostly but not entirely mine).
The performance counters patch had quite a bit of discussion when originally posted (http://patchwork.ozlabs.org/patch/92423/)
which was basically focused around the question of "can/should helper functions throw exceptions". The patch continues along the lines of all the existing cp15 handling, and nobody responded to my "please ack/nak/commit" message, which is why it's in this pull req.
Thanks
-- PMM
The following changes since commit 48e2faf222cbf4abab7c8e4b3f44229ec98eae7f:
net: Warn about "-net nic" options which were ignored (2011-06-22 07:18:39 -0500)
are available in the git repository at:
git://git.linaro.org/people/pmaydell/qemu-arm.git for-upstream
Peter Maydell (7):
Revert "target-arm: Use global env in iwmmxt_helper.c helpers"
target-arm: Add helper function to generate code to get fpstatus pointer
target-arm: Make VFP binop helpers take pointer to fpstatus, not CPUState
target-arm: Pass fp status pointer explicitly to neon fp helpers Revert "target-arm: Use global env in neon_helper.c helpers" Revert "Makefile.target: Allow target helpers to be in any *_helper.c file"
target-arm: Minimal implementation of performance counters
Sebastian Huber (1):
target-arm: Fix BASEPRI, BASEPRI_MAX, and FAULTMASK access
Makefile.target | 2 +- target-arm/cpu.h | 8 +- target-arm/helper.c | 193 ++++++++++++++++--- target-arm/helper.h | 293 ++++++++++++++-------------- target-arm/iwmmxt_helper.c | 80 +++++---- target-arm/machine.c | 12 ++ target-arm/neon_helper.c | 201 ++++++++++---------- target-arm/translate.c | 457 +++++++++++++++++++++++++++----------------- 8 files changed, 753 insertions(+), 493 deletions(-)
PATCH 1/8 Revert "target-arm: Use global env in iwmmxt_helper.c helpers"
This reverts commit 947a2fa21b61703802a660a938cabd7b3600ee79, returning the iwmmxt helpers to passing env in as a parameter.
--- target-arm/helper.h | 122 +++++++++++++++++++++--------------------- target-arm/iwmmxt_helper.c | 80 ++++++++++++++++------------ target-arm/translate.c | 129 +++++++++++++++++++++++--------------------- 3 files changed, 175 insertions(+), 156 deletions(-)
target-arm/helper.h +61 -61
@@ -375,47 +375,47 @@ DEF_HELPER_2(iwmmxt_macsw, i64, i64, i64) DEF_HELPER_2(iwmmxt_macuw, i64, i64, i64) DEF_HELPER_1(iwmmxt_setpsr_nz, i32, i64) -#define DEF_IWMMXT_HELPER_SIZE (name) \ -DEF_HELPER_2(iwmmxt_##name##b, i64, i64, i64) \ -DEF_HELPER_2(iwmmxt_##name##w, i64, i64, i64) \ -DEF_HELPER_2(iwmmxt_##name##l, i64, i64, i64) \ - -DEF_IWMMXT_HELPER_SIZE(unpackl) -DEF_IWMMXT_HELPER_SIZE(unpackh) - -DEF_HELPER_1(iwmmxt_unpacklub, i64, i64) -DEF_HELPER_1(iwmmxt_unpackluw, i64, i64) -DEF_HELPER_1(iwmmxt_unpacklul, i64, i64) -DEF_HELPER_1(iwmmxt_unpackhub, i64, i64) -DEF_HELPER_1(iwmmxt_unpackhuw, i64, i64) -DEF_HELPER_1(iwmmxt_unpackhul, i64, i64) -DEF_HELPER_1(iwmmxt_unpacklsb, i64, i64) -DEF_HELPER_1(iwmmxt_unpacklsw, i64, i64) -DEF_HELPER_1(iwmmxt_unpacklsl, i64, i64) -DEF_HELPER_1(iwmmxt_unpackhsb, i64, i64) -DEF_HELPER_1(iwmmxt_unpackhsw, i64, i64) -DEF_HELPER_1(iwmmxt_unpackhsl, i64, i64) - -DEF_IWMMXT_HELPER_SIZE(cmpeq) -DEF_IWMMXT_HELPER_SIZE(cmpgtu) -DEF_IWMMXT_HELPER_SIZE(cmpgts) - -DEF_IWMMXT_HELPER_SIZE(mins) -DEF_IWMMXT_HELPER_SIZE(minu) -DEF_IWMMXT_HELPER_SIZE(maxs) -DEF_IWMMXT_HELPER_SIZE(maxu) - -DEF_IWMMXT_HELPER_SIZE(subn) -DEF_IWMMXT_HELPER_SIZE(addn) -DEF_IWMMXT_HELPER_SIZE(subu) -DEF_IWMMXT_HELPER_SIZE(addu) -DEF_IWMMXT_HELPER_SIZE(subs) -DEF_IWMMXT_HELPER_SIZE(adds) - -DEF_HELPER_2(iwmmxt_avgb0, i64, i64, i64) -DEF_HELPER_2(iwmmxt_avgb1, i64, i64, i64) -DEF_HELPER_2(iwmmxt_avgw0, i64, i64, i64) -DEF_HELPER_2(iwmmxt_avgw1, i64, i64, i64) +#define DEF_IWMMXT_HELPER_SIZE_ENV (name) \ +DEF_HELPER_3(iwmmxt_##name##b, i64, env, i64, i64) \ +DEF_HELPER_3(iwmmxt_##name##w, i64, env, i64, i64) \ +DEF_HELPER_3(iwmmxt_##name##l, i64, env, i64, i64) \ + +DEF_IWMMXT_HELPER_SIZE_ENV(unpackl) +DEF_IWMMXT_HELPER_SIZE_ENV(unpackh) + +DEF_HELPER_2(iwmmxt_unpacklub, i64, env, i64) +DEF_HELPER_2(iwmmxt_unpackluw, i64, env, i64) +DEF_HELPER_2(iwmmxt_unpacklul, i64, env, i64) +DEF_HELPER_2(iwmmxt_unpackhub, i64, env, i64) +DEF_HELPER_2(iwmmxt_unpackhuw, i64, env, i64) +DEF_HELPER_2(iwmmxt_unpackhul, i64, env, i64) +DEF_HELPER_2(iwmmxt_unpacklsb, i64, env, i64) +DEF_HELPER_2(iwmmxt_unpacklsw, i64, env, i64) +DEF_HELPER_2(iwmmxt_unpacklsl, i64, env, i64) +DEF_HELPER_2(iwmmxt_unpackhsb, i64, env, i64) +DEF_HELPER_2(iwmmxt_unpackhsw, i64, env, i64) +DEF_HELPER_2(iwmmxt_unpackhsl, i64, env, i64) + +DEF_IWMMXT_HELPER_SIZE_ENV(cmpeq) +DEF_IWMMXT_HELPER_SIZE_ENV(cmpgtu) +DEF_IWMMXT_HELPER_SIZE_ENV(cmpgts) + +DEF_IWMMXT_HELPER_SIZE_ENV(mins) +DEF_IWMMXT_HELPER_SIZE_ENV(minu) +DEF_IWMMXT_HELPER_SIZE_ENV(maxs) +DEF_IWMMXT_HELPER_SIZE_ENV(maxu) + +DEF_IWMMXT_HELPER_SIZE_ENV(subn) +DEF_IWMMXT_HELPER_SIZE_ENV(addn) +DEF_IWMMXT_HELPER_SIZE_ENV(subu) +DEF_IWMMXT_HELPER_SIZE_ENV(addu) +DEF_IWMMXT_HELPER_SIZE_ENV(subs) +DEF_IWMMXT_HELPER_SIZE_ENV(adds) + +DEF_HELPER_3(iwmmxt_avgb0, i64, env, i64, i64) +DEF_HELPER_3(iwmmxt_avgb1, i64, env, i64, i64) +DEF_HELPER_3(iwmmxt_avgw0, i64, env, i64, i64) +DEF_HELPER_3(iwmmxt_avgw1, i64, env, i64, i64) DEF_HELPER_2(iwmmxt_msadb, i64, i64, i64)
@@ -434,26 +434,26 @@ DEF_HELPER_1(iwmmxt_msbb, i32, i64) DEF_HELPER_1(iwmmxt_msbw, i32, i64) DEF_HELPER_1(iwmmxt_msbl, i32, i64) -DEF_HELPER_2(iwmmxt_srlw, i64, i64, i32) -DEF_HELPER_2(iwmmxt_srll, i64, i64, i32) -DEF_HELPER_2(iwmmxt_srlq, i64, i64, i32) -DEF_HELPER_2(iwmmxt_sllw, i64, i64, i32) -DEF_HELPER_2(iwmmxt_slll, i64, i64, i32) -DEF_HELPER_2(iwmmxt_sllq, i64, i64, i32) -DEF_HELPER_2(iwmmxt_sraw, i64, i64, i32) -DEF_HELPER_2(iwmmxt_sral, i64, i64, i32) -DEF_HELPER_2(iwmmxt_sraq, i64, i64, i32) -DEF_HELPER_2(iwmmxt_rorw, i64, i64, i32) -DEF_HELPER_2(iwmmxt_rorl, i64, i64, i32) -DEF_HELPER_2(iwmmxt_rorq, i64, i64, i32) -DEF_HELPER_2(iwmmxt_shufh, i64, i64, i32) - -DEF_HELPER_2(iwmmxt_packuw, i64, i64, i64) -DEF_HELPER_2(iwmmxt_packul, i64, i64, i64) -DEF_HELPER_2(iwmmxt_packuq, i64, i64, i64) -DEF_HELPER_2(iwmmxt_packsw, i64, i64, i64) -DEF_HELPER_2(iwmmxt_packsl, i64, i64, i64) -DEF_HELPER_2(iwmmxt_packsq, i64, i64, i64) +DEF_HELPER_3(iwmmxt_srlw, i64, env, i64, i32) +DEF_HELPER_3(iwmmxt_srll, i64, env, i64, i32) +DEF_HELPER_3(iwmmxt_srlq, i64, env, i64, i32) +DEF_HELPER_3(iwmmxt_sllw, i64, env, i64, i32) +DEF_HELPER_3(iwmmxt_slll, i64, env, i64, i32) +DEF_HELPER_3(iwmmxt_sllq, i64, env, i64, i32) +DEF_HELPER_3(iwmmxt_sraw, i64, env, i64, i32) +DEF_HELPER_3(iwmmxt_sral, i64, env, i64, i32) +DEF_HELPER_3(iwmmxt_sraq, i64, env, i64, i32) +DEF_HELPER_3(iwmmxt_rorw, i64, env, i64, i32) +DEF_HELPER_3(iwmmxt_rorl, i64, env, i64, i32) +DEF_HELPER_3(iwmmxt_rorq, i64, env, i64, i32) +DEF_HELPER_3(iwmmxt_shufh, i64, env, i64, i32) + +DEF_HELPER_3(iwmmxt_packuw, i64, env, i64, i64) +DEF_HELPER_3(iwmmxt_packul, i64, env, i64, i64) +DEF_HELPER_3(iwmmxt_packuq, i64, env, i64, i64) +DEF_HELPER_3(iwmmxt_packsw, i64, env, i64, i64) +DEF_HELPER_3(iwmmxt_packsl, i64, env, i64, i64) +DEF_HELPER_3(iwmmxt_packsq, i64, env, i64, i64) DEF_HELPER_3(iwmmxt_muladdsl, i64, i64, i32, i32)DEF_HELPER_3 (iwmmxt_muladdsw, i64, i64, i32, i32)
target-arm/iwmmxt_helper.c +46 -34
283 lines not on this page · raw message
target-arm/translate.c +68 -61
201 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 2/8 target-arm: Add helper function to generate code to get fpstatus pointer
In reply to Peter MaydellAdd and use a helper function which returns a TCGv which is a pointer to the fp_status for either Neon or VFP operations.
--- target-arm/translate.c | 40 ++++++++++++++++------------------------ 1 files changed, 16 insertions(+), 24 deletions(-)
target-arm/translate.c +16 -24
@@ -893,6 +893,19 @@ static inline void gen_add_datah_offset(DisasContext *s, unsigned int insn, } } +static TCGv_ptr get_fpstatus_ptr (int neon) +{ +TCGv_ptr statusptr =tcg_temp_new_ptr (); +int offset; +if (neon) { + offset = offsetof(CPUState, vfp.standard_fp_status); + }else { + offset = offsetof(CPUState, vfp.fp_status); + } +tcg_gen_addi_ptr (statusptr, cpu_env, offset); +return statusptr; +} +#define VFP_OP2 (name) \ static inline void gen_vfp_##name(int dp) \ { \
@@ -980,14 +993,7 @@ static inline void gen_vfp_F1_ld0(int dp)#define VFP_GEN_ITOF (name) \ static inline void gen_vfp_##name(int dp, int neon) \ { \ - TCGv_ptr statusptr = tcg_temp_new_ptr(); \ - int offset; \ - if (neon) { \ - offset = offsetof(CPUState, vfp.standard_fp_status); \ - } else { \ - offset = offsetof(CPUState, vfp.fp_status); \ - } \ - tcg_gen_addi_ptr(statusptr, cpu_env, offset); \ + TCGv_ptr statusptr = get_fpstatus_ptr(neon); \ if (dp) { \ gen_helper_vfp_##name##d(cpu_F0d, cpu_F0s, statusptr); \ } else { \
@@ -1003,14 +1009,7 @@ VFP_GEN_ITOF(sito)#define VFP_GEN_FTOI (name) \ static inline void gen_vfp_##name(int dp, int neon) \ { \ - TCGv_ptr statusptr = tcg_temp_new_ptr(); \ - int offset; \ - if (neon) { \ - offset = offsetof(CPUState, vfp.standard_fp_status); \ - } else { \ - offset = offsetof(CPUState, vfp.fp_status); \ - } \ - tcg_gen_addi_ptr(statusptr, cpu_env, offset); \ + TCGv_ptr statusptr = get_fpstatus_ptr(neon); \ if (dp) { \ gen_helper_vfp_##name##d(cpu_F0s, cpu_F0d, statusptr); \ } else { \
@@ -1029,14 +1028,7 @@ VFP_GEN_FTOI(tosiz) static inline void gen_vfp_##name(int dp, int shift, int neon) \ { \ TCGv tmp_shift = tcg_const_i32(shift); \ - TCGv_ptr statusptr = tcg_temp_new_ptr(); \ - int offset; \ - if (neon) { \ - offset = offsetof(CPUState, vfp.standard_fp_status); \ - } else { \ - offset = offsetof(CPUState, vfp.fp_status); \ - } \ - tcg_gen_addi_ptr(statusptr, cpu_env, offset); \ + TCGv_ptr statusptr = get_fpstatus_ptr(neon); \ if (dp) { \ gen_helper_vfp_##name##d(cpu_F0d, cpu_F0d, tmp_shift, statusptr); \ } else { \
Signature · 1 line
1.7.1
PATCH 3/8 target-arm: Make VFP binop helpers take pointer to fpstatus, not CPUState
In reply to Peter MaydellMake the VFP binop helper functions take a pointer to the fp status, not the entire CPUState. This will allow us to use them for Neon operations too.
--- target-arm/helper.c | 10 ++++++---- target-arm/helper.h | 16 ++++++++-------- target-arm/translate.c | 17 +++++++++++------ 3 files changed, 25 insertions(+), 18 deletions(-)
target-arm/helper.c +6 -4
@@ -2453,13 +2453,15 @@ void vfp_set_fpscr(CPUState *env, uint32_t val)#define VFP_HELPER (name, p) HELPER(glue(glue(vfp_,name),p))#define VFP_BINOP (name) \ -float32 VFP_HELPER(name, s)(float32 a, float32 b, CPUState *env) \ +float32 VFP_HELPER(name, s)(float32 a, float32 b, void *fpstp) \ { \ - return float32_ ## name (a, b, &env->vfp.fp_status); \ + float_status *fpst = fpstp; \ + return float32_ ## name(a, b, fpst); \ } \ -float64 VFP_HELPER(name, d)(float64 a, float64 b, CPUState *env) \ +float64 VFP_HELPER(name, d)(float64 a, float64 b, void *fpstp) \ { \ - return float64_ ## name (a, b, &env->vfp.fp_status); \ + float_status *fpst = fpstp; \ + return float64_ ## name(a, b, fpst); \ }VFP_BINOP (add)VFP_BINOP (sub)
target-arm/helper.h +8 -8
@@ -74,14 +74,14 @@ DEF_HELPER_2(set_user_reg, void, i32, i32) DEF_HELPER_1(vfp_get_fpscr, i32, env) DEF_HELPER_2(vfp_set_fpscr, void, env, i32) -DEF_HELPER_3(vfp_adds, f32, f32, f32, env) -DEF_HELPER_3(vfp_addd, f64, f64, f64, env) -DEF_HELPER_3(vfp_subs, f32, f32, f32, env) -DEF_HELPER_3(vfp_subd, f64, f64, f64, env) -DEF_HELPER_3(vfp_muls, f32, f32, f32, env) -DEF_HELPER_3(vfp_muld, f64, f64, f64, env) -DEF_HELPER_3(vfp_divs, f32, f32, f32, env) -DEF_HELPER_3(vfp_divd, f64, f64, f64, env) +DEF_HELPER_3(vfp_adds, f32, f32, f32, ptr) +DEF_HELPER_3(vfp_addd, f64, f64, f64, ptr) +DEF_HELPER_3(vfp_subs, f32, f32, f32, ptr) +DEF_HELPER_3(vfp_subd, f64, f64, f64, ptr) +DEF_HELPER_3(vfp_muls, f32, f32, f32, ptr) +DEF_HELPER_3(vfp_muld, f64, f64, f64, ptr) +DEF_HELPER_3(vfp_divs, f32, f32, f32, ptr) +DEF_HELPER_3(vfp_divd, f64, f64, f64, ptr) DEF_HELPER_1(vfp_negs, f32, f32) DEF_HELPER_1(vfp_negd, f64, f64)DEF_HELPER_1 (vfp_abss, f32, f32)
target-arm/translate.c +11 -6
@@ -909,10 +909,13 @@ static TCGv_ptr get_fpstatus_ptr(int neon)#define VFP_OP2 (name) \ static inline void gen_vfp_##name(int dp) \ { \ - if (dp) \ - gen_helper_vfp_##name##d(cpu_F0d, cpu_F0d, cpu_F1d, cpu_env); \ - else \ - gen_helper_vfp_##name##s(cpu_F0s, cpu_F0s, cpu_F1s, cpu_env); \ + TCGv_ptr fpst = get_fpstatus_ptr(0); \ + if (dp) { \ + gen_helper_vfp_##name##d(cpu_F0d, cpu_F0d, cpu_F1d, fpst); \ + } else { \ + gen_helper_vfp_##name##s(cpu_F0s, cpu_F0s, cpu_F1s, fpst); \ + } \ + tcg_temp_free_ptr(fpst); \ }VFP_OP2 (add)
@@ -925,11 +928,13 @@ VFP_OP2(div)static inline void gen_vfp_F1_mul (int dp) {/* Like gen_vfp_mul() but put result in F1 */ +TCGv_ptr fpst =get_fpstatus_ptr (0 );if (dp) { -gen_helper_vfp_muld (cpu_F1d, cpu_F0d, cpu_F1d, cpu_env); +gen_helper_vfp_muld (cpu_F1d, cpu_F0d, cpu_F1d, fpst); }else { -gen_helper_vfp_muls (cpu_F1s, cpu_F0s, cpu_F1s, cpu_env); +gen_helper_vfp_muls (cpu_F1s, cpu_F0s, cpu_F1s, fpst); } +tcg_temp_free_ptr (fpst); }static inline void gen_vfp_F1_neg (int dp)
Signature · 1 line
1.7.1
PATCH 4/8 target-arm: Pass fp status pointer explicitly to neon fp helpers
In reply to Peter MaydellMake the Neon helpers for various floating point operations take an explicit pointer to the float_status they use, so they don't rely on the global environment pointer any more. This also allows us to drop the mul/sub/add helpers completely and just use the vfp versions.
--- target-arm/helper.h | 19 +++----- target-arm/neon_helper.c | 57 ++++++++++-------------- target-arm/translate.c | 111 +++++++++++++++++++++++++++++++++------------ 3 files changed, 113 insertions(+), 74 deletions(-)
target-arm/helper.h +8 -11
@@ -350,17 +350,14 @@ DEF_HELPER_1(neon_qneg_s8, i32, i32) DEF_HELPER_1(neon_qneg_s16, i32, i32) DEF_HELPER_1(neon_qneg_s32, i32, i32) -DEF_HELPER_2(neon_min_f32, i32, i32, i32) -DEF_HELPER_2(neon_max_f32, i32, i32, i32) -DEF_HELPER_2(neon_abd_f32, i32, i32, i32) -DEF_HELPER_2(neon_add_f32, i32, i32, i32) -DEF_HELPER_2(neon_sub_f32, i32, i32, i32) -DEF_HELPER_2(neon_mul_f32, i32, i32, i32) -DEF_HELPER_2(neon_ceq_f32, i32, i32, i32) -DEF_HELPER_2(neon_cge_f32, i32, i32, i32) -DEF_HELPER_2(neon_cgt_f32, i32, i32, i32) -DEF_HELPER_2(neon_acge_f32, i32, i32, i32) -DEF_HELPER_2 (neon_acgt_f32, i32, i32, i32) +DEF_HELPER_3(neon_min_f32, i32, i32, i32, ptr) +DEF_HELPER_3(neon_max_f32, i32, i32, i32, ptr) +DEF_HELPER_3(neon_abd_f32, i32, i32, i32, ptr) +DEF_HELPER_3(neon_ceq_f32, i32, i32, i32, ptr) +DEF_HELPER_3(neon_cge_f32, i32, i32, i32, ptr) +DEF_HELPER_3(neon_cgt_f32, i32, i32, i32, ptr) +DEF_HELPER_3(neon_acge_f32, i32, i32, i32, ptr) +DEF_HELPER_3 (neon_acgt_f32, i32, i32, i32, ptr) /* iwmmxt_helper.c */DEF_HELPER_2 (iwmmxt_maddsq, i64, i64, i64)
target-arm/neon_helper.c +24 -33
101 lines not on this page · raw message
target-arm/translate.c +81 -30
189 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 5/8 Revert "target-arm: Use global env in neon_helper.c helpers"
In reply to Peter MaydellThis effectively reverts commit 2a3f75b42ac255be09ec2939b96c549ec830efd3 so that we return to passing CPUState to helpers as an explicit parameter. (There were a number of conflicts in target-arm/translate.c which had to be resolved by hand so it is not a pure revert.)
--- target-arm/helper.h | 134 +++++++++++++++++++++--------------------- target-arm/neon_helper.c | 144 +++++++++++++++++++++++---------------------- target-arm/translate.c | 140 +++++++++++++++++++++++++++----------------- 3 files changed, 227 insertions(+), 191 deletions(-)
target-arm/helper.h +67 -67
@@ -154,22 +154,22 @@ DEF_HELPER_2(sar_cc, i32, i32, i32)DEF_HELPER_2 (ror_cc, i32, i32, i32) /* neon_helper.c */ -DEF_HELPER_2(neon_qadd_u8, i32, i32, i32) -DEF_HELPER_2(neon_qadd_s8, i32, i32, i32) -DEF_HELPER_2(neon_qadd_u16, i32, i32, i32) -DEF_HELPER_2(neon_qadd_s16, i32, i32, i32) -DEF_HELPER_2(neon_qadd_u32, i32, i32, i32) -DEF_HELPER_2(neon_qadd_s32, i32, i32, i32) -DEF_HELPER_2(neon_qsub_u8, i32, i32, i32) -DEF_HELPER_2(neon_qsub_s8, i32, i32, i32) -DEF_HELPER_2(neon_qsub_u16, i32, i32, i32) -DEF_HELPER_2(neon_qsub_s16, i32, i32, i32) -DEF_HELPER_2(neon_qsub_u32, i32, i32, i32) -DEF_HELPER_2(neon_qsub_s32, i32, i32, i32) -DEF_HELPER_2(neon_qadd_u64, i64, i64, i64) -DEF_HELPER_2(neon_qadd_s64, i64, i64, i64) -DEF_HELPER_2(neon_qsub_u64, i64, i64, i64) -DEF_HELPER_2(neon_qsub_s64, i64, i64, i64) +DEF_HELPER_3(neon_qadd_u8, i32, env, i32, i32) +DEF_HELPER_3(neon_qadd_s8, i32, env, i32, i32) +DEF_HELPER_3(neon_qadd_u16, i32, env, i32, i32) +DEF_HELPER_3(neon_qadd_s16, i32, env, i32, i32) +DEF_HELPER_3(neon_qadd_u32, i32, env, i32, i32) +DEF_HELPER_3(neon_qadd_s32, i32, env, i32, i32) +DEF_HELPER_3(neon_qsub_u8, i32, env, i32, i32) +DEF_HELPER_3(neon_qsub_s8, i32, env, i32, i32) +DEF_HELPER_3(neon_qsub_u16, i32, env, i32, i32) +DEF_HELPER_3(neon_qsub_s16, i32, env, i32, i32) +DEF_HELPER_3(neon_qsub_u32, i32, env, i32, i32) +DEF_HELPER_3(neon_qsub_s32, i32, env, i32, i32) +DEF_HELPER_3(neon_qadd_u64, i64, env, i64, i64) +DEF_HELPER_3(neon_qadd_s64, i64, env, i64, i64) +DEF_HELPER_3(neon_qsub_u64, i64, env, i64, i64) +DEF_HELPER_3(neon_qsub_s64, i64, env, i64, i64) DEF_HELPER_2(neon_hadd_s8, i32, i32, i32)DEF_HELPER_2 (neon_hadd_u8, i32, i32, i32)
@@ -247,26 +247,26 @@ DEF_HELPER_2(neon_rshl_u32, i32, i32, i32) DEF_HELPER_2(neon_rshl_s32, i32, i32, i32) DEF_HELPER_2(neon_rshl_u64, i64, i64, i64) DEF_HELPER_2(neon_rshl_s64, i64, i64, i64) -DEF_HELPER_2(neon_qshl_u8, i32, i32, i32) -DEF_HELPER_2(neon_qshl_s8, i32, i32, i32) -DEF_HELPER_2(neon_qshl_u16, i32, i32, i32) -DEF_HELPER_2(neon_qshl_s16, i32, i32, i32) -DEF_HELPER_2(neon_qshl_u32, i32, i32, i32) -DEF_HELPER_2(neon_qshl_s32, i32, i32, i32) -DEF_HELPER_2(neon_qshl_u64, i64, i64, i64) -DEF_HELPER_2(neon_qshl_s64, i64, i64, i64) -DEF_HELPER_2 (neon_qshlu_s8, i32, i32, i32); -DEF_HELPER_2 (neon_qshlu_s16, i32, i32, i32); -DEF_HELPER_2 (neon_qshlu_s32, i32, i32, i32); -DEF_HELPER_2 (neon_qshlu_s64, i64, i64, i64); -DEF_HELPER_2(neon_qrshl_u8, i32, i32, i32) -DEF_HELPER_2(neon_qrshl_s8, i32, i32, i32) -DEF_HELPER_2(neon_qrshl_u16, i32, i32, i32) -DEF_HELPER_2(neon_qrshl_s16, i32, i32, i32) -DEF_HELPER_2(neon_qrshl_u32, i32, i32, i32) -DEF_HELPER_2(neon_qrshl_s32, i32, i32, i32) -DEF_HELPER_2(neon_qrshl_u64, i64, i64, i64) -DEF_HELPER_2(neon_qrshl_s64, i64, i64, i64) +DEF_HELPER_3(neon_qshl_u8, i32, env, i32, i32) +DEF_HELPER_3(neon_qshl_s8, i32, env, i32, i32) +DEF_HELPER_3(neon_qshl_u16, i32, env, i32, i32) +DEF_HELPER_3(neon_qshl_s16, i32, env, i32, i32) +DEF_HELPER_3(neon_qshl_u32, i32, env, i32, i32) +DEF_HELPER_3(neon_qshl_s32, i32, env, i32, i32) +DEF_HELPER_3(neon_qshl_u64, i64, env, i64, i64) +DEF_HELPER_3(neon_qshl_s64, i64, env, i64, i64) +DEF_HELPER_3 (neon_qshlu_s8, i32, env, i32, i32); +DEF_HELPER_3 (neon_qshlu_s16, i32, env, i32, i32); +DEF_HELPER_3 (neon_qshlu_s32, i32, env, i32, i32); +DEF_HELPER_3 (neon_qshlu_s64, i64, env, i64, i64); +DEF_HELPER_3(neon_qrshl_u8, i32, env, i32, i32) +DEF_HELPER_3(neon_qrshl_s8, i32, env, i32, i32) +DEF_HELPER_3(neon_qrshl_u16, i32, env, i32, i32) +DEF_HELPER_3(neon_qrshl_s16, i32, env, i32, i32) +DEF_HELPER_3(neon_qrshl_u32, i32, env, i32, i32) +DEF_HELPER_3(neon_qrshl_s32, i32, env, i32, i32) +DEF_HELPER_3(neon_qrshl_u64, i64, env, i64, i64) +DEF_HELPER_3(neon_qrshl_s64, i64, env, i64, i64) DEF_HELPER_2(neon_add_u8, i32, i32, i32)DEF_HELPER_2 (neon_add_u16, i32, i32, i32)
@@ -295,22 +295,22 @@ DEF_HELPER_1(neon_cls_s16, i32, i32) DEF_HELPER_1(neon_cls_s32, i32, i32) DEF_HELPER_1(neon_cnt_u8, i32, i32) -DEF_HELPER_2(neon_qdmulh_s16, i32, i32, i32) -DEF_HELPER_2(neon_qrdmulh_s16, i32, i32, i32) -DEF_HELPER_2(neon_qdmulh_s32, i32, i32, i32) -DEF_HELPER_2(neon_qrdmulh_s32, i32, i32, i32) +DEF_HELPER_3(neon_qdmulh_s16, i32, env, i32, i32) +DEF_HELPER_3(neon_qrdmulh_s16, i32, env, i32, i32) +DEF_HELPER_3(neon_qdmulh_s32, i32, env, i32, i32) +DEF_HELPER_3(neon_qrdmulh_s32, i32, env, i32, i32) DEF_HELPER_1(neon_narrow_u8, i32, i64) DEF_HELPER_1(neon_narrow_u16, i32, i64) -DEF_HELPER_1(neon_unarrow_sat8, i32, i64) -DEF_HELPER_1(neon_narrow_sat_u8, i32, i64) -DEF_HELPER_1(neon_narrow_sat_s8, i32, i64) -DEF_HELPER_1(neon_unarrow_sat16, i32, i64) -DEF_HELPER_1(neon_narrow_sat_u16, i32, i64) -DEF_HELPER_1(neon_narrow_sat_s16, i32, i64) -DEF_HELPER_1(neon_unarrow_sat32, i32, i64) -DEF_HELPER_1(neon_narrow_sat_u32, i32, i64) -DEF_HELPER_1(neon_narrow_sat_s32, i32, i64) +DEF_HELPER_2(neon_unarrow_sat8, i32, env, i64) +DEF_HELPER_2(neon_narrow_sat_u8, i32, env, i64) +DEF_HELPER_2(neon_narrow_sat_s8, i32, env, i64) +DEF_HELPER_2(neon_unarrow_sat16, i32, env, i64) +DEF_HELPER_2(neon_narrow_sat_u16, i32, env, i64) +DEF_HELPER_2(neon_narrow_sat_s16, i32, env, i64) +DEF_HELPER_2(neon_unarrow_sat32, i32, env, i64) +DEF_HELPER_2(neon_narrow_sat_u32, i32, env, i64) +DEF_HELPER_2(neon_narrow_sat_s32, i32, env, i64) DEF_HELPER_1(neon_narrow_high_u8, i32, i64) DEF_HELPER_1(neon_narrow_high_u16, i32, i64)DEF_HELPER_1 (neon_narrow_round_high_u8, i32, i64)
@@ -326,8 +326,8 @@ DEF_HELPER_2(neon_paddl_u16, i64, i64, i64) DEF_HELPER_2(neon_paddl_u32, i64, i64, i64) DEF_HELPER_2(neon_subl_u16, i64, i64, i64) DEF_HELPER_2(neon_subl_u32, i64, i64, i64) -DEF_HELPER_2(neon_addl_saturate_s32, i64, i64, i64) -DEF_HELPER_2(neon_addl_saturate_s64, i64, i64, i64) +DEF_HELPER_3(neon_addl_saturate_s32, i64, env, i64, i64) +DEF_HELPER_3(neon_addl_saturate_s64, i64, env, i64, i64) DEF_HELPER_2(neon_abdl_u16, i64, i32, i32) DEF_HELPER_2(neon_abdl_s16, i64, i32, i32)DEF_HELPER_2 (neon_abdl_u32, i64, i32, i32)
@@ -343,12 +343,12 @@ DEF_HELPER_1(neon_negl_u16, i64, i64) DEF_HELPER_1(neon_negl_u32, i64, i64) DEF_HELPER_1(neon_negl_u64, i64, i64) -DEF_HELPER_1(neon_qabs_s8, i32, i32) -DEF_HELPER_1(neon_qabs_s16, i32, i32) -DEF_HELPER_1(neon_qabs_s32, i32, i32) -DEF_HELPER_1(neon_qneg_s8, i32, i32) -DEF_HELPER_1(neon_qneg_s16, i32, i32) -DEF_HELPER_1(neon_qneg_s32, i32, i32) +DEF_HELPER_2(neon_qabs_s8, i32, env, i32) +DEF_HELPER_2(neon_qabs_s16, i32, env, i32) +DEF_HELPER_2(neon_qabs_s32, i32, env, i32) +DEF_HELPER_2(neon_qneg_s8, i32, env, i32) +DEF_HELPER_2(neon_qneg_s16, i32, env, i32) +DEF_HELPER_2(neon_qneg_s32, i32, env, i32) DEF_HELPER_3(neon_min_f32, i32, i32, i32, ptr)DEF_HELPER_3 (neon_max_f32, i32, i32, i32, ptr)
@@ -458,15 +458,15 @@ DEF_HELPER_3(iwmmxt_muladdswl, i64, i64, i32, i32) DEF_HELPER_2(set_teecr, void, env, i32) -DEF_HELPER_2(neon_unzip8, void, i32, i32) -DEF_HELPER_2(neon_unzip16, void, i32, i32) -DEF_HELPER_2(neon_qunzip8, void, i32, i32) -DEF_HELPER_2(neon_qunzip16, void, i32, i32) -DEF_HELPER_2(neon_qunzip32, void, i32, i32) -DEF_HELPER_2(neon_zip8, void, i32, i32) -DEF_HELPER_2(neon_zip16, void, i32, i32) -DEF_HELPER_2(neon_qzip8, void, i32, i32) -DEF_HELPER_2(neon_qzip16, void, i32, i32) -DEF_HELPER_2(neon_qzip32, void, i32, i32) +DEF_HELPER_3(neon_unzip8, void, env, i32, i32) +DEF_HELPER_3(neon_unzip16, void, env, i32, i32) +DEF_HELPER_3(neon_qunzip8, void, env, i32, i32) +DEF_HELPER_3(neon_qunzip16, void, env, i32, i32) +DEF_HELPER_3(neon_qunzip32, void, env, i32, i32) +DEF_HELPER_3(neon_zip8, void, env, i32, i32) +DEF_HELPER_3(neon_zip16, void, env, i32, i32) +DEF_HELPER_3(neon_qzip8, void, env, i32, i32) +DEF_HELPER_3(neon_qzip16, void, env, i32, i32) +DEF_HELPER_3(neon_qzip32, void, env, i32, i32)#include "def-helper.h"
target-arm/neon_helper.c +74 -70
470 lines not on this page · raw message
target-arm/translate.c +86 -54
308 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 6/8 Revert "Makefile.target: Allow target helpers to be in any *_helper.c file"
In reply to Peter MaydellReverts commit 348883d4828d7434e1053407818598f7fb15e594, so the global env is no longer available to helper.c files other than op_helper.c.
--- Makefile.target | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile.target +1 -1
@@ -91,7 +91,7 @@ tcg/tcg.o: cpu.h # HELPER_CFLAGS is used for all the code compiled with static register # variables -%_helper.o cpu-exec.o user-exec.o: QEMU_CFLAGS += $(HELPER_CFLAGS) +op_helper.o cpu-exec.o user-exec.o: QEMU_CFLAGS += $(HELPER_CFLAGS) # Note: this is a workaround. The real fix is to avoid compiling # cpu_signal_handler() in user-exec.c.
Signature · 1 line
1.7.1
PATCH 7/8 target-arm: Minimal implementation of performance counters
In reply to Peter MaydellNewer Linux kernels assume the existence of the performance counter cp15 registers. Provide a minimal implementation of these registers. We support no events. This should be compliant with the ARM ARM, except that we don't implement the cycle counter.
--- target-arm/cpu.h | 8 ++- target-arm/helper.c | 159 ++++++++++++++++++++++++++++++++++++++++++++---- target-arm/machine.c | 12 ++++ target-arm/translate.c | 20 ++++++- 4 files changed, 183 insertions(+), 16 deletions(-)
target-arm/cpu.h +7 -1
@@ -133,6 +133,12 @@ typedef struct CPUARMState {uint32_t c7_par;/* Translation result. */ uint32_t c9_insn;/* Cache lockdown registers. */ uint32_t c9_data; +uint32_t c9_pmcr;/* performance monitor control register */ +uint32_t c9_pmcnten;/* perf monitor counter enables */ +uint32_t c9_pmovsr;/* perf monitor overflow status */ +uint32_t c9_pmxevtyper;/* perf monitor event type */ +uint32_t c9_pmuserenr;/* perf monitor user enable */ +uint32_t c9_pminten;/* perf monitor interrupt enables */ uint32_t c13_fcse;/* FCSE PID. */ uint32_t c13_context;/* Context ID. */ uint32_t c13_tls1;/* User RW Thread register. */
@@ -438,7 +444,7 @@ void cpu_arm_set_cp_io(CPUARMState *env, int cpnum,#define cpu_signal_handler cpu_arm_signal_handler#define cpu_list arm_cpu_list -#define CPU_SAVE_VERSION 3 +#define CPU_SAVE_VERSION 4/* MMU modes definitions */ #define MMU_MODE0_SUFFIX _kernel
target-arm/helper.c +146 -13
185 lines not on this page · raw message
target-arm/machine.c +12 -0
@@ -44,6 +44,12 @@ void cpu_save(QEMUFile *f, void *opaque)qemu_put_be32 (f, env->cp15.c7_par);qemu_put_be32 (f, env->cp15.c9_insn);qemu_put_be32 (f, env->cp15.c9_data); +qemu_put_be32 (f, env->cp15.c9_pmcr); +qemu_put_be32 (f, env->cp15.c9_pmcnten); +qemu_put_be32 (f, env->cp15.c9_pmovsr); +qemu_put_be32 (f, env->cp15.c9_pmxevtyper); +qemu_put_be32 (f, env->cp15.c9_pmuserenr); +qemu_put_be32 (f, env->cp15.c9_pminten);qemu_put_be32 (f, env->cp15.c13_fcse);qemu_put_be32 (f, env->cp15.c13_context);qemu_put_be32 (f, env->cp15.c13_tls1);
@@ -152,6 +158,12 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id) env->cp15.c7_par =qemu_get_be32 (f); env->cp15.c9_insn =qemu_get_be32 (f); env->cp15.c9_data =qemu_get_be32 (f); + env->cp15.c9_pmcr =qemu_get_be32 (f); + env->cp15.c9_pmcnten =qemu_get_be32 (f); + env->cp15.c9_pmovsr =qemu_get_be32 (f); + env->cp15.c9_pmxevtyper =qemu_get_be32 (f); + env->cp15.c9_pmuserenr =qemu_get_be32 (f); + env->cp15.c9_pminten =qemu_get_be32 (f); env->cp15.c13_fcse =qemu_get_be32 (f); env->cp15.c13_context =qemu_get_be32 (f); env->cp15.c13_tls1 =qemu_get_be32 (f);
target-arm/translate.c +18 -2
@@ -2472,12 +2472,28 @@ static int disas_cp_insn(CPUState *env, DisasContext *s, uint32_t insn)return 0 ; } -static int cp15_user_ok (uint32_t insn) +static int cp15_user_ok (CPUState *env,uint32_t insn) {int cpn = (insn >>16 ) &0xf ;int cpm = insn &0xf ;int op = ((insn >>5 ) &7 ) | ((insn >>18 ) &0x38 ); +if (arm_feature (env,ARM_FEATURE_V7 ) && cpn ==9 ) { +/* Performance monitor registers fall into three categories: +* (a) always UNDEF in usermode +* (b) UNDEF only if PMUSERENR.EN is 0 +* (c) always read OK and UNDEF on write (PMUSERENR only) +*/ +if ((cpm ==12 && (op <6 )) || + (cpm ==13 && (op <3 ))) { +return env->cp15.c9_pmuserenr; + }else if (cpm ==14 && op ==0 && (insn &ARM_CP_RW_BIT )) { +/* PMUSERENR, read only */ +return 1 ; + } +return 0 ; + } +if (cpn ==13 && cpm ==0 ) {/* TLS register. */ if (op ==2 || (op ==3 && (insn &ARM_CP_RW_BIT )))
@@ -2564,7 +2580,7 @@ static int disas_cp15_insn(CPUState *env, DisasContext *s, uint32_t insn)/* cdp */ return 1 ; } -if (IS_USER (s) && !cp15_user_ok (insn)) { +if (IS_USER (s) && !cp15_user_ok (env, insn)) {return 1 ; }
Signature · 1 line
1.7.1
PATCH 8/8 target-arm: Fix BASEPRI, BASEPRI_MAX, and FAULTMASK access
In reply to Peter MaydellFrom: Sebastian Huber <[email protected]>
Correct the decode of the register numbers for BASEPRI, BASEPRI_MAX and FAULTMASK, according to "ARMv7-M Architecture Reference Manual" issue D section "B5.2.3 MRS" and "B5.2.3 MSR".
--- target-arm/helper.c | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-)
target-arm/helper.c +12 -12
@@ -2128,11 +2128,11 @@ uint32_t HELPER(v7m_mrs)(CPUState *env, uint32_t reg)return env->v7m.current_sp ? env->regs[13 ] : env->v7m.other_sp;case 16 :/* PRIMASK */ return (env->uncached_cpsr &CPSR_I ) !=0 ; -case 17 :/* FAULTMASK */ -return (env->uncached_cpsr &CPSR_F ) !=0 ; -case 18 :/* BASEPRI */ -case 19 :/* BASEPRI_MAX */ +case 17 :/* BASEPRI */ +case 18 :/* BASEPRI_MAX */ return env->v7m.basepri; +case 19 :/* FAULTMASK */ +return (env->uncached_cpsr &CPSR_F ) !=0 ;case 20 :/* CONTROL */ return env->v7m.control;default :
@@ -2184,20 +2184,20 @@ void HELPER(v7m_msr)(CPUState *env, uint32_t reg, uint32_t val)else env->uncached_cpsr &= ~CPSR_I ;break ; -case 17 :/* FAULTMASK */ -if (val &1 ) - env->uncached_cpsr |=CPSR_F ; -else - env->uncached_cpsr &= ~CPSR_F ; -break ; -case 18 :/* BASEPRI */ +case 17 :/* BASEPRI */ env->v7m.basepri = val &0xff ;break ; -case 19 :/* BASEPRI_MAX */ +case 18 :/* BASEPRI_MAX */ val &=0xff ;if (val !=0 && (val < env->v7m.basepri || env->v7m.basepri ==0 )) env->v7m.basepri = val;break ; +case 19 :/* FAULTMASK */ +if (val &1 ) + env->uncached_cpsr |=CPSR_F ; +else + env->uncached_cpsr &= ~CPSR_F ; +break ;case 20 :/* CONTROL */ env->v7m.control = val &3 ;switch_v7m_sp (env, (val &2 ) !=0 );
Signature · 1 line
1.7.1
Ping?
thanks
-- PMM
Quoted 44 lines · Peter Maydell
This is a pull request for various ARM related patches which have been on the list for a while (mostly but not entirely mine).
The performance counters patch had quite a bit of discussion when originally posted (http://patchwork.ozlabs.org/patch/92423/)
which was basically focused around the question of "can/should helper functions throw exceptions". The patch continues along the lines of all the existing cp15 handling, and nobody responded to my "please ack/nak/commit" message, which is why it's in this pull req.Thanks
-- PMMThe following changes since commit
48e2faf222cbf4abab7c8e4b3f44229ec98eae7f:net: Warn about "-net nic" options which were ignored (2011-06-22 07:18:39 -0500)
are available in the git repository at:
git://git.linaro.org/people/pmaydell/qemu-arm.git for-upstreamPeter Maydell (7):
Revert "target-arm: Use global env iniwmmxt_helper.chelpers"
target-arm: Add helper function to generate code to get fpstatus pointer
target-arm: Make VFP binop helpers take pointer to fpstatus, not CPUState
target-arm: Pass fp status pointer explicitly to neon fp helpers Revert "target-arm: Use global env inneon_helper.chelpers" Revert "Makefile.target: Allow target helpers to be in any *_helper.c file"
target-arm: Minimal implementation of performance countersSebastian Huber (1):
target-arm: Fix BASEPRI,BASEPRI_MAX, and FAULTMASK accessMakefile.target | 2 +-
target-arm/cpu.h | 8 +-
target-arm/helper.c | 193 ++++++++++++++++---target-arm/helper.h| 293 ++++++++++++++--------------target-arm/iwmmxt_helper.c| 80 +++++----
target-arm/machine.c | 12 ++
target-arm/neon_helper.c | 201 ++++++++++----------target-arm/translate.c| 457 +++++++++++++++++++++++++++-----------------8 files changed, 753 insertions(+), 493 deletions(-)
Signature · 2 lines
12345678901234567890123456789012345678901234567890123456789012345678901234567890 1 2 3 4 5 6 7 8
Ping^2 ?
-- PMM
Quoted 48 lines · Peter Maydell
Ping?
thanks
-- PMMQuoted 42 lines · Peter Maydell
This is a pull request for various ARM related patches which have been on the list for a while (mostly but not entirely mine).
The performance counters patch had quite a bit of discussion when originally posted (http://patchwork.ozlabs.org/patch/92423/)
which was basically focused around the question of "can/should helper functions throw exceptions". The patch continues along the lines of all the existing cp15 handling, and nobody responded to my "please ack/nak/commit" message, which is why it's in this pull req.Thanks
-- PMMThe following changes since commit
48e2faf222cbf4abab7c8e4b3f44229ec98eae7f:net: Warn about "-net nic" options which were ignored (2011-06-22 07:18:39 -0500)
are available in the git repository at:
git://git.linaro.org/people/pmaydell/qemu-arm.git for-upstreamPeter Maydell (7):
Revert "target-arm: Use global env iniwmmxt_helper.chelpers"
target-arm: Add helper function to generate code to get fpstatus pointer
target-arm: Make VFP binop helpers take pointer to fpstatus, not CPUState
target-arm: Pass fp status pointer explicitly to neon fp helpers Revert "target-arm: Use global env inneon_helper.chelpers" Revert "Makefile.target: Allow target helpers to be in any *_helper.c file"
target-arm: Minimal implementation of performance countersSebastian Huber (1):
target-arm: Fix BASEPRI,BASEPRI_MAX, and FAULTMASK accessMakefile.target | 2 +-
target-arm/cpu.h | 8 +-
target-arm/helper.c | 193 ++++++++++++++++---target-arm/helper.h| 293 ++++++++++++++--------------target-arm/iwmmxt_helper.c| 80 +++++----
target-arm/machine.c | 12 ++
target-arm/neon_helper.c | 201 ++++++++++----------target-arm/translate.c| 457 +++++++++++++++++++++++++++-----------------8 files changed, 753 insertions(+), 493 deletions(-)