From 2061d658b3d199ec84976e6a573f68424369be69 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Sun, 22 Jan 2023 16:54:20 +0000 Subject: [dhcp] Simplify platform-specific client architecture definitions Move the platform-specific DHCP client architecture definitions to header files of the form . This simplifies the directory structure and allows the otherwise unused arch/$(ARCH)/include/$(PLATFORM) to be removed from the include directory search path, which avoids the confusing situation in which a header file may potentially be accessed through more than one path. For Linux userspace binaries on any architecture, use the EFI values for that architecture by delegating to the EFI header file. This avoids the need to explicitly select values for Linux userspace binaries for each architecture. Signed-off-by: Michael Brown --- src/arch/arm64/include/efi/ipxe/dhcp_arch.h | 40 ----------------------------- src/arch/arm64/include/ipxe/efi/dhcparch.h | 20 +++++++++++++++ 2 files changed, 20 insertions(+), 40 deletions(-) delete mode 100644 src/arch/arm64/include/efi/ipxe/dhcp_arch.h create mode 100644 src/arch/arm64/include/ipxe/efi/dhcparch.h (limited to 'src/arch/arm64/include') diff --git a/src/arch/arm64/include/efi/ipxe/dhcp_arch.h b/src/arch/arm64/include/efi/ipxe/dhcp_arch.h deleted file mode 100644 index bb26aae4d..000000000 --- a/src/arch/arm64/include/efi/ipxe/dhcp_arch.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2015 Michael Brown . - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - * - * You can also choose to distribute this program under the terms of - * the Unmodified Binary Distribution Licence (as given in the file - * COPYING.UBDL), provided that you have satisfied its requirements. - */ - -#ifndef _DHCP_ARCH_H -#define _DHCP_ARCH_H - -/** @file - * - * Architecture-specific DHCP options - */ - -FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); - -#include - -#define DHCP_ARCH_CLIENT_ARCHITECTURE DHCP_CLIENT_ARCHITECTURE_ARM64 - -#define DHCP_ARCH_CLIENT_NDI 1 /* UNDI */ , 3, 10 /* v3.10 */ - -#endif diff --git a/src/arch/arm64/include/ipxe/efi/dhcparch.h b/src/arch/arm64/include/ipxe/efi/dhcparch.h new file mode 100644 index 000000000..21d5a881b --- /dev/null +++ b/src/arch/arm64/include/ipxe/efi/dhcparch.h @@ -0,0 +1,20 @@ +#ifndef _IPXE_EFI_DHCPARCH_H +#define _IPXE_EFI_DHCPARCH_H + +/** @file + * + * DHCP client architecture definitions + * + */ + +FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); + +#include + +/** DHCP client architecture */ +#define DHCP_ARCH_CLIENT_ARCHITECTURE DHCP_CLIENT_ARCHITECTURE_ARM64 + +/** DHCP client network device interface */ +#define DHCP_ARCH_CLIENT_NDI 1 /* UNDI */ , 3, 10 /* v3.10 */ + +#endif /* _IPXE_EFI_DHCPARCH_H */ -- cgit v1.2.3-55-g7522 From c6901792f009cfd824707724b687e99edd4c8ecd Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Sun, 5 Feb 2023 23:55:14 +0000 Subject: [build] Allow for per-architecture unprefixed constant operand modifier Over the years, the undocumented operand modifier used to produce the unprefixed constant values in __einfo_error() has varied from "%c0" to "%a0" in commit 1a77466 ("[build] Fix use of inline assembly on GCC 4.8 ARM64 builds") and back to "%c0" in commit 3fb3ffc ("[build] Fix use of inline assembly on GCC 8 ARM64 builds"), according to the evolving demands of the toolchain. LoongArch64 suffers from a similar issue: GCC 13 will allow either, but the currently released GCC 12 allows only the "%a0" form. Introduce a macro ASM_NO_PREFIX, defined in bits/compiler.h, to abstract away this difference and allow different architectures to use different operand modifiers. Signed-off-by: Michael Brown --- src/arch/arm32/include/bits/compiler.h | 3 +++ src/arch/arm64/include/bits/compiler.h | 3 +++ src/arch/i386/include/bits/compiler.h | 3 +++ src/arch/x86_64/include/bits/compiler.h | 3 +++ src/include/errno.h | 4 ++-- 5 files changed, 14 insertions(+), 2 deletions(-) (limited to 'src/arch/arm64/include') diff --git a/src/arch/arm32/include/bits/compiler.h b/src/arch/arm32/include/bits/compiler.h index e420cf922..e119f0445 100644 --- a/src/arch/arm32/include/bits/compiler.h +++ b/src/arch/arm32/include/bits/compiler.h @@ -8,6 +8,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); #ifndef ASSEMBLY +/** Unprefixed constant operand modifier */ +#define ASM_NO_PREFIX "c" + #define __asmcall #define __libgcc diff --git a/src/arch/arm64/include/bits/compiler.h b/src/arch/arm64/include/bits/compiler.h index 3b129c2fd..b3e1b30a5 100644 --- a/src/arch/arm64/include/bits/compiler.h +++ b/src/arch/arm64/include/bits/compiler.h @@ -8,6 +8,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); #ifndef ASSEMBLY +/** Unprefixed constant operand modifier */ +#define ASM_NO_PREFIX "c" + #define __asmcall #define __libgcc diff --git a/src/arch/i386/include/bits/compiler.h b/src/arch/i386/include/bits/compiler.h index 87201135f..78c600428 100644 --- a/src/arch/i386/include/bits/compiler.h +++ b/src/arch/i386/include/bits/compiler.h @@ -8,6 +8,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); #ifndef ASSEMBLY +/** Unprefixed constant operand modifier */ +#define ASM_NO_PREFIX "c" + /** Declare a function with standard calling conventions */ #define __asmcall __attribute__ (( cdecl, regparm(0) )) diff --git a/src/arch/x86_64/include/bits/compiler.h b/src/arch/x86_64/include/bits/compiler.h index 5129f90d0..1c04a7b30 100644 --- a/src/arch/x86_64/include/bits/compiler.h +++ b/src/arch/x86_64/include/bits/compiler.h @@ -8,6 +8,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); #ifndef ASSEMBLY +/** Unprefixed constant operand modifier */ +#define ASM_NO_PREFIX "c" + /** Declare a function with standard calling conventions */ #define __asmcall __attribute__ (( regparm(0) )) diff --git a/src/include/errno.h b/src/include/errno.h index decde38ed..ac012a691 100644 --- a/src/include/errno.h +++ b/src/include/errno.h @@ -262,10 +262,10 @@ static inline void eplatform_discard ( int dummy __unused, ... ) {} ".balign 8\n\t" \ "\n1:\n\t" \ ".long ( 4f - 1b )\n\t" \ - ".long %c0\n\t" \ + ".long %" ASM_NO_PREFIX "0\n\t" \ ".long ( 2f - 1b )\n\t" \ ".long ( 3f - 1b )\n\t" \ - ".long %c1\n\t" \ + ".long %" ASM_NO_PREFIX "1\n\t" \ "\n2:\t.asciz \"" __einfo_desc ( einfo ) "\"\n\t" \ "\n3:\t.asciz \"" __FILE__ "\"\n\t" \ ".balign 8\n\t" \ -- cgit v1.2.3-55-g7522