From 9995c82494c9ff22ab1acc15502d5dcf5c7abb7a Mon Sep 17 00:00:00 2001
From: peter <peter@FreeBSD.org>
Date: Fri, 15 Dec 1995 03:28:38 +0000
Subject: Initial attempt at getting Linux QMAGIC shared lib support.  I have
 successfully run linux netscape 2.0b3 with a QMAGIC ld.so and libc/libm that
 I found on some linux machine that I _think_ is running slackware 3.0.

There are still problems..  ld.so claims the libraries are the wrong
format, but it still runs anyway.. :-/  The QMAGIC ld.so also screams
about needing ld.so.cache, and running a linux ldconfig is quite
educational.  You soon learn to run "chroot /compat/linux /bin/ldconfig"
where ldconfig is living in /compat/linux/bin. :-]

(Lets just say that it puts loads of symlinks in /usr/lib otherwise :-)
---
 sys/compat/linux/linux_misc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'sys/compat')

diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index cce887e..1714240 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -25,7 +25,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- *  $Id: linux_misc.c,v 1.7 1995/12/14 22:35:45 bde Exp $
+ *  $Id: linux_misc.c,v 1.8 1995/12/15 03:06:54 peter Exp $
  */
 
 #include <sys/param.h>
@@ -255,11 +255,11 @@ linux_uselib(struct proc *p, struct linux_uselib_args *args, int *retval)
      */
     switch ((int)(a_out->a_magic & 0xffff)) {
     case 0413:	/* ZMAGIC */
-	virtual_offset = 0;
+	virtual_offset = 0;	/* actually aout->a_entry */
 	file_offset = 1024;
 	break;
     case 0314:	/* QMAGIC */
-	virtual_offset = 4096;
+	virtual_offset = 0;	/* actually aout->a_entry */
 	file_offset = 0;
 	break;
     default:
@@ -311,7 +311,7 @@ printf("uselib: Non page aligned binary %d\n", file_offset);
 #ifdef DEBUG
 printf("uselib: Page aligned binary %d\n", file_offset);
 #endif
-	vmaddr = virtual_offset + round_page(a_out->a_entry);
+	vmaddr = virtual_offset + trunc_page(a_out->a_entry);
 	error = vm_mmap(&p->p_vmspace->vm_map, &vmaddr,
 			a_out->a_text + a_out->a_data,
 			VM_PROT_ALL, VM_PROT_ALL, MAP_PRIVATE | MAP_FIXED,
-- 
cgit v1.1