summaryrefslogtreecommitdiff
path: root/sim/common
diff options
context:
space:
mode:
Diffstat (limited to 'sim/common')
-rw-r--r--sim/common/ChangeLog.ARC17
-rw-r--r--sim/common/callback.c31
-rw-r--r--sim/common/gennltvals.sh4
-rw-r--r--sim/common/syscall.c18
4 files changed, 40 insertions, 30 deletions
diff --git a/sim/common/ChangeLog.ARC b/sim/common/ChangeLog.ARC
index 2b73a9f7f6e..5bf878d536b 100644
--- a/sim/common/ChangeLog.ARC
+++ b/sim/common/ChangeLog.ARC
@@ -1,3 +1,17 @@
+2007-11-13 Irfan Rafiq <irfan.rafiq@arc.com>
+
+ * Ingegrating CGEN simulator with gdb.
+ - model5.c, model6.c, model7.c : Synchronizing model strings like A7 with GDB internal DS.
+
+2007-11-05 Irfan Rafiq <irfan.rafiq@arc.com>
+ * Ingegrating CGEN simulator with gdb.
+ - tconfig.in : defined SIM_HAVE_BIENDIAN 1
+
+2007-10-26 Irfan Rafiq <irfan.rafiq@arc.com>
+ * Ingegrating CGEN simulator with gdb.
+ - sim-if.c : Fix of crash
+ - sim-main.c : For arc-opc-cgen.h
+
2007-09-17 J"orn Rennecke <joern.rennecke@arc.com>
* gentvals.sh: Allow target-specific definitions to override
@@ -8,8 +22,7 @@
2007-08-22 J"orn Rennecke <joern.rennecke@arc.com>
- * cgen-trace.c (sim_cgen_disassemble_insn):
- Check for CGEN_INSN_DISASM_BITSIZE.
+ * (cgen-trace.c): Check for CGEN_INSN_DISASM_BITSIZE.
2007-08-21 J"orn Rennecke <joern.rennecke@arc.com>
diff --git a/sim/common/callback.c b/sim/common/callback.c
index c0a44078f6e..673e6e1ca04 100644
--- a/sim/common/callback.c
+++ b/sim/common/callback.c
@@ -361,13 +361,16 @@ os_read (p, fd, buf, len)
return result;
}
+/* Descriptors 0 / 1 / 2 might have been subject to freopen, as in
+ 27_io/objects/char/12048-[1-4].cc , and thus correspond to a different
+ host file descriptor. */
static int
os_read_stdin (p, buf, len)
host_callback *p;
char *buf;
int len;
{
- return wrap (p, read (0, buf, len));
+ os_read (p, 0, buf, len);
}
static int
@@ -433,10 +436,10 @@ os_write (p, fd, buf, len)
result = wrap (p, write (real_fd, buf, len));
break;
case 1:
- result = p->write_stdout (p, buf, len);
+ result = fwrite (buf, 1, len, stdout);
break;
case 2:
- result = p->write_stderr (p, buf, len);
+ result = fwrite (buf, 1, len, stderr);
break;
}
return result;
@@ -448,7 +451,7 @@ os_write_stdout (p, buf, len)
const char *buf;
int len;
{
- return fwrite (buf, 1, len, stdout);
+ os_write (p, 1, buf, len);
}
static void
@@ -464,7 +467,7 @@ os_write_stderr (p, buf, len)
const char *buf;
int len;
{
- return fwrite (buf, 1, len, stderr);
+ os_write (p, 2, buf, len);
}
static void
@@ -1136,21 +1139,3 @@ sim_cb_eprintf (host_callback *p, const char *fmt, ...)
p->evprintf_filtered (p, fmt, ap);
va_end (ap);
}
-
-int
-cb_is_stdin (host_callback *cb, int fd)
-{
- return fdbad (cb, fd) ? 0 : fdmap (cb, fd) == 0;
-}
-
-int
-cb_is_stdout (host_callback *cb, int fd)
-{
- return fdbad (cb, fd) ? 0 : fdmap (cb, fd) == 1;
-}
-
-int
-cb_is_stderr (host_callback *cb, int fd)
-{
- return fdbad (cb, fd) ? 0 : fdmap (cb, fd) == 2;
-}
diff --git a/sim/common/gennltvals.sh b/sim/common/gennltvals.sh
index ec4d49a1278..afb733d0204 100644
--- a/sim/common/gennltvals.sh
+++ b/sim/common/gennltvals.sh
@@ -20,7 +20,7 @@ $shell ${srccom}/gentvals.sh "" signal ${srcroot}/newlib/libc/include \
"signal.h sys/signal.h" 'SIG[A-Z0-9]*' "${cpp}"
$shell ${srccom}/gentvals.sh "arc" open ${srcroot}/newlib/libc/include \
- "../sys/arc/sys/fcntl.h" 'O_[A-Z0-9]*' "${cpp}"
+ "../sys/arc/sys/fcntl.h" 'O_[A-Z0-9]*' "${cpp}"
$shell ${srccom}/gentvals.sh "" open ${srcroot}/newlib/libc/include \
"fcntl.h sys/fcntl.h" 'O_[A-Z0-9]*' "${cpp}"
@@ -34,7 +34,7 @@ $shell ${srccom}/gentvals.sh "" open ${srcroot}/newlib/libc/include \
dir=libgloss/arc target=arc
$shell ${srccom}/gentvals.sh $target sys ${srcroot}/$dir \
- "syscall.h" 'SYS_[_A-Za-z0-9]*' "${cpp}"
+ "syscall.h" 'SYS_[_A-Za-z0-9]*' "${cpp}"
dir=newlib/libc/sys/d10v/sys target=d10v
$shell ${srccom}/gentvals.sh $target sys ${srcroot}/$dir \
diff --git a/sim/common/syscall.c b/sim/common/syscall.c
index b0b98b53f15..e2a1e0168d9 100644
--- a/sim/common/syscall.c
+++ b/sim/common/syscall.c
@@ -291,7 +291,11 @@ cb_syscall (cb, sc)
while (count > 0)
{
- if (cb_is_stdin (cb, fd))
+ /* ??? Actually making target descriptors 0 / 1 / 2 map directly
+ to stdin / stdout / stderr gets the semantics of freopen
+ wrong. When using default callbacks, this is re-mapped
+ in callback.c */
+ if (fd == 0)
result = (int) (*cb->read_stdin) (cb, buf,
(count < FILE_XFR_SIZE
? count : FILE_XFR_SIZE));
@@ -344,12 +348,20 @@ cb_syscall (cb, sc)
errcode = EINVAL;
goto FinishSyscall;
}
- if (cb_is_stdout(cb, fd))
+ /* Don't treat descriptors 0 / 1 / 2 specially, as their
+ meaning might have been changed by freopen, as in
+ 27_io/objects/char/12048-[1-4].cc . */
+
+ /* ??? Actually making target descriptors 0 / 1 / 2 map directly
+ to stdin / stdout / stderr gets the semantics of freopen
+ wrong. When using default callbacks, this is re-mapped
+ in callback.c */
+ if (fd == 1)
{
result = (int) (*cb->write_stdout) (cb, buf, bytes_read);
(*cb->flush_stdout) (cb);
}
- else if (cb_is_stderr(cb, fd))
+ else if (fd == 2)
{
result = (int) (*cb->write_stderr) (cb, buf, bytes_read);
(*cb->flush_stderr) (cb);