/[cmucl]/src/lisp/ppc-assem.S
ViewVC logotype

Diff of /src/lisp/ppc-assem.S

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by rtoy, Fri Jul 30 00:53:41 2004 UTC revision 1.5 by rtoy, Sun Feb 6 19:43:15 2005 UTC
# Line 486  _closure_tramp: Line 486  _closure_tramp:
486          blr          blr
487          SET_SIZE(ppc_flush_cache_line)          SET_SIZE(ppc_flush_cache_line)
488    
489    #ifdef LINKAGE_TABLE
490    /*
491     * Call into C code to resolve a linkage entry.
492     *
493     * We get here by Lisp calling call_into_c with an address of the
494     * desired function which is contained in the register reg_CFUNC (aka
495     * %i4, aka %r28).  This is the address of the entry in the linkage
496     * table, which is what we need to figure out what function we really
497     * wanted.
498     *
499     * Note that because we get here from call_into_c, all necessary live
500     * registers have been saved, including FP registers.  Hence, no need
501     * to save them.
502     */
503            .globl _lazy_resolve_linkage
504            GFUNCDEF(resolve_linkage_tramp)
505            /*
506             * We need to call lazy_resolve_linkage.  reg_A0 (= r24)
507             * (see ppc-arch.c) contains the address of the linkage entry.
508             */
509            /*
510             * Need to save all parameter regs to the stack because we
511             * need them for later.
512             */
513            subi    r1, r1, 8*4+8
514            stw     r3, 0(r1)
515            stw     r4, 4(r1)
516            stw     r5, 8(r1)
517            stw     r6, 12(r1)
518            stw     r7, 16(r1)
519            stw     r8, 20(r1)
520            stw     r9, 24(r1)
521            stw     r10, 28(r1)
522    
523            mr      reg_NL0, reg_A0
524    
525            stwu    r1, (-(24+4))(r1)
526            /*
527             * At this point reg_NIL should be available to us.
528             * Call lazy_resolve_linkage to figure out the real function address.
529             */
530            lis     reg_NULL, hi16(_lazy_resolve_linkage)
531            ori     reg_NULL, reg_NULL, lo16(_lazy_resolve_linkage)
532            mtctr   reg_NULL
533            mflr    reg_CODE
534            bctrl
535    
536            addi    r1,r1,24+4
537    
538            /*
539             * The desired function is in r3 (NL0), so save it
540             * and restore the real arg parameters
541             */
542    
543            mtctr   reg_NL0
544            lwz     r3, 0(r1)
545            lwz     r4, 4(r1)
546            lwz     r5, 8(r1)
547            lwz     r6, 12(r1)
548            lwz     r7, 16(r1)
549            lwz     r8, 20(r1)
550            lwz     r9, 24(r1)
551            lwz     r10, 28(r1)
552    
553            /*
554             * Got it, so we can now jump directly to the desired function.
555             * reg_NL0 contains the result.  Restore the stack and go!
556             */
557    
558            mtlr    reg_CODE
559    
560            /* Back to C */
561            /*      mtlr    reg_CODE*/
562            bctr
563    
564            SET_SIZE(resolve_linkage_tramp)
565    
566    
567    /*
568     * When we get called, r3 (reg_NL0) contains the address of the
569     * data_vector object which is a string naming the bad symbol.
570     */
571            GFUNCDEF(undefined_foreign_symbol_trap)
572    
573            /*
574               Need to restore all the global registers with the Lisp values that
575               were saved away in call_into_c.  (This routine is only called from
576               os_link_one_symbol, which is called from resolve_linkage_tramp, which
577               is called from call_into_c.)
578    
579               The global registers are volatile across function calls, so who
580               knows what values have been they contain now!
581    
582            */
583    
584            load(reg_ALLOC, _current_dynamic_space_free_pointer)
585            load(reg_BSP, _current_binding_stack_pointer)
586            load(reg_CSP, _current_control_stack_pointer)
587            load(reg_CFP, _current_control_frame_pointer)
588    
589            lis reg_NULL,hi16(NIL)
590            ori reg_NULL,reg_NULL,lo16(NIL)
591            /* And reg_ZERO */
592            li reg_ZERO,0
593    
594            mr      reg_NL0, reg_A0
595            twllei  reg_ZERO, trap_Error
596            .byte   4       /* Number of argument bytes */
597            .byte   UNDEFINED_FOREIGN_SYMBOL_ERROR
598            /* Escape to create 16bit number from following two bytes, in
599               little-endian order */
600            .byte   254
601            .byte   SC_OFFSET_LO(sc_DescriptorReg, reg_A0_NUM)
602            .byte   SC_OFFSET_HI(sc_DescriptorReg, reg_A0_NUM)
603            .align  4
604    
605    #endif

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.5