diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2004-05-13 01:22:06 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2004-05-13 01:22:06 +0000 |
commit | c2ddd2679a54f0ebadcc7629383b6c7164fb98b2 (patch) | |
tree | 38130907e7003f26c633acadc268800c5511e772 | |
parent | 5499703f7b989678f72de9b87eec622c035eecdf (diff) |
test the spop1,,0 instructions
-rw-r--r-- | regress/sys/arch/hppa/Makefile | 4 | ||||
-rw-r--r-- | regress/sys/arch/hppa/sfuid/Makefile | 6 | ||||
-rw-r--r-- | regress/sys/arch/hppa/sfuid/sfuid.c | 55 |
3 files changed, 63 insertions, 2 deletions
diff --git a/regress/sys/arch/hppa/Makefile b/regress/sys/arch/hppa/Makefile index 95707a28681..64c15d68f55 100644 --- a/regress/sys/arch/hppa/Makefile +++ b/regress/sys/arch/hppa/Makefile @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile,v 1.1 2004/05/12 22:54:13 mickey Exp $ +# $OpenBSD: Makefile,v 1.2 2004/05/13 01:22:05 mickey Exp $ -SUBDIR+= probe +SUBDIR+= probe sfuid install: diff --git a/regress/sys/arch/hppa/sfuid/Makefile b/regress/sys/arch/hppa/sfuid/Makefile new file mode 100644 index 00000000000..df7cd7d999c --- /dev/null +++ b/regress/sys/arch/hppa/sfuid/Makefile @@ -0,0 +1,6 @@ +# $OpenBSD: Makefile,v 1.1 2004/05/13 01:22:05 mickey Exp $ + +PROG= sfuid + +.include <bsd.regress.mk> + diff --git a/regress/sys/arch/hppa/sfuid/sfuid.c b/regress/sys/arch/hppa/sfuid/sfuid.c new file mode 100644 index 00000000000..6c27e5b7a6a --- /dev/null +++ b/regress/sys/arch/hppa/sfuid/sfuid.c @@ -0,0 +1,55 @@ +/* $OpenBSD: sfuid.c,v 1.1 2004/05/13 01:22:05 mickey Exp $ */ + +/* + * Written by Michael Shalayeff, 2004. Public Domain. + */ + +#include <sys/param.h> +#include <signal.h> +#include <unistd.h> +#include <stdio.h> +#include <err.h> + +#define sfuid(i,r) __asm __volatile( \ + "spop1,%1,0 %0" : "=r" (r) : "i" (i)) + +volatile int sfu; + +void +sigill(int sig, siginfo_t *sip, void *scp) +{ + char buf[1024]; + + snprintf(buf, sizeof buf, "sfuid(%d) not decoded\n", sfu); + write(STDOUT_FILENO, buf, strlen(buf)); + _exit(1); +} + +int +main(int argc, char *argv[]) +{ + struct sigaction sa; + int rv; + + sa.sa_sigaction = &sigill; + sa.sa_flags = SA_SIGINFO; + sigemptyset(&sa.sa_mask); + sigaction(SIGILL, &sa, NULL); + +#define test_sfuid(i,rv) \ + rv = -1, sfu = i; \ + sfuid(i, rv); \ + if (rv != 0) \ + errx(1, "sfuid(%d) returned %d", i, rv); + + sfuid(0, rv); + sfuid(1, rv); + sfuid(2, rv); + sfuid(3, rv); + sfuid(4, rv); + sfuid(5, rv); + sfuid(6, rv); + sfuid(7, rv); + + exit(0); +} |