[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 21/40] pc-bios/s390-ccw: Add a write() function for s
From: |
Christian Borntraeger |
Subject: |
[Qemu-devel] [PULL 21/40] pc-bios/s390-ccw: Add a write() function for stdio |
Date: |
Fri, 14 Jul 2017 12:40:48 +0200 |
From: Thomas Huth <address@hidden>
The stdio functions from the SLOF libc need a write() function for
printing text to stdout/stderr. Let's implement this function by
refactoring the code from sclp_print().
Acked-by: Cornelia Huck <address@hidden>
Reviewed-by: David Hildenbrand <address@hidden>
Signed-off-by: Thomas Huth <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Christian Borntraeger <address@hidden>
---
pc-bios/s390-ccw/sclp.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/pc-bios/s390-ccw/sclp.c b/pc-bios/s390-ccw/sclp.c
index 2ee204a..b1fc8ff 100644
--- a/pc-bios/s390-ccw/sclp.c
+++ b/pc-bios/s390-ccw/sclp.c
@@ -12,6 +12,8 @@
#include "s390-ccw.h"
#include "sclp.h"
+long write(int fd, const void *str, size_t len);
+
static char _sccb[PAGE_SIZE] __attribute__((__aligned__(4096)));
const unsigned char ebc2asc[256] =
@@ -71,11 +73,14 @@ static int _strlen(const char *str)
return i;
}
-void sclp_print(const char *str)
+long write(int fd, const void *str, size_t len)
{
- int len = _strlen(str);
WriteEventData *sccb = (void *)_sccb;
+ if (fd != 1 && fd != 2) {
+ return -EIO;
+ }
+
sccb->h.length = sizeof(WriteEventData) + len;
sccb->h.function_code = SCLP_FC_NORMAL_WRITE;
sccb->ebh.length = sizeof(EventBufferHeader) + len;
@@ -84,6 +89,13 @@ void sclp_print(const char *str)
memcpy(sccb->data, str, len);
sclp_service_call(SCLP_CMD_WRITE_EVENT_DATA, sccb);
+
+ return len;
+}
+
+void sclp_print(const char *str)
+{
+ write(1, str, _strlen(str));
}
void sclp_get_loadparm_ascii(char *loadparm)
--
2.7.4
- [Qemu-devel] [PULL 15/40] s390x/css: add ORB to SubchDev, (continued)
- [Qemu-devel] [PULL 15/40] s390x/css: add ORB to SubchDev, Christian Borntraeger, 2017/07/14
- [Qemu-devel] [PULL 37/40] s390x/kvm: Enable KSS facility for nested virtualization, Christian Borntraeger, 2017/07/14
- [Qemu-devel] [PULL 14/40] s390x/css: add missing css state conditionally, Christian Borntraeger, 2017/07/14
- [Qemu-devel] [PULL 30/40] pc-bios/s390: rebuild s390-ccw.img, Christian Borntraeger, 2017/07/14
- [Qemu-devel] [PULL 13/40] s390x: add css_migration_enabled to machine class, Christian Borntraeger, 2017/07/14
- [Qemu-devel] [PULL 09/40] s390x/flic: introduce inject_airq callback, Christian Borntraeger, 2017/07/14
- [Qemu-devel] [PULL 11/40] s390x/css: update css_adapter_interrupt, Christian Borntraeger, 2017/07/14
- [Qemu-devel] [PULL 08/40] s390x/flic: introduce modify_ais_mode callback, Christian Borntraeger, 2017/07/14
- [Qemu-devel] [PULL 21/40] pc-bios/s390-ccw: Add a write() function for stdio,
Christian Borntraeger <=
- [Qemu-devel] [PULL 32/40] s390x/cpumodel: add zpci, aen and ais facilities, Christian Borntraeger, 2017/07/14
- [Qemu-devel] [PULL 24/40] pc-bios/s390-ccw: Add code for virtio feature negotiation, Christian Borntraeger, 2017/07/14
- [Qemu-devel] [PULL 31/40] s390x: initialize cpu firstly, Christian Borntraeger, 2017/07/14
- [Qemu-devel] [PULL 16/40] s390x/css: activate ChannelSubSys migration, Christian Borntraeger, 2017/07/14
- [Qemu-devel] [PULL 34/40] s390x/cpumodel: wire up new hardware features, Christian Borntraeger, 2017/07/14