/* Simulation code for the CR16 processor.
- Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2008-2013 Free Software Foundation, Inc.
Contributed by M Ranga Swami Reddy <MR.Swami.Reddy@nsc.com>
This file is part of GDB, the GNU debugger.
void
OP_C_C ()
{
+ uint32 tmp;
+ uint16 a;
trace_input ("excp", OP_CONSTANT4, OP_VOID, OP_VOID);
switch (OP[0])
{
switch (FUNC)
{
#if !defined(__GO32__) && !defined(_WIN32)
+#ifdef TARGET_SYS_fork
case TARGET_SYS_fork:
trace_input ("<fork>", OP_VOID, OP_VOID, OP_VOID);
RETVAL (fork ());
trace_output_16 (result);
break;
+#endif
#define getpid() 47
case TARGET_SYS_getpid:
}
break;
+#ifdef TARGET_SYS_execve
case TARGET_SYS_execve:
trace_input ("<execve>", OP_VOID, OP_VOID, OP_VOID);
RETVAL (execve (MEMPTR (PARM1), (char **) MEMPTR (PARM2<<16|PARM3),
(char **)MEMPTR (PARM4)));
trace_output_16 (result);
break;
+#endif
#ifdef TARGET_SYS_execv
case TARGET_SYS_execv:
break;
#endif
+#ifdef TARGET_SYS_pipe
case TARGET_SYS_pipe:
{
reg_t buf;
trace_output_16 (result);
}
break;
+#endif
#ifdef TARGET_SYS_wait
case TARGET_SYS_wait:
trace_output_32 (result);
break;
+#ifdef TARGET_SYS_rename
case TARGET_SYS_rename:
trace_input ("<rename>", OP_MEMREF, OP_MEMREF, OP_VOID);
RETVAL (cr16_callback->rename (cr16_callback,
MEMPTR ((((unsigned long)PARM4)<<16) |PARM3)));
trace_output_16 (result);
break;
+#endif
case 0x408: /* REVISIT: Added a dummy getenv call. */
trace_input ("<getenv>", OP_MEMREF, OP_MEMREF, OP_VOID);
break;
#endif
+#ifdef TARGET_SYS_chown
case TARGET_SYS_chown:
trace_input ("<chown>", OP_VOID, OP_VOID, OP_VOID);
RETVAL (chown (MEMPTR (PARM1), PARM2, PARM3));
trace_output_16 (result);
break;
+#endif
case TARGET_SYS_chmod:
trace_input ("<chmod>", OP_VOID, OP_VOID, OP_VOID);
#endif
default:
- cr16_callback->error (cr16_callback, "Unknown syscall %d", FUNC);
+ a = OP[0];
+ switch (a)
+ {
+ case TRAP_BREAKPOINT:
+ State.exception = SIGTRAP;
+ tmp = (PC);
+ JMP(tmp);
+ trace_output_void ();
+ break;
+ case SIGTRAP: /* supervisor call ? */
+ State.exception = SIG_CR16_EXIT;
+ trace_output_void ();
+ break;
+ default:
+ cr16_callback->error (cr16_callback, "Unknown syscall %d", FUNC);
+ break;
+ }
}
-
if ((uint16) result == (uint16) -1)
RETERR (cr16_callback->get_errno(cr16_callback));
else