1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

cpu: mips32r2_common: Use stdio_uart to handle UHI write syscalls

Signed-off-by: Francois Berder <18538310+francois-berder@users.noreply.github.com>
This commit is contained in:
Francois Berder 2019-09-18 10:27:34 +01:00
parent 738550e28c
commit 1673f890ec

View File

@ -17,9 +17,8 @@
#include "cpu.h" #include "cpu.h"
#include "irq.h" #include "irq.h"
#include "cpu_conf.h" #include "cpu_conf.h"
#include "periph_conf.h" /* for debug uart number */
#include "periph/uart.h"
#include "malloc.h" #include "malloc.h"
#include "stdio_uart.h"
#define STACK_END_PAINT (0xdeadc0de) #define STACK_END_PAINT (0xdeadc0de)
#define C0_STATUS_EXL (2) #define C0_STATUS_EXL (2)
@ -216,7 +215,7 @@ _mips_handle_exception(struct gpctx *ctx, int exception)
syscall_num = (mem_rw((const void *)ctx->epc) >> 6) & 0xFFFF; syscall_num = (mem_rw((const void *)ctx->epc) >> 6) & 0xFFFF;
#endif #endif
#ifdef DEBUG_VIA_UART #ifdef MODULE_STDIO_UART
#include <mips/uhi_syscalls.h> #include <mips/uhi_syscalls.h>
/* /*
* intercept UHI write syscalls (printf) which would normally * intercept UHI write syscalls (printf) which would normally
@ -228,7 +227,7 @@ _mips_handle_exception(struct gpctx *ctx, int exception)
if (ctx->t2[1] == __MIPS_UHI_WRITE && if (ctx->t2[1] == __MIPS_UHI_WRITE &&
(ctx->a[0] == STDOUT_FILENO || ctx->a[0] == STDERR_FILENO)) { (ctx->a[0] == STDOUT_FILENO || ctx->a[0] == STDERR_FILENO)) {
uint32_t status = irq_disable(); uint32_t status = irq_disable();
uart_write(DEBUG_VIA_UART, (uint8_t *)ctx->a[1], ctx->a[2]); stdio_write((void *)ctx->a[1], ctx->a[2]);
ctx->v[0] = ctx->a[2]; ctx->v[0] = ctx->a[2];
ctx->epc += 4; /* move PC past the syscall */ ctx->epc += 4; /* move PC past the syscall */
irq_restore(status); irq_restore(status);