diff options
author | Alexander Graf <agraf@suse.de> | 2012-01-25 16:27:26 +0100 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2012-02-02 02:47:46 +0100 |
commit | 3f162d119ef52fda714ebb498fcb4f4b7c354d38 (patch) | |
tree | 9d5a31eb5e617b8255fbd7a8d9f67169f61df6e3 /target-ppc/cpu.h | |
parent | 6d3db821c18fdc9727108b5b4bbb38cb7ab5c0e6 (diff) |
PPC: booke206: Check for TLB overrun
Our internal helpers to fetch TLB entries were not able to tell us
that an entry doesn't even exist. Pass an error out if we hit such
a case to not accidently pass beyond the TLB array.
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'target-ppc/cpu.h')
-rw-r--r-- | target-ppc/cpu.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h index 1026254605..668ddf34cb 100644 --- a/target-ppc/cpu.h +++ b/target-ppc/cpu.h @@ -2112,6 +2112,10 @@ static inline ppcmas_tlb_t *booke206_get_tlbm(CPUState *env, const int tlbn, ea &= (1 << (tlb_bits - ways_bits)) - 1; r = (ea << ways_bits) | way; + if (r >= booke206_tlb_size(env, tlbn)) { + return NULL; + } + /* bump up to tlbn index */ for (i = 0; i < tlbn; i++) { r += booke206_tlb_size(env, i); |