From 5d2b2f1ab30013a26a4db8330fd0bdc8f0cc77f1 Mon Sep 17 00:00:00 2001 From: drahn Date: Sun, 2 May 2021 20:08:49 +0000 Subject: [PATCH] riscv64, fix HANDLE_ERROR the CERROR handling code had a gross mistake in that that it didn't continue processing the code after the macro if no error occurred. ok kettenis@ --- lib/libc/arch/riscv64/SYS.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/libc/arch/riscv64/SYS.h b/lib/libc/arch/riscv64/SYS.h index c3219d51a46..21fb4570a29 100644 --- a/lib/libc/arch/riscv64/SYS.h +++ b/lib/libc/arch/riscv64/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.1 2021/04/29 18:33:36 drahn Exp $ */ +/* $OpenBSD: SYS.h,v 1.2 2021/05/02 20:08:49 drahn Exp $ */ /*- * Copyright (c) 2020 Brian Bamsch * Copyright (c) 1990 The Regents of the University of California. @@ -56,12 +56,11 @@ #define CERROR _C_LABEL(__cerror) #define HANDLE_ERROR() \ - bnez t0, 1f; \ - ret; \ + beqz t0, 2f; \ 1: auipc t0, %got_pcrel_hi(CERROR); \ ld t1, %pcrel_lo(1b)(t0); \ - jr t1 - + jr t1; \ +2: #define _SYSCALL_NOERROR(x,y) \ SYSENTRY(x); \ SYSTRAP(y) -- 2.20.1