On Sunday 08 December 2002 01:12 pm, Aaron Ardiri wrote:

> but, based on what chris was 'hinting' was that using multigen doesn't
> do so :) that makes it very interesting. especially for armlet builders.
> it has been a long time since i did use multigen, maybe chris can fill
> us in on the capabilities? :)
>
> [opens the floor to chris - explain boy] :P

>From my reading of multilink.c, it uses FtrGet() (called in 
MultilinkGetCodeSegments) for old a4 based gcc, and it does something much 
simpler for a5 based gcc.

static int
write_dispatch_code_a4(FILE* fp, unsigned long cid)
{
    fprintf(fp,
            /* When we don't have globals, get jmptables from ftr land */
            "dispatch_noglobals:\n"
            "    move.l %%d0,-(%%sp)\n"
            "    move.l %%d1,-(%%sp)\n"
            "    move.l #0x%lx,-(%%sp)\n" /* push creator id */
            "    bsr.w MultilinkGetCodeSegments\n"
            "    lea 4(%%sp),%%sp\n"
            "    move.l (%%sp)+,%%d1\n"
            "    move.l (%%sp)+,%%d0\n"
            "    bra.b dispatch_really\n"

            /*
             * If the code from here to the jmp at the end changes,
             * then the value branch_count is set to must change to
             * match.
             */
            "dispatch:\n"
            /* do we have globals */
            "    move.l %%a4,%%d2\n" /* tst.l %a4 fatal resets */
            "    beq.b dispatch_noglobals\n"
            /* yes, get the jmp table pointer */
            "    move.l MultilinkSegmentJmpTables(%%a4),%%a0\n"

            "dispatch_really:\n"
            /* get the segment table */
            "    move.l (%%a0,%%d1.w),%%a0\n"
            /* get the offset from the table */
            "    move.w (%%a0,%%d0.w),%%d2\n"
            "    jmp (%%a0,%%d2.w)\n"
            "", cid);

    return 20; /*FIXME*/
}

static int
write_dispatch_code_a5(FILE* fp)
{
    fprintf(fp,
            /*
             * If the code from here to the jmp at the end changes,
             * then the value branch_count is set to must change to
             * match.
             */
            "dispatch:\n"
            /* get the jmp table pointer */
            "    move.l MultilinkSegmentJmpTables@END(%%a5),%%a0\n"
            /* get the segment table */
            "    move.l (%%a0,%%d1.w),%%a0\n"
            /* get the offset from the table */
            "    move.w (%%a0,%%d0.w),%%d2\n"
            /* jump to real function */
            "    jmp (%%a0,%%d2.w)\n"
            "");
    return 16; /*FIXME*/
}

-- 
/* Chris Faherty <[EMAIL PROTECTED]> */

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to