[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 04/10] pc-bios/s390-ccw: Add a write() functi
From: |
David Hildenbrand |
Subject: |
Re: [Qemu-devel] [PATCH v3 04/10] pc-bios/s390-ccw: Add a write() function for stdio |
Date: |
Tue, 11 Jul 2017 11:47:43 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 |
On 10.07.2017 17:32, Thomas Huth wrote:
> 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>
> Signed-off-by: Thomas Huth <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..f6466db 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 *buf, 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)
"buf" (above) vs. "str" here
> {
> - 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)
>
Reviewed-by: David Hildenbrand <address@hidden>
--
Thanks,
David
- [Qemu-devel] [PATCH v3 00/10] Implement network booting directly into the s390-ccw BIOS, Thomas Huth, 2017/07/10
- [Qemu-devel] [PATCH v3 01/10] pc-bios/s390-ccw: Move libc functions to separate header, Thomas Huth, 2017/07/10
- [Qemu-devel] [PATCH v3 02/10] pc-bios/s390-ccw: Move ebc2asc to sclp.c, Thomas Huth, 2017/07/10
- [Qemu-devel] [PATCH v3 03/10] pc-bios/s390-ccw: Move virtio-block related functions into a separate file, Thomas Huth, 2017/07/10
- [Qemu-devel] [PATCH v3 04/10] pc-bios/s390-ccw: Add a write() function for stdio, Thomas Huth, 2017/07/10
- Re: [Qemu-devel] [PATCH v3 04/10] pc-bios/s390-ccw: Add a write() function for stdio,
David Hildenbrand <=
- [Qemu-devel] [PATCH v3 05/10] pc-bios/s390-ccw: Move byteswap functions to a separate header, Thomas Huth, 2017/07/10
- [Qemu-devel] [PATCH v3 07/10] roms/SLOF: Update submodule to latest status, Thomas Huth, 2017/07/10
- [Qemu-devel] [PATCH v3 06/10] pc-bios/s390-ccw: Add code for virtio feature negotiation, Thomas Huth, 2017/07/10
- [Qemu-devel] [PATCH v3 08/10] pc-bios/s390-ccw: Add core files for the network bootloading program, Thomas Huth, 2017/07/10