Re: [edk2-test PATCH v1 2/2] SctPkg: Enable RISCV64 support using AARCH64 sources


Heinrich Schuchardt
 

On 09.02.21 13:42, Leif Lindholm wrote:
On Mon, Feb 08, 2021 at 18:04:45 +0100, Heinrich Schuchardt wrote:
diff --git a/uefi-sct/SctPkg/SCRT/SCRTApp/Riscv64/GoVirtual.S
b/uefi-sct/SctPkg/SCRT/SCRTApp/Riscv64/GoVirtual.S
new file mode 100644
index 00000000..8bc2c624
--- /dev/null
+++ b/uefi-sct/SctPkg/SCRT/SCRTApp/Riscv64/GoVirtual.S
@@ -0,0 +1,45 @@
+## @file
+#
+#  Copyright 2010 - 2012 Unified EFI, Inc.<BR>
+#  Copyright (c) 2012, ARM Ltd. All rights reserved.<BR>
+#  Copyright (c) 2020, Hewlett Packard Enterprise Development LP.<BR>
+#
+#  This program and the accompanying materials
+#  are licensed and made available under the terms and conditions of
the BSD License
+#  which accompanies this distribution.  The full text of the
license may be found at
+#  http://opensource.org/licenses/bsd-license.php
+#
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
BASIS,
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS
OR IMPLIED.
+#
+##
+#
+#
+#/*++
+#
+# Module Name:
+#
+#  GoVirtual.S
+#
+#--*/
+#start of the code section
+.text
+/* FIXME: Should alignment be different on Aarch64? */
1) FIXME
2) Aarch64.
I have no idea why the alignment would be 3 on other platforms, so I
don't know how to fix it.
If anyone knows more, please let me know. I'll just change the comment
to say Riscv64.

+.align 3
Both on Aarch64 and on RISC-V an odd alignment value makes no sense.

.align 8 should do no harm. But is it needed?
The glory of the GAS .align directive is that its meaning differs
between architectures and executable formats. On ARM/AArch64, as well
as on RISC-V (I think?) the alignment is described as a power of 2.

So .align 3 on ARM and others are the same as .align 8 on x86 (ELF)
and others.

(It might not be a bad idea to start replacing .align directives with
.baligh to reduce confusion.)
Thanks for pointing out the different meanings of .align. They are
documented in binutils-2.36/gas/doc/as.info chapter 7.3.

.balign is GNU assembler specific.

Do we have to consider other assemblers here?

Best regards

Heinrich


I haven't looked into whether 8-byte alignment is actually required by
the code here.

/
Leif

Join {devel@edk2.groups.io to automatically receive all group messages.