Skip to contentSkip to conversation

s390x: Add linemode console

PATCH David Hildenbrand 1 participant 1 message Jan 10, 2019 1 message not in the archive s390

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 60 lines · Janosch Frank
Quoted 44 lines · David Hildenbrand
Quoted 43 lines · Janosch Frank
Quoted 21 lines · David Hildenbrand
Quoted 20 lines · Janosch Frank

z/VM isn't fond of vt220, so we need line mode when running under z/VM.

---
 lib/s390x/sclp-console.c | 178 ++++++++++++++++++++++++++++++++++++++++++-----
 lib/s390x/sclp.h         |  67 ++++++++++++++++++
 2 files changed, 228 insertions(+), 17 deletions(-)
lib/s390x/sclp-console.c +2 -0
index a5ef45f..6b30fab 100644
@@ -11,21 +11,167 @@
 #include <libcflat.h>
 #include <string.h>
 #include <asm/page.h>
+#include <asm/arch_def.h>
+#include <asm/io.h>
 #include "sclp.h"
 

[...]

Quoted 8 lines
Quoted 8 lines
lib/s390x/sclp-console.c +8 -0
+
+static void sclp_print_ascii(const char *str)
+{
+	int len = strlen(str);
+	WriteEventData *sccb = (void *)_sccb;
+
+	sclp_mark_busy();
+	memset(sccb, 0, sizeof(*sccb));
Quoted 8 lines

lib/s390x/sclp-console.c

Quoted 5 lines
lib/s390x/sclp-console.c +5 -0
+	sccb->h.length = sizeof(WriteEventData) + len;
+	sccb->h.function_code = SCLP_FC_NORMAL_WRITE;
+	sccb->ebh.length = sizeof(EventBufferHeader) + len;
+	sccb->ebh.type = SCLP_EVENT_ASCII_CONSOLE_DATA;
+	memcpy(sccb->data, str, len);

Soooo ... what would happen when printing more than 4000 + something characters? (same applies to lm below)

I wouldn't advise on that, because you'll overwrite memory and sclp might have a length limit. But that wasn't a problem before, was it?

Quoted 7 lines
Quoted 1 line

Do you plan on printing the memory in one go? :-)

Won't say it won't happen when somebody debugs/develops tests and gets strange side effects from printing. Wonder if we should simply cut it off to the supported size.

(And yes, this is already in existing code)

As the print functions have different max lengths for user data I'd print a warning and return after 2KB in sclp_print. Anything against that?

It's simple and 2KB ought to be enough for everyone (TM) and nobody keeps you from calling print multiple times instead.

Quoted 5 lines
if (strlen(str) > (1 << 11)) {
		sclp_print_ascii("Warning: Printing is limited to 2KB of data.");
		sclp_print_lm("Warning: Printing is limited to 2KB of data.");
		return;
	}

Yes, something like that might be the best thing to do!

Signature · 3 lines
Thanks,

David / dhildenb