summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-10-10 14:44:52 -0600
committerBrian Paul <brian.paul@tungstengraphics.com>2008-10-10 14:44:52 -0600
commitf42ef6f39d213b4c6315ba95791c16ca2b1a4b21 (patch)
treed609d13efbc820fc0fd60839f9c157c44fbff98e /src/gallium/auxiliary
parent78c67a726fff052abeb03417283504a5dd521665 (diff)
cell: additional 'offset' checking in spe_lqd(), spe_stqd()
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/rtasm/rtasm_ppc_spe.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/rtasm/rtasm_ppc_spe.c b/src/gallium/auxiliary/rtasm/rtasm_ppc_spe.c
index 5b0f6bdd48..d0bacd08a6 100644
--- a/src/gallium/auxiliary/rtasm/rtasm_ppc_spe.c
+++ b/src/gallium/auxiliary/rtasm/rtasm_ppc_spe.c
@@ -552,14 +552,19 @@ spe_comment(struct spe_function *p, int rel_indent, const char *s)
/**
* Load quad word.
- * NOTE: imm is in bytes and the least significant 4 bits must be zero!
+ * NOTE: offset is in bytes and the least significant 4 bits must be zero!
*/
void spe_lqd(struct spe_function *p, unsigned rT, unsigned rA, int offset)
{
const boolean pSave = p->print;
- p->print = FALSE;
+ /* offset must be a multiple of 16 */
assert(offset % 16 == 0);
+ /* offset must fit in 10-bit signed int field, after shifting */
+ assert((offset >> 4) <= 511);
+ assert((offset >> 4) >= -512);
+
+ p->print = FALSE;
emit_RI10(p, 0x034, rT, rA, offset >> 4, "spe_lqd");
p->print = pSave;
@@ -572,14 +577,19 @@ void spe_lqd(struct spe_function *p, unsigned rT, unsigned rA, int offset)
/**
* Store quad word.
- * NOTE: imm is in bytes and the least significant 4 bits must be zero!
+ * NOTE: offset is in bytes and the least significant 4 bits must be zero!
*/
void spe_stqd(struct spe_function *p, unsigned rT, unsigned rA, int offset)
{
const boolean pSave = p->print;
- p->print = FALSE;
+ /* offset must be a multiple of 16 */
assert(offset % 16 == 0);
+ /* offset must fit in 10-bit signed int field, after shifting */
+ assert((offset >> 4) <= 511);
+ assert((offset >> 4) >= -512);
+
+ p->print = FALSE;
emit_RI10(p, 0x024, rT, rA, offset >> 4, "spe_stqd");
p->print = pSave;