mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
Be a little leniant with vector param stores.
qcc always used vector stores to load values into the function parameters, but if the location of the value is too close to the end of the global data block (the vector spans the end of the block), it would trigger the bounds check code. Thus, allow such instructions without a murmer, so long as it actually is a parameter write.
This commit is contained in:
parent
53049e33eb
commit
bb065bd233
1 changed files with 21 additions and 2 deletions
|
@ -1092,6 +1092,22 @@ check_branch (progs_t *pr, dstatement_t *st, opcode_t *op, short offset)
|
|||
(long)(st - pr->pr_statements), op->opname);
|
||||
}
|
||||
|
||||
static int
|
||||
is_vector_parameter_store (progs_t *pr, dstatement_t *st,
|
||||
unsigned short operand)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (st->op != OP_STORE_V)
|
||||
return 0;
|
||||
if (operand != st->a)
|
||||
return 0;
|
||||
for (i = 0; i < MAX_PARMS; i++)
|
||||
if (st->b == pr->pr_params[i] - pr->pr_globals)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define ISDENORM(x) ((x) && !((x) & 0x7f800000))
|
||||
|
||||
static inline void
|
||||
|
@ -1113,9 +1129,12 @@ check_global (progs_t *pr, dstatement_t *st, opcode_t *op, etype_t type,
|
|||
default:
|
||||
if (operand + (unsigned) pr_type_size[type]
|
||||
> pr->progs->numglobals) {
|
||||
if (operand >= pr->progs->numglobals
|
||||
|| !is_vector_parameter_store (pr, st, operand)) {
|
||||
msg = "out of bounds global index";
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
if (type != ev_float || !check_denorm)
|
||||
break;
|
||||
if (!ISDENORM (G_INT (pr, operand))
|
||||
|
|
Loading…
Reference in a new issue