aboutsummaryrefslogtreecommitdiff
path: root/sim/mips
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@redhat.com>1998-03-18 19:33:33 +0000
committerFrank Ch. Eigler <fche@redhat.com>1998-03-18 19:33:33 +0000
commit0b9843e5ee7f2db8f2f40446a62d69b155af86a2 (patch)
tree954d4f87b9433b091a8f066f69aeaee690fd5fc0 /sim/mips
parent4ebb52f11742c8d7641022192bec652120aa058f (diff)
downloadgdb-0b9843e5ee7f2db8f2f40446a62d69b155af86a2.zip
gdb-0b9843e5ee7f2db8f2f40446a62d69b155af86a2.tar.gz
gdb-0b9843e5ee7f2db8f2f40446a62d69b155af86a2.tar.bz2
* Changes today consist just of some code hardening.
Diffstat (limited to 'sim/mips')
-rw-r--r--sim/mips/sky-pke.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/sim/mips/sky-pke.c b/sim/mips/sky-pke.c
index b35ef12..1689fc1 100644
--- a/sim/mips/sky-pke.c
+++ b/sim/mips/sky-pke.c
@@ -701,12 +701,16 @@ pke_fifo_fit(struct pke_fifo* fifo)
new_qw = zalloc(new_length * sizeof(struct fifo_quadword*));
ASSERT(new_qw != NULL);
- /* copy over old pointers to beginning of new block */
- memcpy(new_qw, fifo->quadwords,
- fifo->length * sizeof(struct fifo_quadword*));
-
- /* free old block */
- zfree(fifo->quadwords);
+ /* copy over old contents, if any */
+ if(fifo->quadwords != NULL)
+ {
+ /* copy over old pointers to beginning of new block */
+ memcpy(new_qw, fifo->quadwords,
+ fifo->length * sizeof(struct fifo_quadword*));
+
+ /* free old block */
+ zfree(fifo->quadwords);
+ }
/* replace pointers & counts */
fifo->quadwords = new_qw;
@@ -1699,7 +1703,7 @@ pke_code_direct(struct pke_device* me, unsigned_4 pkecode)
/* collect word into quadword */
*A4_16(&fifo_data, 3 - (i % 4)) = *operand;
-
+
/* write to GPUIF FIFO only with full quadword */
if(i % 4 == 3)
{
@@ -1708,7 +1712,6 @@ pke_code_direct(struct pke_device* me, unsigned_4 pkecode)
& fifo_data,
16);
} /* write collected quadword */
-
} /* GPUIF xfer loop */
/* done */