Page MenuHomeFreeBSD

D13144.id35407.diff
No OneTemporary

D13144.id35407.diff

Index: sys/arm64/arm64/elf32_machdep.c
===================================================================
--- /dev/null
+++ sys/arm64/arm64/elf32_machdep.c
@@ -0,0 +1,38 @@
+/*-
+ * Copyright (c) 2017 Nuxi, https://nuxi.nl/
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#define __ELF_WORD_SIZE 32
+#include <sys/imgact_elf.h>
+
+void
+elf32_dump_thread(struct thread *td __unused, void *dst __unused,
+ size_t *off __unused)
+{
+
+}
Index: sys/arm64/arm64/freebsd32_machdep.c
===================================================================
--- /dev/null
+++ sys/arm64/arm64/freebsd32_machdep.c
@@ -0,0 +1,70 @@
+/*-
+ * Copyright (c) 2017 Nuxi, https://nuxi.nl/
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <compat/freebsd32/freebsd32_proto.h>
+
+/*
+ * Stubs for machine dependent 32-bits system calls.
+ */
+
+int
+freebsd32_getcontext(struct thread *td, struct freebsd32_getcontext_args *uap)
+{
+
+ return (ENOSYS);
+}
+
+int
+freebsd32_setcontext(struct thread *td, struct freebsd32_setcontext_args *uap)
+{
+
+ return (ENOSYS);
+}
+
+int
+freebsd32_sigreturn(struct thread *td, struct freebsd32_sigreturn_args *uap)
+{
+
+ return (ENOSYS);
+}
+
+int
+freebsd32_swapcontext(struct thread *td, struct freebsd32_swapcontext_args *uap)
+{
+
+ return (ENOSYS);
+}
+
+int
+freebsd32_sysarch(struct thread *td, struct freebsd32_sysarch_args *uap)
+{
+
+ return (ENOSYS);
+}
Index: sys/arm64/arm64/machdep.c
===================================================================
--- sys/arm64/arm64/machdep.c
+++ sys/arm64/arm64/machdep.c
@@ -26,6 +26,7 @@
*/
#include "opt_acpi.h"
+#include "opt_compat.h"
#include "opt_platform.h"
#include "opt_ddb.h"
@@ -277,6 +278,56 @@
return (EDOOFUS);
}
+#ifdef COMPAT_FREEBSD32
+int
+fill_regs32(struct thread *td, struct reg32 *regs)
+{
+
+ printf("ARM64TODO: fill_regs32");
+ return (EDOOFUS);
+}
+
+int
+set_regs32(struct thread *td, struct reg32 *regs)
+{
+
+ printf("ARM64TODO: set_regs32");
+ return (EDOOFUS);
+}
+
+int
+fill_fpregs32(struct thread *td, struct fpreg32 *regs)
+{
+
+ printf("ARM64TODO: fill_fpregs32");
+ return (EDOOFUS);
+}
+
+int
+set_fpregs32(struct thread *td, struct fpreg32 *regs)
+{
+
+ printf("ARM64TODO: set_fpregs32");
+ return (EDOOFUS);
+}
+
+int
+fill_dbregs32(struct thread *td, struct dbreg32 *regs)
+{
+
+ printf("ARM64TODO: fill_dbregs32");
+ return (EDOOFUS);
+}
+
+int
+set_dbregs32(struct thread *td, struct dbreg32 *regs)
+{
+
+ printf("ARM64TODO: set_dbregs32");
+ return (EDOOFUS);
+}
+#endif
+
int
ptrace_set_pc(struct thread *td, u_long addr)
{
Index: sys/arm64/include/elf.h
===================================================================
--- sys/arm64/include/elf.h
+++ sys/arm64/include/elf.h
@@ -36,7 +36,10 @@
#include <sys/elf32.h> /* Definitions common to all 32 bit architectures. */
#include <sys/elf64.h> /* Definitions common to all 64 bit architectures. */
+#ifndef __ELF_WORD_SIZE
#define __ELF_WORD_SIZE 64 /* Used by <sys/elf_generic.h> */
+#endif
+
#include <sys/elf_generic.h>
/*
@@ -97,10 +100,17 @@
#define AT_COUNT 27 /* Count of defined aux entry types. */
/* Define "machine" characteristics */
+#if __ELF_WORD_SIZE == 64
#define ELF_TARG_CLASS ELFCLASS64
#define ELF_TARG_DATA ELFDATA2LSB
#define ELF_TARG_MACH EM_AARCH64
#define ELF_TARG_VER 1
+#else
+#define ELF_TARG_CLASS ELFCLASS32
+#define ELF_TARG_DATA ELFDATA2LSB
+#define ELF_TARG_MACH EM_ARM
+#define ELF_TARG_VER 1
+#endif
#define ET_DYN_LOAD_ADDR 0x100000
Index: sys/arm64/include/param.h
===================================================================
--- sys/arm64/include/param.h
+++ sys/arm64/include/param.h
@@ -50,6 +50,9 @@
#ifndef MACHINE_ARCH
#define MACHINE_ARCH "aarch64"
#endif
+#ifndef MACHINE_ARCH32
+#define MACHINE_ARCH32 "armv6"
+#endif
#if defined(SMP) || defined(KLD_MODULE)
#ifndef MAXCPU
Index: sys/arm64/include/proc.h
===================================================================
--- sys/arm64/include/proc.h
+++ sys/arm64/include/proc.h
@@ -44,6 +44,7 @@
};
#define KINFO_PROC_SIZE 1088
+#define KINFO_PROC32_SIZE 816
#define MAXARGS 8
struct syscall_args {
Index: sys/arm64/include/reg.h
===================================================================
--- sys/arm64/include/reg.h
+++ sys/arm64/include/reg.h
@@ -41,16 +41,30 @@
uint32_t spsr;
};
+struct reg32 {
+ int dummy;
+};
+
struct fpreg {
__uint128_t fp_q[32];
uint32_t fp_sr;
uint32_t fp_cr;
};
+struct fpreg32 {
+ int dummy;
+};
+
struct dbreg {
int dummy;
};
+struct dbreg32 {
+ int dummy;
+};
+
+#define __HAVE_REG32
+
#ifdef _KERNEL
/*
* XXX these interfaces are MI, so they should be declared in a MI place.
@@ -61,6 +75,14 @@
int set_fpregs(struct thread *, struct fpreg *);
int fill_dbregs(struct thread *, struct dbreg *);
int set_dbregs(struct thread *, struct dbreg *);
+#ifdef COMPAT_FREEBSD32
+int fill_regs32(struct thread *, struct reg32 *);
+int set_regs32(struct thread *, struct reg32 *);
+int fill_fpregs32(struct thread *, struct fpreg32 *);
+int set_fpregs32(struct thread *, struct fpreg32 *);
+int fill_dbregs32(struct thread *, struct dbreg32 *);
+int set_dbregs32(struct thread *, struct dbreg32 *);
+#endif
#endif
#endif /* !_MACHINE_REG_H_ */
Index: sys/arm64/include/vdso.h
===================================================================
--- sys/arm64/include/vdso.h
+++ sys/arm64/include/vdso.h
@@ -34,4 +34,6 @@
#define VDSO_TH_ALGO_ARM_GENTIM VDSO_TH_ALGO_1
+#define VDSO_TIMEHANDS_MD32 VDSO_TIMEHANDS_MD
+
#endif /* !_MACHINE_VDSO_H_ */
Index: sys/conf/files.arm64
===================================================================
--- sys/conf/files.arm64
+++ sys/conf/files.arm64
@@ -96,8 +96,10 @@
arm64/arm64/disassem.c optional ddb
arm64/arm64/dump_machdep.c standard
arm64/arm64/efirt_machdep.c optional efirt
+arm64/arm64/elf32_machdep.c optional compat_freebsd32
arm64/arm64/elf_machdep.c standard
arm64/arm64/exception.S standard
+arm64/arm64/freebsd32_machdep.c optional compat_freebsd32
arm64/arm64/gicv3_its.c optional intrng fdt
arm64/arm64/gic_v3.c standard
arm64/arm64/gic_v3_fdt.c optional fdt
Index: sys/conf/options.arm64
===================================================================
--- sys/conf/options.arm64
+++ sys/conf/options.arm64
@@ -7,6 +7,9 @@
THUNDERX_PASS_1_1_ERRATA opt_global.h
VFP opt_global.h
+# Binary compatibility
+COMPAT_FREEBSD32 opt_compat.h
+
# EFI Runtime services support
EFIRT opt_efirt.h
Index: sys/sys/sysctl.h
===================================================================
--- sys/sys/sysctl.h
+++ sys/sys/sysctl.h
@@ -145,7 +145,7 @@
#define REQ_WIRED 2
/* definitions for sysctl_req 'flags' member */
-#if defined(__amd64__) || defined(__powerpc64__) ||\
+#if defined(__aarch64__) || defined(__amd64__) || defined(__powerpc64__) ||\
(defined(__mips__) && defined(__mips_n64))
#define SCTL_MASK32 1 /* 32 bit emulation */
#endif

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 27, 10:35 PM (15 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26264805
Default Alt Text
D13144.id35407.diff (9 KB)

Event Timeline