aboutsummaryrefslogtreecommitdiff
path: root/linux-user/arm/semihost.c
blob: 9554102a85514d3ac817947de3ba5910787304ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
 * ARM Semihosting Console Support
 *
 * Copyright (c) 2019 Linaro Ltd
 *
 * Currently ARM is unique in having support for semihosting support
 * in linux-user. So for now we implement the common console API but
 * just for arm linux-user.
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

#include "qemu/osdep.h"
#include "cpu.h"
#include "hw/semihosting/console.h"
#include "qemu.h"

int qemu_semihosting_console_out(CPUArchState *env, target_ulong addr, int len)
{
    void *s = lock_user_string(addr);
    len = write(STDERR_FILENO, s, len ? len : strlen(s));
    unlock_user(s, addr, 0);
    return len;
}