sim: syscall: add getpid support

Hoist the Blackfin implementation up to the common one.
This commit is contained in:
Mike Frysinger 2021-04-18 20:53:03 -04:00
parent d3b0ab8b36
commit 7da5cf78fb
6 changed files with 34 additions and 4 deletions

View File

@ -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.

View File

@ -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. */

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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;
}