From 829d4b8508e67690f371dd3aebda1048d443ff86 Mon Sep 17 00:00:00 2001 From: krw Date: Fri, 4 Jun 2021 00:09:34 +0000 Subject: [PATCH] yasuoka@ pointed out that amd64 clang now understands '__attribute((ms_abi))', removing the need for the EFI_CALL abstraction. Nuke the amd64 EFI_CALL dance from all copies of eficall.h, remove eficall.S from the build. ok kettenis@ yasuoka@ --- sys/arch/amd64/stand/efiboot/bootx64/Makefile | 4 +- sys/arch/amd64/stand/efiboot/eficall.h | 38 +------------------ sys/arch/arm64/stand/efiboot/eficall.h | 38 +------------------ sys/arch/armv7/stand/efiboot/eficall.h | 38 +------------------ sys/arch/riscv64/stand/efiboot/eficall.h | 38 +------------------ sys/stand/efi/include/amd64/efibind.h | 2 +- 6 files changed, 7 insertions(+), 151 deletions(-) diff --git a/sys/arch/amd64/stand/efiboot/bootx64/Makefile b/sys/arch/amd64/stand/efiboot/bootx64/Makefile index c9bb38760f4..4bc51d5f705 100644 --- a/sys/arch/amd64/stand/efiboot/bootx64/Makefile +++ b/sys/arch/amd64/stand/efiboot/bootx64/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.3 2020/06/14 16:00:11 deraadt Exp $ +# $OpenBSD: Makefile,v 1.4 2021/06/04 00:09:34 krw Exp $ .include @@ -7,7 +7,7 @@ NOMAN= # OBJFMT= efi-app-x86_64 SOFTRAID= yes COPTS+= -I${EFIDIR}/include/amd64 -SRCS+= start_amd64.S run_i386.S mdrandom.c eficall.S +SRCS+= start_amd64.S run_i386.S mdrandom.c LDSCRIPT= ldscript.amd64 .include "${.CURDIR}/../Makefile.common" diff --git a/sys/arch/amd64/stand/efiboot/eficall.h b/sys/arch/amd64/stand/efiboot/eficall.h index 0e6276414ce..bf180894333 100644 --- a/sys/arch/amd64/stand/efiboot/eficall.h +++ b/sys/arch/amd64/stand/efiboot/eficall.h @@ -1,4 +1,4 @@ -/* $OpenBSD: eficall.h,v 1.3 2017/11/25 19:02:07 patrick Exp $ */ +/* $OpenBSD: eficall.h,v 1.4 2021/06/04 00:09:34 krw Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko @@ -16,40 +16,4 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#if !defined(__amd64__) - #define EFI_CALL(_func_, ...) (_func_)(__VA_ARGS__) - -#else - -extern uint64_t efi_call(int, void *, ...); - -#define _call_0(_func) \ - efi_call(0, (_func)) -#define _call_1(_func, _1) \ - efi_call(1, (_func), (_1)) -#define _call_2(_func, _1, _2) \ - efi_call(2, (_func), (_1), (_2)) -#define _call_3(_func, _1, _2, _3) \ - efi_call(3, (_func), (_1), (_2), (_3)) -#define _call_4(_func, _1, _2, _3, _4) \ - efi_call(4, (_func), (_1), (_2), (_3), (_4)) -#define _call_5(_func, _1, _2, _3, _4, _5) \ - efi_call(5, (_func), (_1), (_2), (_3), (_4), (_5)) -#define _call_6(_func, _1, _2, _3, _4, _5, _6) \ - efi_call(6, (_func), (_1), (_2), (_3), (_4), (_5), (_6)) -#define _call_7(_func, _1, _2, _3, _4, _5, _6, _7) \ - efi_call(7, (_func), (_1), (_2), (_3), (_4), (_5), (_6), (_7)) -#define _call_8(_func, _1, _2, _3, _4, _5, _6, _7, _8) \ - efi_call(8, (_func), (_1), (_2), (_3), (_4), (_5), (_6), (_7), (_8)) -#define _call_9(_func, _1, _2, _3, _4, _5, _6, _7, _8, _9) \ - efi_call(9, (_func), (_1), (_2), (_3), (_4), (_5), (_6), (_7), (_8), (_9)) -#define _call_10(_func, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \ - efi_call(10, (_func), (_1), (_2), (_3), (_4), (_5), (_6), (_7), (_8), (_9), (_10)) - -#define _efi_call_fn(_func, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _fn, ...) _fn - -#define EFI_CALL(...) \ - _efi_call_fn(__VA_ARGS__, _call_10, _call_9, _call_8, _call_7, _call_6, \ - _call_5, _call_4, _call_3, _call_2, _call_1, _call_0)(__VA_ARGS__) -#endif diff --git a/sys/arch/arm64/stand/efiboot/eficall.h b/sys/arch/arm64/stand/efiboot/eficall.h index dbf2e718a88..bf180894333 100644 --- a/sys/arch/arm64/stand/efiboot/eficall.h +++ b/sys/arch/arm64/stand/efiboot/eficall.h @@ -1,4 +1,4 @@ -/* $OpenBSD: eficall.h,v 1.3 2018/01/21 21:35:34 patrick Exp $ */ +/* $OpenBSD: eficall.h,v 1.4 2021/06/04 00:09:34 krw Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko @@ -16,40 +16,4 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#if !defined(__amd64__) - #define EFI_CALL(_func_, ...) (_func_)(__VA_ARGS__) - -#else - -extern uint64_t efi_call(int, void *, ...); - -#define _call_0(_func) \ - efi_call(0, (_func)) -#define _call_1(_func, _1) \ - efi_call(1, (_func), (_1)) -#define _call_2(_func, _1, _2) \ - efi_call(2, (_func), (_1), (_2)) -#define _call_3(_func, _1, _2, _3) \ - efi_call(3, (_func), (_1), (_2), (_3)) -#define _call_4(_func, _1, _2, _3, _4) \ - efi_call(4, (_func), (_1), (_2), (_3), (_4)) -#define _call_5(_func, _1, _2, _3, _4, _5) \ - efi_call(5, (_func), (_1), (_2), (_3), (_4), (_5)) -#define _call_6(_func, _1, _2, _3, _4, _5, _6) \ - efi_call(6, (_func), (_1), (_2), (_3), (_4), (_5), (_6)) -#define _call_7(_func, _1, _2, _3, _4, _5, _6, _7) \ - efi_call(7, (_func), (_1), (_2), (_3), (_4), (_5), (_6), (_7)) -#define _call_8(_func, _1, _2, _3, _4, _5, _6, _7, _8) \ - efi_call(8, (_func), (_1), (_2), (_3), (_4), (_5), (_6), (_7), (_8)) -#define _call_9(_func, _1, _2, _3, _4, _5, _6, _7, _8, _9) \ - efi_call(9, (_func), (_1), (_2), (_3), (_4), (_5), (_6), (_7), (_8), (_9)) -#define _call_10(_func, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \ - efi_call(10, (_func), (_1), (_2), (_3), (_4), (_5), (_6), (_7), (_8), (_9), (_10)) - -#define _efi_call_fn(_func, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _fn, ...) _fn - -#define EFI_CALL(...) \ - _efi_call_fn(__VA_ARGS__, _call_10, _call_9, _call_8, _call_7, _call_6, \ - _call_5, _call_4, _call_3, _call_2, _call_1, _call_0)(__VA_ARGS__) -#endif diff --git a/sys/arch/armv7/stand/efiboot/eficall.h b/sys/arch/armv7/stand/efiboot/eficall.h index a31763c7535..bf180894333 100644 --- a/sys/arch/armv7/stand/efiboot/eficall.h +++ b/sys/arch/armv7/stand/efiboot/eficall.h @@ -1,4 +1,4 @@ -/* $OpenBSD: eficall.h,v 1.3 2018/03/31 18:19:12 patrick Exp $ */ +/* $OpenBSD: eficall.h,v 1.4 2021/06/04 00:09:34 krw Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko @@ -16,40 +16,4 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#if !defined(__amd64__) - #define EFI_CALL(_func_, ...) (_func_)(__VA_ARGS__) - -#else - -extern uint64_t efi_call(int, void *, ...); - -#define _call_0(_func) \ - efi_call(0, (_func)) -#define _call_1(_func, _1) \ - efi_call(1, (_func), (_1)) -#define _call_2(_func, _1, _2) \ - efi_call(2, (_func), (_1), (_2)) -#define _call_3(_func, _1, _2, _3) \ - efi_call(3, (_func), (_1), (_2), (_3)) -#define _call_4(_func, _1, _2, _3, _4) \ - efi_call(4, (_func), (_1), (_2), (_3), (_4)) -#define _call_5(_func, _1, _2, _3, _4, _5) \ - efi_call(5, (_func), (_1), (_2), (_3), (_4), (_5)) -#define _call_6(_func, _1, _2, _3, _4, _5, _6) \ - efi_call(6, (_func), (_1), (_2), (_3), (_4), (_5), (_6)) -#define _call_7(_func, _1, _2, _3, _4, _5, _6, _7) \ - efi_call(7, (_func), (_1), (_2), (_3), (_4), (_5), (_6), (_7)) -#define _call_8(_func, _1, _2, _3, _4, _5, _6, _7, _8) \ - efi_call(8, (_func), (_1), (_2), (_3), (_4), (_5), (_6), (_7), (_8)) -#define _call_9(_func, _1, _2, _3, _4, _5, _6, _7, _8, _9) \ - efi_call(9, (_func), (_1), (_2), (_3), (_4), (_5), (_6), (_7), (_8), (_9)) -#define _call_10(_func, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \ - efi_call(10, (_func), (_1), (_2), (_3), (_4), (_5), (_6), (_7), (_8), (_9), (_10)) - -#define _efi_call_fn(_func, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _fn, ...) _fn - -#define EFI_CALL(...) \ - _efi_call_fn(__VA_ARGS__, _call_10, _call_9, _call_8, _call_7, _call_6, \ - _call_5, _call_4, _call_3, _call_2, _call_1, _call_0)(__VA_ARGS__) -#endif diff --git a/sys/arch/riscv64/stand/efiboot/eficall.h b/sys/arch/riscv64/stand/efiboot/eficall.h index 7c33b66d1c5..73226055d32 100644 --- a/sys/arch/riscv64/stand/efiboot/eficall.h +++ b/sys/arch/riscv64/stand/efiboot/eficall.h @@ -1,4 +1,4 @@ -/* $OpenBSD: eficall.h,v 1.1 2021/04/28 19:01:00 drahn Exp $ */ +/* $OpenBSD: eficall.h,v 1.2 2021/06/04 00:09:34 krw Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko @@ -16,40 +16,4 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#if !defined(__amd64__) - #define EFI_CALL(_func_, ...) (_func_)(__VA_ARGS__) - -#else - -extern uint64_t efi_call(int, void *, ...); - -#define _call_0(_func) \ - efi_call(0, (_func)) -#define _call_1(_func, _1) \ - efi_call(1, (_func), (_1)) -#define _call_2(_func, _1, _2) \ - efi_call(2, (_func), (_1), (_2)) -#define _call_3(_func, _1, _2, _3) \ - efi_call(3, (_func), (_1), (_2), (_3)) -#define _call_4(_func, _1, _2, _3, _4) \ - efi_call(4, (_func), (_1), (_2), (_3), (_4)) -#define _call_5(_func, _1, _2, _3, _4, _5) \ - efi_call(5, (_func), (_1), (_2), (_3), (_4), (_5)) -#define _call_6(_func, _1, _2, _3, _4, _5, _6) \ - efi_call(6, (_func), (_1), (_2), (_3), (_4), (_5), (_6)) -#define _call_7(_func, _1, _2, _3, _4, _5, _6, _7) \ - efi_call(7, (_func), (_1), (_2), (_3), (_4), (_5), (_6), (_7)) -#define _call_8(_func, _1, _2, _3, _4, _5, _6, _7, _8) \ - efi_call(8, (_func), (_1), (_2), (_3), (_4), (_5), (_6), (_7), (_8)) -#define _call_9(_func, _1, _2, _3, _4, _5, _6, _7, _8, _9) \ - efi_call(9, (_func), (_1), (_2), (_3), (_4), (_5), (_6), (_7), (_8), (_9)) -#define _call_10(_func, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \ - efi_call(10, (_func), (_1), (_2), (_3), (_4), (_5), (_6), (_7), (_8), (_9), (_10)) - -#define _efi_call_fn(_func, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _fn, ...) _fn - -#define EFI_CALL(...) \ - _efi_call_fn(__VA_ARGS__, _call_10, _call_9, _call_8, _call_7, _call_6, \ - _call_5, _call_4, _call_3, _call_2, _call_1, _call_0)(__VA_ARGS__) -#endif diff --git a/sys/stand/efi/include/amd64/efibind.h b/sys/stand/efi/include/amd64/efibind.h index 1d0dcd951c3..622cc63b508 100644 --- a/sys/stand/efi/include/amd64/efibind.h +++ b/sys/stand/efi/include/amd64/efibind.h @@ -160,7 +160,7 @@ typedef uint64_t UINTN; // #ifdef __amd64__ -#define EFIAPI /* Use EFI_CALL() macro in eficall.h */ +#define EFIAPI __attribute((ms_abi)) #endif #ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options -- 2.20.1