Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Nov 1995 07:02:17 +0000 ()
From:      Michael Smith <msmith@atrad.adelaide.edu.au>
To:        hackers@freebsd.org
Subject:   Linux emul, QMAGIC libs
Message-ID:  <199511070702.HAA03407@genesis.atrad.adelaide.edu.au>

next in thread | raw e-mail | index | archive | help
Just wasting my time 8) pottering through the Linux emulator, wondering about
why QMAGIC format libraries don't work.

I find some interesting discrepancies 8(

Linux emulation uses the standard kernel execve, but its own code for shared
libraries :

    /*
     * Set file/virtual offset based on a.out variant.
     */
    switch ((int)(a_out->a_magic & 0xffff)) {
    case 0413:  /* ZMAGIC */
        virtual_offset = 0;
        file_offset = 1024;
        break;
    case 0314:  /* QMAGIC */
        virtual_offset = 4096;
        file_offset = 0;
        break;
    default:
        return ENOEXEC;
    }

This conflicts with /sys/kern/imgact_aout.c : (NBPG = 1<<12) - pruned

        /*
         * Set file/virtual offset based on a.out variant.
         */
        switch ((int)(a_out->a_magic & 0xffff)) {
        case ZMAGIC:
                virtual_offset = 0;
                if (a_out->a_text) {
                        file_offset = NBPG;
                } else {
                        /* Bill's "screwball mode" */
                        file_offset = 0;
                }
                break;
        case QMAGIC:
                virtual_offset = NBPG;
                file_offset = 0;
                break;

However, if this was all there was to it, QMAGIC would work, but ZMAGIC
wouldn't.

Any ideas?  Obviously, the kernel gets it right (most of the time; this 
doesn't explain the failure of a QMAGIC ld.so 8), but how linux_misc
manages... I'm puzzled.


-- 
]] Mike Smith, Software Engineer        msmith@atrad.adelaide.edu.au    [[
]] Genesis Software                     genesis@atrad.adelaide.edu.au   [[
]] High-speed data acquisition and                                      [[
]] realtime instrument control          (ph/fax) +61-8-267-3039         [[
]] My car has "demand start" -Terry Lambert  UNIX: live FreeBSD or die! [[



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199511070702.HAA03407>