aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDmitry Chagin <dchagin@FreeBSD.org>2022-03-31 18:01:09 +0000
committerDmitry Chagin <dchagin@FreeBSD.org>2022-03-31 18:01:09 +0000
commitd5dc757e84d8dc1db987f3a17052e32621d6ea87 (patch)
treed4d93d44c8c73afbfc868d2327e0ea440e4fbcbd /sys
parent099fa2feb36fe6a68a87dfdb0f290b882139a88d (diff)
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/linux32/linux.h2
-rw-r--r--sys/amd64/linux32/linux32_sysvec.c3
-rw-r--r--sys/compat/linux/linux_misc.c5
3 files changed, 10 insertions, 0 deletions
diff --git a/sys/amd64/linux32/linux.h b/sys/amd64/linux32/linux.h
index f1f877181e47..1273ff485dd9 100644
--- a/sys/amd64/linux32/linux.h
+++ b/sys/amd64/linux32/linux.h
@@ -637,4 +637,6 @@ struct reg32;
void bsd_to_linux_regset32(const struct reg32 *b_reg,
struct linux_pt_regset32 *l_regset);
+extern bool linux32_emulate_i386;
+
#endif /* !_AMD64_LINUX_H_ */
diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c
index ff9ceda795cc..782ab2246061 100644
--- a/sys/amd64/linux32/linux32_sysvec.c
+++ b/sys/amd64/linux32/linux32_sysvec.c
@@ -885,6 +885,9 @@ SYSCTL_ULONG(_compat_linux32, OID_AUTO, maxssiz, CTLFLAG_RW,
static u_long linux32_maxvmem = LINUX32_MAXVMEM;
SYSCTL_ULONG(_compat_linux32, OID_AUTO, maxvmem, CTLFLAG_RW,
&linux32_maxvmem, 0, "");
+bool linux32_emulate_i386 = false;
+SYSCTL_BOOL(_compat_linux32, OID_AUTO, emulate_i386, CTLFLAG_RWTUN,
+ &linux32_emulate_i386, 0, "Emulate the real i386");
static void
linux32_fixlimit(struct rlimit *rl, int which)
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index f4ea92941720..0579ac1a03ce 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -720,6 +720,11 @@ linux_newuname(struct thread *td, struct linux_newuname_args *args)
* the string returned by getauxval(AT_PLATFORM) needs
* to remain "i686", though.
*/
+#if defined(COMPAT_LINUX32)
+ if (linux32_emulate_i386)
+ strlcpy(utsname.machine, "i686", LINUX_MAX_UTSNAME);
+ else
+#endif
strlcpy(utsname.machine, "x86_64", LINUX_MAX_UTSNAME);
#elif defined(__aarch64__)
strlcpy(utsname.machine, "aarch64", LINUX_MAX_UTSNAME);