From: Thomas Richter <tmricht@linux.vnet.ibm.com>
To: trinity@vger.kernel.org, davej@codemonkey.org.uk
Cc: brueckner@linux.vnet.ibm.com, schwidefsky@de.ibm.com,
heiko.carstens@de.ibm.com,
Thomas Richter <tmricht@linux.vnet.ibm.com>
Subject: [PATCH 4/4] trinity: Add support for s390_sthyi svc
Date: Tue, 13 Feb 2018 08:55:52 +0100 [thread overview]
Message-ID: <20180213075552.13932-4-tmricht@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180213075552.13932-1-tmricht@linux.vnet.ibm.com>
Add support for s390 specific system call s390_sthyi
for 31 bit and 64 bit.
Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
---
include/syscalls-s390.h | 2 +-
include/syscalls-s390x.h | 2 +-
syscalls/s390x/s390_sthyi.c | 60 +++++++++++++++++++++++++++++++++++++++++++++
syscalls/syscalls.h | 1 +
4 files changed, 63 insertions(+), 2 deletions(-)
create mode 100644 syscalls/s390x/s390_sthyi.c
diff --git a/include/syscalls-s390.h b/include/syscalls-s390.h
index ad2f88c6..07706650 100644
--- a/include/syscalls-s390.h
+++ b/include/syscalls-s390.h
@@ -391,5 +391,5 @@ struct syscalltable syscalls_s390[] = {
{ .entry = &syscall_pwritev2 },
{ .entry = &syscall_s390_guarded_storage },
{ .entry = &syscall_statx },
- { .entry = &syscall_ni_syscall }, /* TODO: s390_sthyi svc */
+ { .entry = &syscall_s390_sthyi },
};
diff --git a/include/syscalls-s390x.h b/include/syscalls-s390x.h
index a83974e4..66f3bc56 100644
--- a/include/syscalls-s390x.h
+++ b/include/syscalls-s390x.h
@@ -391,5 +391,5 @@ struct syscalltable syscalls_s390x[] = {
{ .entry = &syscall_pwritev2 },
{ .entry = &syscall_s390_guarded_storage },
{ .entry = &syscall_statx },
- { .entry = &syscall_ni_syscall }, /* TODO: s390_sthyi svc */
+ { .entry = &syscall_s390_sthyi },
};
diff --git a/syscalls/s390x/s390_sthyi.c b/syscalls/s390x/s390_sthyi.c
new file mode 100644
index 00000000..9bf488a9
--- /dev/null
+++ b/syscalls/s390x/s390_sthyi.c
@@ -0,0 +1,60 @@
+/*
+ * int s390_sthyi(unsigned long function_code, void *resp_buffer,
+ * uint64_t *return_code, unsigned long flags);
+ */
+
+#include <asm/sthyi.h>
+
+#include "arch.h"
+#include "random.h"
+#include "sanitise.h"
+
+static unsigned long syscall_s390_sthyi_arg1[] = {
+ STHYI_FC_CP_IFL_CAP,
+ -1
+};
+
+static u64 syscall_s390_sthyi_return_code;
+
+/* Allocate buffer. */
+static void sanitise_s390_sthyi(struct syscallrecord *rec)
+{
+ size_t size = RAND_RANGE(0, page_size);
+ void *addr = size ? malloc(size) : NULL;
+
+ rec->a2 = (unsigned long)addr;
+
+ /* Use NULL, random or valid address */
+ switch (rnd() % 3) {
+ case 0: rec->a3 = 0;
+ break;
+ case 1: rec->a3 = rnd();
+ break;
+ case 2: rec->a3 = (unsigned long)&syscall_s390_sthyi_return_code;
+ break;
+ }
+}
+
+/* Free buffer, freeptr takes care of NULL */
+static void post_s390_sthyi(struct syscallrecord *rec)
+{
+ freeptr(&rec->a2);
+}
+
+struct syscallentry syscall_s390_sthyi = {
+ .name = "s390_sthyi",
+ .sanitise = sanitise_s390_sthyi,
+ .post = post_s390_sthyi,
+ .num_args = 4,
+ .arg1name = "function_code",
+ .arg1type = ARG_LIST,
+ .arg1list = ARGLIST(syscall_s390_sthyi_arg1),
+ .arg2name = "resp_buffer",
+ .arg2type = ARG_NON_NULL_ADDRESS,
+ .arg3name = "return_code",
+ .arg3type = ARG_ADDRESS,
+ .arg4name = "resp_buffer",
+ .arg4type = ARG_RANGE,
+ .low4range = 0,
+ .hi4range = 128
+};
diff --git a/syscalls/syscalls.h b/syscalls/syscalls.h
index 38271170..3620c4ea 100644
--- a/syscalls/syscalls.h
+++ b/syscalls/syscalls.h
@@ -390,5 +390,6 @@ extern struct syscallentry syscall_runtime_instr;
extern struct syscallentry syscall_s390_pci_mmio_write;
extern struct syscallentry syscall_s390_pci_mmio_read;
extern struct syscallentry syscall_s390_guarded_storage;
+extern struct syscallentry syscall_s390_sthyi;
unsigned int random_fcntl_setfl_flags(void);
--
2.14.3
prev parent reply other threads:[~2018-02-13 7:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-13 7:55 [PATCH 1/4] trinity: Add support for runtime_instr svc Thomas Richter
2018-02-13 7:55 ` [PATCH 2/4] trinity: Add support for s390_pci_mmio_read and write Thomas Richter
2018-02-13 7:55 ` [PATCH 3/4] trinity: Add support for s390_guarded_storage svc Thomas Richter
2018-02-13 7:55 ` Thomas Richter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180213075552.13932-4-tmricht@linux.vnet.ibm.com \
--to=tmricht@linux.vnet.ibm.com \
--cc=brueckner@linux.vnet.ibm.com \
--cc=davej@codemonkey.org.uk \
--cc=heiko.carstens@de.ibm.com \
--cc=schwidefsky@de.ibm.com \
--cc=trinity@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).