summaryrefslogtreecommitdiffstats
path: root/sys/alpha
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2002-07-20 02:56:12 +0000
committerpeter <peter@FreeBSD.org>2002-07-20 02:56:12 +0000
commitcc7b2e42482d2eb35468c5dd11903248b12692b2 (patch)
tree442882c197085f1177ad99039e6387b24c60e44a /sys/alpha
parentc458732bcf221adf5c81f68d8d9044444c901a54 (diff)
downloadFreeBSD-src-cc7b2e42482d2eb35468c5dd11903248b12692b2.zip
FreeBSD-src-cc7b2e42482d2eb35468c5dd11903248b12692b2.tar.gz
Infrastructure tweaks to allow having both an Elf32 and an Elf64 executable
handler in the kernel at the same time. Also, allow for the exec_new_vmspace() code to build a different sized vmspace depending on the executable environment. This is a big help for execing i386 binaries on ia64. The ELF exec code grows the ability to map partial pages when there is a page size difference, eg: emulating 4K pages on 8K or 16K hardware pages. Flesh out the i386 emulation support for ia64. At this point, the only binary that I know of that fails is cvsup, because the cvsup runtime tries to execute code in pages not marked executable. Obtained from: dfr (mostly, many tweaks from me).
Diffstat (limited to 'sys/alpha')
-rw-r--r--sys/alpha/alpha/elf_machdep.c40
-rw-r--r--sys/alpha/linux/linux_sysvec.c10
-rw-r--r--sys/alpha/osf1/imgact_osf1.c2
3 files changed, 46 insertions, 6 deletions
diff --git a/sys/alpha/alpha/elf_machdep.c b/sys/alpha/alpha/elf_machdep.c
index ebd3b60..8e443e7 100644
--- a/sys/alpha/alpha/elf_machdep.c
+++ b/sys/alpha/alpha/elf_machdep.c
@@ -32,9 +32,47 @@
#include <sys/proc.h>
#include <sys/namei.h>
#include <sys/fcntl.h>
+#include <sys/sysent.h>
+#include <sys/imgact_elf.h>
+#include <sys/syscall.h>
+#include <sys/signalvar.h>
#include <sys/vnode.h>
#include <sys/linker.h>
#include <machine/elf.h>
+#include <machine/md_var.h>
+
+struct sysentvec elf64_freebsd_sysvec = {
+ SYS_MAXSYSCALL,
+ sysent,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ elf64_freebsd_fixup,
+ sendsig,
+ sigcode,
+ &szsigcode,
+ 0,
+ "FreeBSD ELF64",
+ __elfN(coredump),
+ NULL,
+ MINSIGSTKSZ
+};
+
+static Elf64_Brandinfo freebsd_brand_info = {
+ ELFOSABI_FREEBSD,
+ EM_ALPHA,
+ "FreeBSD",
+ "",
+ "/usr/libexec/ld-elf.so.1",
+ &elf64_freebsd_sysvec
+ };
+
+SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_ANY,
+ (sysinit_cfunc_t) elf64_insert_brand_entry,
+ &freebsd_brand_info);
/* Process one elf relocation with addend. */
int
@@ -85,7 +123,7 @@ elf_reloc(linker_file_t lf, const void *data, int type)
addr = elf_lookup(lf, symidx, 1);
if (addr == 0)
return -1;
- addr += addend;
+ addr += addend;
if (*where != addr)
*where = addr;
break;
diff --git a/sys/alpha/linux/linux_sysvec.c b/sys/alpha/linux/linux_sysvec.c
index bedb8bf..52af25f 100644
--- a/sys/alpha/linux/linux_sysvec.c
+++ b/sys/alpha/linux/linux_sysvec.c
@@ -189,13 +189,14 @@ struct sysentvec elf_linux_sysvec = {
&linux_szsigcode,
0,
"Linux ELF",
- elf_coredump,
+ elf64_coredump,
exec_linux_imgact_try,
LINUX_MINSIGSTKSZ
};
static Elf64_Brandinfo linux_brand = {
ELFOSABI_LINUX,
+ EM_ALPHA,
"Linux",
"/compat/linux",
"/lib/ld-linux.so.1",
@@ -204,6 +205,7 @@ static Elf64_Brandinfo linux_brand = {
static Elf64_Brandinfo linux_glibc2brand = {
ELFOSABI_LINUX,
+ EM_ALPHA,
"Linux",
"/compat/linux",
"/lib/ld-linux.so.2",
@@ -229,7 +231,7 @@ linux_elf_modevent(module_t mod, int type, void *data)
case MOD_LOAD:
for (brandinfo = &linux_brandlist[0]; *brandinfo != NULL;
++brandinfo)
- if (elf_insert_brand_entry(*brandinfo) < 0)
+ if (elf64_insert_brand_entry(*brandinfo) < 0)
error = EINVAL;
if (error == 0) {
SET_FOREACH(lihp, linux_ioctl_handler_set)
@@ -242,12 +244,12 @@ linux_elf_modevent(module_t mod, int type, void *data)
case MOD_UNLOAD:
for (brandinfo = &linux_brandlist[0]; *brandinfo != NULL;
++brandinfo)
- if (elf_brand_inuse(*brandinfo))
+ if (elf64_brand_inuse(*brandinfo))
error = EBUSY;
if (error == 0) {
for (brandinfo = &linux_brandlist[0];
*brandinfo != NULL; ++brandinfo)
- if (elf_remove_brand_entry(*brandinfo) < 0)
+ if (elf64_remove_brand_entry(*brandinfo) < 0)
error = EINVAL;
}
if (error == 0) {
diff --git a/sys/alpha/osf1/imgact_osf1.c b/sys/alpha/osf1/imgact_osf1.c
index b1e1da7..4eee3a7 100644
--- a/sys/alpha/osf1/imgact_osf1.c
+++ b/sys/alpha/osf1/imgact_osf1.c
@@ -178,7 +178,7 @@ exec_osf1_imgact(struct image_params *imgp)
/*
* Destroy old process VM and create a new one (with a new stack).
*/
- exec_new_vmspace(imgp);
+ exec_new_vmspace(imgp, VM_MIN_ADDRESS, VM_MAXUSER_ADDRESS, USRSTACK);
/*
* The vm space can now be changed.
OpenPOWER on IntegriCloud