summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorart <art@openbsd.org>2001-02-03 23:32:13 +0000
committerart <art@openbsd.org>2001-02-03 23:32:13 +0000
commitd3b4fdf1f5e3a8c187c0136dfb403d1eed96db9e (patch)
treeaacd2f0409a32d132fea31ba65d1c2ac95d477d7
parentRemove even more dead code. (diff)
downloadwireguard-openbsd-d3b4fdf1f5e3a8c187c0136dfb403d1eed96db9e.tar.xz
wireguard-openbsd-d3b4fdf1f5e3a8c187c0136dfb403d1eed96db9e.zip
Do a check for the OpenBSD note before doing any emulation probes.
This way OpenBSD will be explicitly treated first and not handled as a fallback. This should speed archs with many emulations.
-rw-r--r--sys/kern/exec_elf64.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/kern/exec_elf64.c b/sys/kern/exec_elf64.c
index 7c62c1cc7e8..11737344b1f 100644
--- a/sys/kern/exec_elf64.c
+++ b/sys/kern/exec_elf64.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_elf64.c,v 1.11 2001/01/22 14:25:03 art Exp $ */
+/* $OpenBSD: exec_elf64.c,v 1.12 2001/02/03 23:32:13 art Exp $ */
/*
* Copyright (c) 1996 Per Fogelstrom
@@ -143,7 +143,6 @@ struct emul emul_elf64 = {
esigcode,
};
-
/*
* Copy arguments onto the stack in the normal way, but add some
* space for extra information in case of dynamic binding.
@@ -298,7 +297,7 @@ elf64_load_psection(vcset, vp, ph, addr, size, prot)
psize = trunc_page(*size);
NEW_VMCMD(vcset, vmcmd_map_pagedvn, psize, *addr, vp,
offset, *prot);
- if(psize != *size) {
+ if (psize != *size) {
NEW_VMCMD(vcset, vmcmd_map_readvn, *size - psize,
*addr + psize, vp, offset + psize, *prot);
}
@@ -541,6 +540,12 @@ exec_elf64_makecmds(p, epp)
*/
error = ENOEXEC;
p->p_os = OOS_OPENBSD;
+
+#ifdef NATIVE_EXEC_ELF
+ if (elf64_os_pt_note(p, epp, epp->ep_hdr, "OpenBSD", 8, 4) == 0) {
+ goto native;
+ }
+#endif
for (i = 0; i < sizeof elf64_probes / sizeof elf64_probes[0] && error;
i++)
if (os == OOS_NULL || ((1 << os) & elf64_probes[i].os_mask))
@@ -554,6 +559,7 @@ exec_elf64_makecmds(p, epp)
goto bad;
#endif /* NATIVE_EXEC_ELF */
+native:
/*
* Load all the necessary sections
*/