diff options
author | Mike Frysinger <vapier@gentoo.org> | 2021-04-18 20:53:03 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2021-04-18 21:22:31 -0400 |
commit | 7da5cf78fb1ba3e93cc5e79cf5084bd2b03f0fcf (patch) | |
tree | 6b5e493e21e20d52d35e251c11acf48b78919e31 | |
parent | d3b0ab8b36319f4232367b046ecfc0c656a177ad (diff) | |
download | gdb-7da5cf78fb1ba3e93cc5e79cf5084bd2b03f0fcf.zip gdb-7da5cf78fb1ba3e93cc5e79cf5084bd2b03f0fcf.tar.gz gdb-7da5cf78fb1ba3e93cc5e79cf5084bd2b03f0fcf.tar.bz2 |
sim: syscall: add getpid support
Hoist the Blackfin implementation up to the common one.
-rw-r--r-- | sim/bfin/ChangeLog | 4 | ||||
-rw-r--r-- | sim/bfin/interp.c | 4 | ||||
-rw-r--r-- | sim/common/ChangeLog | 4 | ||||
-rw-r--r-- | sim/common/syscall.c | 4 | ||||
-rw-r--r-- | sim/testsuite/bfin/ChangeLog | 4 | ||||
-rw-r--r-- | sim/testsuite/bfin/getpid.c | 18 |
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; +} |