Changeset 9379


Ignore:
Timestamp:
May 6, 2008, 5:34:34 PM (11 years ago)
Author:
rme
Message:

.SPadd_values, .SPrecover_values_for_mvcall, .SPbuiltin_aset1.

Also an incomplete and mostly wrong .SPcallback.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ia32/lisp-kernel/x86-spentry32.s

    r9301 r9379  
    441441/* Like misc_set, only the boxed subtag is in temp1. */
    442442_spentry(subtag_misc_set)
    443         __(int $3)
    444443        __(mov %temp0,%imm0)
    445444        __(andb $tagmask,%imm0_b)
     
    28362835
    28372836_spentry(save_values)
     2837        __(movd %rcontext:tcr.save_tsp,%mm1)
     2838/* common exit: nargs = values in this set, mm1 = ptr to tsp before call to save_values   */
     2839local_label(save_values_to_tsp):
    28382840        __(movl %ra0,%rcontext:tcr.save0)
    2839         __(movd %rcontext:tcr.save_tsp,%mm1)
    2840 /* common exit: nargs = values in this set, imm1 = ptr to tsp before call to save_values   */
    2841 local_label(save_values_to_tsp):
    28422841        __(movl %rcontext:tcr.save_tsp,%temp0)
    28432842        __(dnode_align(%nargs,tsp_frame.fixed_overhead+(2*node_size),%imm0)) /* count, link   */
     
    28722871_spentry(add_values)
    28732872        __(int $3)
     2873        /* do we need to preserve imm0? */
     2874        __(test %nargs,%nargs)
     2875        __(movl %rcontext:tcr.save_tsp,%imm0)
     2876        __(movl (%imm0),%imm0)
     2877        __(movd %imm0,%mm1)     /* for the benefit of save_values_to_tsp */
     2878        __(jne local_label(save_values_to_tsp))
     2879        __(jmp *%ra0)
    28742880_endsubp(add_values)
    28752881
     
    29192925_endsubp(recover_values)
    29202926
     2927/* Exactly like recover_values, but it's necessary to reserve an outgoing  */
     2928/* frame if any values (which will be used as outgoing arguments) will  */
     2929/* wind up on the stack.  We can assume that %nargs contains 0 (and  */
     2930/* that no other arguments have been pushed) on entry.   */
     2931
    29212932_spentry(recover_values_for_mvcall)
    29222933        __(int $3)
     2934        __(movl %ra0,%rcontext:tcr.save0) /* temp0 */
     2935        /* First, walk the segments reversing the pointer to previous  */
     2936        /* segment pointers Can tell the end because that previous  */
     2937        /* segment pointer is the prev tsp pointer   */
     2938        __(xorl %nargs,%nargs)
     2939        __(push %nargs)
     2940        __(movl %rcontext:tcr.save_tsp,%temp1)
     2941        __(movl %temp1,%temp0)  /* current segment   */
     2942        __(movl %temp1,%arg_y)  /* last segment   */
     2943        __(movl tsp_frame.backlink(%temp1),%arg_z)      /* previous tsp   */
     2944local_label(walkloop_mvcall):
     2945        __(movl tsp_frame.data_offset(%temp0),%imm0)
     2946        __(addl %imm0,(%esp))
     2947        __(movl tsp_frame.fixed_overhead+node_size(%temp0),%imm0)
     2948        __(cmpl %imm0,%arg_z)   /* last segment ?   */
     2949        __(movl %arg_y,tsp_frame.fixed_overhead+node_size(%temp0))
     2950        __(movl %temp0,%arg_y)  /* last segment <- current segment   */
     2951        __(movl %imm0,%temp0)   /* current segment <- next segment   */
     2952        __(jne local_label(walkloop_mvcall))
     2953
     2954        __(movl %temp1,%arg_z)
     2955        __(pop %nargs)
     2956
     2957        __(cmpl $nargregs*node_size,%nargs)
     2958        __(jbe local_label(pushloop_mvcall))
     2959        __(push $reserved_frame_marker)
     2960        __(push $reserved_frame_marker)
     2961
     2962        /* the final segment pointer is now in %arg_y  */
     2963        /* walk backwards, pushing values on the stack and incrementing %nargs*/
     2964local_label(pushloop_mvcall):
     2965        __(movl tsp_frame.data_offset(%arg_y),%imm0)    /* nargs in segment */
     2966        __(test %imm0,%imm0)
     2967        __(leal tsp_frame.data_offset+(2*node_size)(%arg_y,%imm0),%temp0)
     2968        __(jmp 2f)
     29691:      __(push -node_size(%temp0))
     2970        __(subl $node_size,%temp0)
     2971        __(subl $fixnum_one,%imm0)
     29722:      __(jne 1b)
     2973        __(cmpl %arg_y,%arg_z)
     2974        __(movl tsp_frame.data_offset+node_size(%arg_y),%arg_y)
     2975        __(jne local_label(pushloop_mvcall))
     2976        __(movl (%arg_z),%arg_z)
     2977        __(movl %arg_z,%rcontext:tcr.save_tsp)
     2978        __(movl %arg_z,%rcontext:tcr.next_tsp)
     2979        __(movl %rcontext:tcr.save0,%ra0)
     2980        __(movl $0,%rcontext:tcr.save0)
     2981        __(jmp *%ra0)           
    29232982_endsubp(recover_values_for_mvcall)
    29242983
     
    35963655
    35973656_spentry(builtin_aset1)
    3598         __(int $3)
     3657        __(extract_typecode(%temp0,%imm0))
     3658        __(box_fixnum(%imm0,%temp1))
     3659        __(cmpb $min_vector_subtag,%imm0_b)
     3660        __(ja _SPsubtag_misc_set)
     3661        __(pop %temp1)
     3662        __(push $reserved_frame_marker)
     3663        __(push $reserved_frame_marker)
     3664        __(push %temp1)
     3665        __(jump_builtin(_builtin_aset1,3))
    35993666_endsubp(builtin_aset1)
    36003667
     
    37983865_spentry(callback)
    37993866        __(int $3)
     3867        __(push %ebp)
     3868        __(movl %esp,%ebp)
     3869        /* C NVRs */
     3870        __(push %edi)
     3871        __(push %esi)
     3872        __(push %ebx)
     3873       
     3874        __(movl %eax,%edi)
     3875        __(ref_global(get_tcr,%eax))
     3876        __(push $1)
     3877        __(call *%eax)
     3878        /* linear TCR addr now in %eax; callback index in %edi */
     3879        __(movl %edi,%eax)
     3880        __(push %rcontext:tcr.foreign_sp)
     3881        __(clr %arg_z)
     3882        __(clr %arg_y)
     3883        __(clr %temp1)
     3884        __(clr %temp0)
     3885        __(clr %fn)
     3886        __(pxor %fpzero,%fpzero)
     3887        __(movl %rcontext:tcr.save_vsp,%esp)
     3888        __(box_fixnum(%eax,%arg_y))
     3889        __(movl %ebp,%arg_z)
     3890        __(movl $TCR_STATE_LISP,%rcontext:tcr.valence)
     3891        __(stmxcsr %rcontext:tcr.foreign_mxcsr)
     3892        __(andb $~mxcsr_all_exceptions,%rcontext:tcr.foreign_mxcsr)
     3893        __(ldmxcsr %rcontext:tcr.lisp_mxcsr)
     3894        __(movl $nrs.callbacks,%fname)
     3895        __(push $local_label(back_from_callback))
     3896        __(set_nargs(2))
     3897        __(jump_fname())
     3898__(tra(local_label(back_from_callback)))
     3899        __(movl %esp,%rcontext:tcr.save_vsp)
     3900        __(movl %ebp,%rcontext:tcr.save_ebp)
     3901        __(movl %rcontext:tcr.foreign_sp,%esp)
     3902        __(stmxcsr %rcontext:tcr.lisp_mxcsr)
     3903        __(movl $TCR_STATE_FOREIGN,%rcontext:tcr.valence)
     3904        __(emms)
     3905        __(pop %rcontext:tcr.foreign_sp)
     3906        __(ldmxcsr %rcontext:tcr.foreign_mxcsr)
     3907        __(pop %ebx)
     3908        __(pop %esi)
     3909        __(pop %edi)
     3910        __(leave)
     3911        __(ret)
    38003912_endsubp(callback)
    38013913
Note: See TracChangeset for help on using the changeset viewer.