From: Richard Henderson <rth@redhat.com>
To: torvalds@transmeta.com, alan@redhat.com
Cc: linux-kernel@vger.kernel.org
Subject: alpha 2.4.13: fix taso osf emulation
Date: Fri, 26 Oct 2001 01:31:01 -0700 [thread overview]
Message-ID: <20011026013101.A1404@redhat.com> (raw)
Required to get a dynamicly linked osf taso application working.
Like netscape. Which unfortunately still works better than mozilla
for many things.
Thoughts on changing all ports such that a mmap with a non-zero,
non-MAP_FIXED address starts the vma search at that address,
rather than looking for that exact address then checking the
regular unmapped base?
r~
diff -rup linux/fs/binfmt_aout.c 2.4.13/fs/binfmt_aout.c
--- linux/fs/binfmt_aout.c Sun Sep 30 12:26:08 2001
+++ 2.4.13/fs/binfmt_aout.c Thu Oct 25 09:58:03 2001
@@ -285,13 +285,15 @@ static int load_aout_binary(struct linux
return retval;
/* OK, This is the point of no return */
-#if !defined(__sparc__)
- set_personality(PER_LINUX);
-#else
+#if defined(__alpha__)
+ SET_AOUT_PERSONALITY(bprm, ex);
+#elif defined(__sparc__)
set_personality(PER_SUNOS);
#if !defined(__sparc_v9__)
memcpy(¤t->thread.core_exec, &ex, sizeof(struct exec));
#endif
+#else
+ set_personality(PER_LINUX);
#endif
current->mm->end_code = ex.a_text +
diff -rup linux/fs/exec.c 2.4.13/fs/exec.c
--- linux/fs/exec.c Tue Sep 18 13:39:32 2001
+++ 2.4.13/fs/exec.c Thu Oct 25 11:36:53 2001
@@ -770,7 +770,6 @@ int search_binary_handler(struct linux_b
if (!bprm->loader && eh->fh.f_magic == 0x183 &&
(eh->fh.f_flags & 0x3000) == 0x3000)
{
- char * dynloader[] = { "/sbin/loader" };
struct file * file;
unsigned long loader;
@@ -780,10 +779,14 @@ int search_binary_handler(struct linux_b
loader = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
- file = open_exec(dynloader[0]);
+ file = open_exec("/sbin/loader");
retval = PTR_ERR(file);
if (IS_ERR(file))
return retval;
+
+ /* Remember if the application is TASO. */
+ bprm->sh_bang = eh->ah.entry < 0x100000000;
+
bprm->file = file;
bprm->loader = loader;
retval = prepare_binprm(bprm);
diff -rup linux/arch/alpha/kernel/osf_sys.c 2.4.13/arch/alpha/kernel/osf_sys.c
--- linux/arch/alpha/kernel/osf_sys.c Fri Oct 26 01:17:08 2001
+++ 2.4.13/arch/alpha/kernel/osf_sys.c Thu Oct 25 12:10:52 2001
@@ -1357,14 +1357,19 @@ arch_get_unmapped_area(struct file *filp
if (len > limit)
return -ENOMEM;
- /* First, see if the given suggestion fits. */
- if (addr) {
- struct vm_area_struct *vma;
+ /* First, see if the given suggestion fits.
+
+ The OSF/1 loader (/sbin/loader) relies on us returning an
+ address larger than the requested if one exists, which is
+ a terribly broken way to program.
- addr = PAGE_ALIGN(addr);
- vma = find_vma(current->mm, addr);
- if (limit - len >= addr &&
- (!vma || addr + len <= vma->vm_start))
+ That said, I can see the use in being able to suggest not
+ merely specific addresses, but regions of memory -- perhaps
+ this feature should be incorporated into all ports? */
+
+ if (addr) {
+ addr = arch_get_unmapped_area_1 (PAGE_ALIGN(addr), len, limit);
+ if (addr != -ENOMEM)
return addr;
}
diff -rup linux/include/asm-alpha/a.out.h 2.4.13/include/asm-alpha/a.out.h
--- linux/include/asm-alpha/a.out.h Fri Feb 6 10:06:55 1998
+++ 2.4.13/include/asm-alpha/a.out.h Fri Oct 26 01:24:47 2001
@@ -90,8 +90,16 @@ struct exec
#ifdef __KERNEL__
+/* Assume that start addresses below 4G belong to a TASO application.
+ Unfortunately, there is no proper bit in the exec header to check.
+ Worse, we have to notice the start address before swapping to use
+ /sbin/loader, which of course is _not_ a TASO application. */
+#define SET_AOUT_PERSONALITY(BFPM, EX) \
+ set_personality (BFPM->sh_bang || EX.ah.entry < 0x100000000 \
+ ? PER_LINUX_32BIT : PER_LINUX)
+
#define STACK_TOP \
- ((current->personality==PER_LINUX_32BIT) ? (0x80000000) : (0x00120000000UL))
+ (current->personality & ADDR_LIMIT_32BIT ? 0x80000000 : 0x00120000000UL)
#endif
next reply other threads:[~2001-10-26 8:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-26 8:31 Richard Henderson [this message]
2001-10-26 10:01 ` alpha 2.4.13: fix taso osf emulation Maciej W. Rozycki
2001-10-26 10:45 ` Ivan Kokshaysky
2001-10-26 17:11 ` Richard Henderson
2001-10-29 16:35 ` Ivan Kokshaysky
2001-10-29 17:21 ` Richard Henderson
2001-10-26 17:03 ` Richard Henderson
2001-10-26 18:25 ` Maciej W. Rozycki
2001-10-28 9:38 ` Module loading and Kernel crash Anand Ashok Kulkarni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20011026013101.A1404@redhat.com \
--to=rth@redhat.com \
--cc=alan@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.