GNU Binutils with patches for OS216
Révision | 4c0ca98e58fc409c93b41bb6c42f3e873db47725 (tree) |
---|---|
l'heure | 2016-03-18 23:46:42 |
Auteur | Nick Clifton <nickc@redh...> |
Commiter | Nick Clifton |
Fix code to check for illegal element numbers when accessing AArch64 vector registers in AArch64 sim.
* cpustate.c (GET_VEC_ELEMENT): Fix off by one error checking
for an invalid element index.
(SET_VEC_ELEMENT): Likewise.
@@ -4,6 +4,10 @@ | ||
4 | 4 | Print hex equivalents of floats and doubles. |
5 | 5 | Check element number against array size when accessing vector |
6 | 6 | registers. |
7 | + (GET_VEC_ELEMENT): Fix off by one error checking for an invalid | |
8 | + element index. | |
9 | + (SET_VEC_ELEMENT): Likewise. | |
10 | + | |
7 | 11 | * memory.c: Trace memory reads when --trace-memory is enabled. |
8 | 12 | Remove float and double load and store functions. |
9 | 13 | * memory.h (aarch64_get_mem_float): Delete prototype. |
@@ -345,7 +345,7 @@ aarch64_set_FP_long_double (sim_cpu *cpu, VReg reg, FRegister a) | ||
345 | 345 | #define GET_VEC_ELEMENT(REG, ELEMENT, FIELD) \ |
346 | 346 | do \ |
347 | 347 | { \ |
348 | - if (element > ARRAY_SIZE (cpu->fr[0].FIELD)) \ | |
348 | + if (element >= ARRAY_SIZE (cpu->fr[0].FIELD)) \ | |
349 | 349 | { \ |
350 | 350 | TRACE_REGISTER (cpu, \ |
351 | 351 | "Internal SIM error: invalid element number: %d ",\ |
@@ -421,7 +421,7 @@ aarch64_get_vec_double (sim_cpu *cpu, VReg reg, unsigned element) | ||
421 | 421 | #define SET_VEC_ELEMENT(REG, ELEMENT, VAL, FIELD, PRINTER) \ |
422 | 422 | do \ |
423 | 423 | { \ |
424 | - if (ELEMENT > ARRAY_SIZE (cpu->fr[0].FIELD)) \ | |
424 | + if (ELEMENT >= ARRAY_SIZE (cpu->fr[0].FIELD)) \ | |
425 | 425 | { \ |
426 | 426 | TRACE_REGISTER (cpu, \ |
427 | 427 | "Internal SIM error: invalid element number: %d ",\ |