From 13f345cdecd3e208b9226e3b1dcc39737ab2881b Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Tue, 9 Jan 2024 19:37:42 +0000 Subject: [PATCH] powerpc64/SYS.h: implement _SYSCALL_BODY() macro Add _SYSCALL_BODY() macro which invokes the syscall via _SYCALL() and calls cerror as required. Use to implement PSEUDO() and RSYSCALL(). Reviewed by: jhibbits Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D43322 --- lib/libc/powerpc64/SYS.h | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/lib/libc/powerpc64/SYS.h b/lib/libc/powerpc64/SYS.h index dccd08b6354..bf8bc6cc0e2 100644 --- a/lib/libc/powerpc64/SYS.h +++ b/lib/libc/powerpc64/SYS.h @@ -40,11 +40,7 @@ li 0,(SYS_##name); \ sc -#define PSEUDO(name) \ - .text; \ - .align 2; \ -ENTRY(__sys_##name); \ - WEAK_REFERENCE(__sys_##name, _##name); \ +#define _SYSCALL_BODY(name) \ _SYSCALL(name); \ bnslr; \ mflr %r0; \ @@ -55,7 +51,14 @@ ENTRY(__sys_##name); \ addi %r1,%r1,48; \ ld %r0,16(%r1); \ mtlr %r0; \ - blr; \ + blr + +#define PSEUDO(name) \ + .text; \ + .align 2; \ +ENTRY(__sys_##name); \ + WEAK_REFERENCE(__sys_##name, _##name); \ + _SYSCALL_BODY(name); \ END(__sys_##name) #define RSYSCALL(name) \ @@ -64,16 +67,5 @@ END(__sys_##name) ENTRY(__sys_##name); \ WEAK_REFERENCE(__sys_##name, name); \ WEAK_REFERENCE(__sys_##name, _##name); \ - _SYSCALL(name); \ - bnslr; \ - \ - mflr %r0; \ - std %r0,16(%r1); \ - stdu %r1,-48(%r1); \ - bl CNAME(HIDENAME(cerror)); \ - nop; \ - addi %r1,%r1,48; \ - ld %r0,16(%r1); \ - mtlr %r0; \ - blr; \ + _SYSCALL_BODY(name); \ END(__sys_##name)