Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178180017
D62279.1796208917.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D62279.1796208917.diff
View Options
diff --git a/sys/powerpc/linux/linux_locore.asm b/sys/powerpc/linux/linux_locore.asm
--- a/sys/powerpc/linux/linux_locore.asm
+++ b/sys/powerpc/linux/linux_locore.asm
@@ -39,12 +39,9 @@
.globl linux_platform
.globl CNAME(linux_vdso_sigcode)
+/* LINUX_PLATFORM_LEN bytes, filled in by linux_vdso_install(). */
linux_platform:
-#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
- .asciz "ppc64le"
-#else
- .asciz "ppc64"
-#endif
+ .space 16
.text
diff --git a/sys/powerpc/linux/linux_sysvec.c b/sys/powerpc/linux/linux_sysvec.c
--- a/sys/powerpc/linux/linux_sysvec.c
+++ b/sys/powerpc/linux/linux_sysvec.c
@@ -77,6 +77,8 @@
MODULE_VERSION(linux64elf, 1);
#define LINUX_VDSOPAGE_SIZE PAGE_SIZE * 2
+/* Room for the AT_PLATFORM string, see linux_locore.asm. */
+#define LINUX_PLATFORM_LEN 16
#define LINUX_VDSOPAGE (VM_MAXUSER_ADDRESS - \
LINUX_VDSOPAGE_SIZE)
#define LINUX_SHAREDPAGE (LINUX_VDSOPAGE - PAGE_SIZE)
@@ -655,6 +657,31 @@
SYSINIT(elf_linux_exec_sysvec_init_v2, SI_SUB_EXEC + 1, SI_ORDER_ANY,
linux_exec_sysvec_init, &elf64_linux_sysvec_v2);
+/*
+ * Linux hands out the CPU family as AT_PLATFORM. The C library derives
+ * what __builtin_cpu_is() reports from it.
+ */
+static const char *
+linux_cpu_platform(void)
+{
+
+ if ((cpu_features2 & PPC_FEATURE2_ARCH_3_1) != 0)
+ return ("power10");
+ if ((cpu_features2 & PPC_FEATURE2_ARCH_3_00) != 0)
+ return ("power9");
+ if ((cpu_features2 & PPC_FEATURE2_ARCH_2_07) != 0)
+ return ("power8");
+ if ((cpu_features & PPC_FEATURE_ARCH_2_06) != 0)
+ return ("power7");
+ if ((cpu_features & PPC_FEATURE_ARCH_2_05) != 0)
+ return ("power6");
+ if ((cpu_features & PPC_FEATURE_POWER5_PLUS) != 0)
+ return ("power5+");
+ if ((cpu_features & PPC_FEATURE_POWER5) != 0)
+ return ("power5");
+ return ("power4");
+}
+
static void
linux_vdso_install(const void *param)
{
@@ -671,6 +698,9 @@
linux_vdso_obj = __elfN(linux_shared_page_init)
(&linux_vdso_mapping, LINUX_VDSOPAGE_SIZE);
bcopy(vdso_start, linux_vdso_mapping, linux_szsigcode);
+ strlcpy(linux_vdso_mapping +
+ ((uintptr_t)linux_platform - linux_vdso_base),
+ linux_cpu_platform(), LINUX_PLATFORM_LEN);
linux_vdso_reloc(linux_vdso_mapping, linux_vdso_base);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 2, 10:55 AM (18 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42141161
Default Alt Text
D62279.1796208917.diff (2 KB)
Attached To
Mode
D62279: linuxulator/powerpc: report the CPU family in AT_PLATFORM
Attached
Detach File
Event Timeline