aboutsummaryrefslogtreecommitdiff
path: root/tests/tcg/multiarch/arm-compat-semi/semiconsole.c
blob: 1e2268f4b75e32baae9f755c3117a030c0a3fb35 (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
25
26
27
28
29
/*
 * linux-user semihosting console
 *
 * Copyright (c) 2024
 * Written by Alex Bennée <alex.bennee@linaro.org>
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

#define SYS_READC       0x07

#include <stdio.h>
#include <stdint.h>
#include "semicall.h"

int main(void)
{
    char c;

    printf("Semihosting Console Test\n");
    printf("hit X to exit:");

    do {
        c = __semi_call(SYS_READC, 0);
        printf("got '%c'\n", c);
    } while (c != 'X');

    return 0;
}