From 847fedc75430e599f848c457d76ec0085dc787fa Mon Sep 17 00:00:00 2001 From: Francois Berder <18538310+francois-berder@users.noreply.github.com> Date: Wed, 8 Jan 2020 21:17:50 +0000 Subject: [PATCH] cpu: mips_pic32_common: Handle UHI read Signed-off-by: Francois Berder <18538310+francois-berder@users.noreply.github.com> --- cpu/mips32r2_common/thread_arch.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cpu/mips32r2_common/thread_arch.c b/cpu/mips32r2_common/thread_arch.c index 26c1f79327..d6ee886f83 100644 --- a/cpu/mips32r2_common/thread_arch.c +++ b/cpu/mips32r2_common/thread_arch.c @@ -233,10 +233,15 @@ _mips_handle_exception(struct gpctx *ctx, int exception) irq_restore(status); return; } + else if (ctx->t2[1] == __MIPS_UHI_READ && ctx->a[0] == STDIN_FILENO) { + ctx->v[0] = stdio_read((void *)ctx->a[1], ctx->a[2]); + ctx->epc += 4; /* move PC past the syscall */ + return; + } else if (ctx->t2[1] == __MIPS_UHI_FSTAT && - (ctx->a[0] == STDOUT_FILENO || ctx->a[0] == STDERR_FILENO)) { + (ctx->a[0] == STDOUT_FILENO || ctx->a[0] == STDIN_FILENO || ctx->a[0] == STDERR_FILENO)) { /* - * Printf fstat's the stdout/stderr file so + * Printf fstat's the stdout/stdin/stderr file so * fill out a minimal struct stat. */ struct stat *sbuf = (struct stat *)ctx->a[1];