Skip to content

Commit e7ed690

Browse files
[do-not-upstream][semihost] Revert "semihost: ARM semihosting 'open' doesn't support stdin"
This reverts commit [81e6fa2](picolibc@81e6fa2) As This commit introduced a workaround specifically for ARM that is no longer necessary or desirable. Signed-off-by: Mostafa Salman <[email protected]>
1 parent fd819e4 commit e7ed690

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

semihost/mapstdio.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,21 @@
4242
#include <errno.h>
4343
#include <stdbool.h>
4444

45-
static int fd_stdout, fd_stderr;
45+
static int fd_stdin, fd_stdout, fd_stderr;
4646
static bool _check_done;
4747

4848
int
4949
_map_stdio(int fd)
5050
{
5151
if (!_check_done) {
5252
_check_done = true;
53+
fd_stdin = sys_semihost_open(":tt", 0);
5354
fd_stdout = sys_semihost_open(":tt", 4);
5455
fd_stderr = sys_semihost_open(":tt", 8);
5556
}
5657
switch (fd) {
5758
case 0:
58-
return -1;
59+
return fd_stdin;
5960
case 1:
6061
return fd_stdout;
6162
case 2:

semihost/read.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@
4444
ssize_t
4545
read(int fd, void *buf, size_t count)
4646
{
47-
if (fd == 0) {
48-
int ch = sys_semihost_getc((FILE *) 0);
49-
*(char *) buf = ch;
50-
return 1;
51-
}
5247
fd = _map_stdio(fd);
5348
uintptr_t ret = sys_semihost_read(fd, buf, count);
5449

0 commit comments

Comments
 (0)