aboutsummaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
Diffstat (limited to 'sim')
-rw-r--r--sim/bfin/ChangeLog4
-rw-r--r--sim/bfin/interp.c4
-rw-r--r--sim/common/ChangeLog4
-rw-r--r--sim/common/syscall.c4
-rw-r--r--sim/testsuite/bfin/ChangeLog4
-rw-r--r--sim/testsuite/bfin/getpid.c18
6 files changed, 34 insertions, 4 deletions
diff --git a/sim/bfin/ChangeLog b/sim/bfin/ChangeLog
index 2a48fe1..51d48b8 100644
--- a/sim/bfin/ChangeLog
+++ b/sim/bfin/ChangeLog
@@ -1,3 +1,7 @@
+2021-04-18 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (bfin_syscall): Delete CB_SYS_getpid handling.
+
2021-04-12 Mike Frysinger <vapier@gentoo.org>
* interp.c (sim_open): Delete 3rd arg to sim_cpu_alloc_all.
diff --git a/sim/bfin/interp.c b/sim/bfin/interp.c
index 747898c..49388e7 100644
--- a/sim/bfin/interp.c
+++ b/sim/bfin/interp.c
@@ -457,10 +457,6 @@ bfin_syscall (SIM_CPU *cpu)
sc.result = setgid (sc.arg1);
goto sys_finish;
- case CB_SYS_getpid:
- tbuf += sprintf (tbuf, "getpid()");
- sc.result = getpid ();
- goto sys_finish;
case CB_SYS_kill:
tbuf += sprintf (tbuf, "kill(%u, %i)", args[0], args[1]);
/* Only let the app kill itself. */
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index c8782d7..b1af152 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,7 @@
+2021-04-18 Mike Frysinger <vapier@gentoo.org>
+
+ * syscall.c (cb_syscall): Implement CB_SYS_getpid.
+
2021-04-15 John Baldwin <jhb@FreeBSD.org>
* Make-common.in (CONFIG_CFLAGS): Remove SIM_EXTRA_CFLAGS.
diff --git a/sim/common/syscall.c b/sim/common/syscall.c
index fbe8021..f2883c4 100644
--- a/sim/common/syscall.c
+++ b/sim/common/syscall.c
@@ -578,6 +578,10 @@ cb_syscall (host_callback *cb, CB_SYSCALL *sc)
}
break;
+ case CB_SYS_getpid:
+ result = getpid ();
+ break;
+
case CB_SYS_time :
{
/* FIXME: May wish to change CB_SYS_time to something else.
diff --git a/sim/testsuite/bfin/ChangeLog b/sim/testsuite/bfin/ChangeLog
index 2abca7e..ea617e3 100644
--- a/sim/testsuite/bfin/ChangeLog
+++ b/sim/testsuite/bfin/ChangeLog
@@ -1,3 +1,7 @@
+2021-04-18 Mike Frysinger <vapier@gentoo.org>
+
+ * getpid.c: New test.
+
2021-04-08 Mike Frysinger <vapier@gentoo.org>
* allinsn.exp (arch): Delete.
diff --git a/sim/testsuite/bfin/getpid.c b/sim/testsuite/bfin/getpid.c
new file mode 100644
index 0000000..11d5c50
--- /dev/null
+++ b/sim/testsuite/bfin/getpid.c
@@ -0,0 +1,18 @@
+/* Basic getpid tests.
+# mach: bfin
+# cc: -msim
+*/
+
+#include <stdio.h>
+#include <unistd.h>
+
+int main(int argc, char *argv[])
+{
+ pid_t pid = getpid();
+ if (pid < 0) {
+ perror("getpid failed");
+ return 1;
+ }
+ puts("pass");
+ return 0;
+}