Xtensa fixes for 2.2:
- fix entry opcode register window checking and add unit test. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJUYNNbAAoJEFH5zJH4P6BEVyMP/2FuLiwhQMaT0lm57uEfzf7g idYjb9gJ+NZHeb1J6ZcA4dMFh2EqVcHhkDipmk55kcagWPb5gcmWcNDdg+rcsxHK fQKX9VcCBCELc6qdDlQpkhUcF5eo3nZEqYcTLTg8bHJ8Afb5U1Blq33QdxGtS1ns HxiVVBKf26J2waXnqO/kqfiKfS0c7KyN1A8LpZNAFjmtABQKtOLCEK+jHljxH5Uy s79e6kGHGFTRSv14kSuWO/HNgjclJzNm9WJ/z5UBty9p1AEUX4VAZQAerd1wt2f9 JKkbRxZDBQklLHZnmYg0fMQa0vdaj2H4TTRug8EUP33d/HdjYWLLD8aGnSJwK/6D nY5drsTvEkmfy4OJp6yovdXiAYLV/aeQCYEO8rlFCk+7bfwWCFtnWL8QfB89aPEM UnyNM7GUDMyg8sXgrwvBtZpfqUZpvrs3z9PmLUbhhsgMeqpnOUhcoOuoU3cXOdP4 AQ0YHES2hsQC+dxnXo/lL3Yf3XIWhEjZKKGB2HAxWT3Vd2ENbYp1fcAuRLeSlP2+ Lpyo65PHKWN1dErt6y57QFCKerqIXo1ikQSph/4oV1Ycot4Ip54YJ08Nj5FVwbWg jJ+CUkrG0ZHTwUwX0Aey5iLsbOfk5QgGAezxSB1gkpptYW0oriplT+konxMYplEd 9EcaCef6Q3PqckR5jo1a =zG6o -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/xtensa/tags/20141110-xtensa' into staging Xtensa fixes for 2.2: - fix entry opcode register window checking and add unit test. # gpg: Signature made Mon 10 Nov 2014 15:01:47 GMT using RSA key ID F83FA044 # gpg: Good signature from "Max Filippov <max.filippov@cogentembedded.com>" # gpg: aka "Max Filippov <jcmvbkbc@gmail.com>" * remotes/xtensa/tags/20141110-xtensa: target-xtensa: add entry overflow test target-xtensa: add missing window check for entry Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
9df98352b7
@ -472,6 +472,12 @@ static inline xtensa_tlb_entry *xtensa_tlb_get_entry(CPUXtensaState *env,
|
||||
env->itlb[wi] + ei;
|
||||
}
|
||||
|
||||
static inline uint32_t xtensa_replicate_windowstart(CPUXtensaState *env)
|
||||
{
|
||||
return env->sregs[WINDOW_START] |
|
||||
(env->sregs[WINDOW_START] << env->config->nareg / 4);
|
||||
}
|
||||
|
||||
/* MMU modes definitions */
|
||||
#define MMU_MODE0_SUFFIX _ring0
|
||||
#define MMU_MODE1_SUFFIX _ring1
|
||||
|
@ -235,6 +235,12 @@ void HELPER(entry)(CPUXtensaState *env, uint32_t pc, uint32_t s, uint32_t imm)
|
||||
pc, env->sregs[PS]);
|
||||
HELPER(exception_cause)(env, pc, ILLEGAL_INSTRUCTION_CAUSE);
|
||||
} else {
|
||||
uint32_t windowstart = xtensa_replicate_windowstart(env) >>
|
||||
(env->sregs[WINDOW_BASE] + 1);
|
||||
|
||||
if (windowstart & ((1 << callinc) - 1)) {
|
||||
HELPER(window_check)(env, pc, callinc);
|
||||
}
|
||||
env->regs[(callinc << 2) | (s & 3)] = env->regs[s] - (imm << 3);
|
||||
rotate_window(env, callinc);
|
||||
env->sregs[WINDOW_START] |=
|
||||
|
@ -299,4 +299,55 @@ test entry
|
||||
entry_test 12
|
||||
test_end
|
||||
|
||||
.macro entry_overflow_test window, free, next_window
|
||||
set_vector window_overflow_4, 0
|
||||
set_vector window_overflow_8, 0
|
||||
set_vector window_overflow_12, 0
|
||||
set_vector window_overflow_\next_window, 10f
|
||||
|
||||
movi a2, \window
|
||||
movi a2, \free
|
||||
movi a2, \next_window
|
||||
reset_window %(1 | ((1 | (1 << ((\next_window) / 4))) << ((\free) / 4)))
|
||||
reset_ps
|
||||
movi a2, 0x4000f | ((\window) << 14)
|
||||
wsr a2, ps
|
||||
isync
|
||||
movi a3, 0x12345678
|
||||
j 1f
|
||||
.align 4
|
||||
1:
|
||||
entry a3, 0x5678
|
||||
test_fail
|
||||
.align 4
|
||||
10:
|
||||
rsr a2, epc1
|
||||
movi a3, 1b
|
||||
assert eq, a2, a3
|
||||
movi a2, 2f
|
||||
wsr a2, epc1
|
||||
|
||||
rsr a2, windowbase
|
||||
movi a3, (\free) / 4
|
||||
assert eq, a2, a3
|
||||
rfwo
|
||||
2:
|
||||
.endm
|
||||
|
||||
.macro all_entry_overflow_tests
|
||||
.irp window, 4, 8, 12
|
||||
.irp next_window, 4, 8, 12
|
||||
.irp free, 4, 8, 12
|
||||
.if \free <= \window
|
||||
entry_overflow_test \window, \free, \next_window
|
||||
.endif
|
||||
.endr
|
||||
.endr
|
||||
.endr
|
||||
.endm
|
||||
|
||||
test entry_overflow
|
||||
all_entry_overflow_tests
|
||||
test_end
|
||||
|
||||
test_suite_end
|
||||
|
Loading…
Reference in New Issue
Block a user