aboutsummaryrefslogtreecommitdiff
path: root/sim/arm/armos.c
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>1999-12-07 03:56:43 +0000
committerJason Molenda <jmolenda@apple.com>1999-12-07 03:56:43 +0000
commitc2d11a7da0372ef052af1c74d56e264d8aae4743 (patch)
treeb2ceadb275bb9a170315ab66111c1f643c9ebf71 /sim/arm/armos.c
parent1e37c28164d4f504b2ae8189d0b82a862cfa323d (diff)
downloadgdb-c2d11a7da0372ef052af1c74d56e264d8aae4743.zip
gdb-c2d11a7da0372ef052af1c74d56e264d8aae4743.tar.gz
gdb-c2d11a7da0372ef052af1c74d56e264d8aae4743.tar.bz2
import gdb-1999-12-06 snapshot
Diffstat (limited to 'sim/arm/armos.c')
-rw-r--r--sim/arm/armos.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/sim/arm/armos.c b/sim/arm/armos.c
index 9f0f1fe..be4cbaf 100644
--- a/sim/arm/armos.c
+++ b/sim/arm/armos.c
@@ -308,6 +308,12 @@ SWIread (ARMul_State *state, ARMword f, ARMword ptr, ARMword len)
int i;
char *local = malloc (len);
+ if (local == NULL)
+ {
+ fprintf (stderr, "sim: Unable to read 0x%x bytes - out of memory\n", len);
+ return;
+ }
+
res = read (f, local, len);
if (res > 0)
for (i = 0; i < res; i++)
@@ -325,10 +331,15 @@ SWIwrite (ARMul_State *state, ARMword f, ARMword ptr, ARMword len)
int i;
char *local = malloc (len);
- for (i = 0; i < len; i++)
+ if (local == NULL)
{
- local[i] = ARMul_ReadByte (state, ptr + i);
+ fprintf (stderr, "sim: Unable to write 0x%x bytes - out of memory\n", len);
+ return;
}
+
+ for (i = 0; i < len; i++)
+ local[i] = ARMul_ReadByte (state, ptr + i);
+
res = write (f, local, len);
state->Reg[0] = res == -1 ? -1 : len - res;
free (local);