Changeset 8745


Ignore:
Timestamp:
Mar 13, 2008, 3:53:48 AM (12 years ago)
Author:
rme
Message:

Part of .SPcall_closure, changes to .SPbuiltin_times (I'm thinking about
having .SPmakes64 take input in %mm0 rather than in %edx:%eax), messing
around with .SPsyscall.

File:
1 edited

Legend:

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

    r8686 r8745  
    10231023
    10241024_spentry(syscall)
     1025        __(int $3)
    10251026        /* Save lisp registers */
    10261027        __(push %ebp)
     
    10391040        __(addl $2*node_size,%esp)
    10401041        __(unbox_fixnum(%arg_z,%eax))
    1041         /* push syscall args on stack */
    1042         __(int $0x80)
    1043         __(movl %ebp,%esp)
     1042
     1043        /* syscall args on stack */
     1044        __(movl $local_label(back_from_sysenter),%edx)
     1045        __(movl %esp,%ecx)
     1046        __(sysenter)
     1047local_label(back_from_sysenter):
     1048       
     1049        __(movl %ecx,%esp)
    10441050        __(movl %esp,%rcontext:tcr.foreign_sp)
    10451051        __(zero_node_regs)
     
    25042510        __(jne 2f)
    25052511        __(unbox_fixnum(%arg_z,%imm0))
    2506         __(mark_as_imm(%edx))
    2507         /* 64-bit fixnum result in %edx:%eax.  Overflow set if %edx */
    2508         /* is significant. */
    2509         __(imul %arg_y)
     2512        /* 32-bit fixnum result in %imm0.  Overflow set if it doesn't fit. */
     2513        __(imul %arg_y,%imm0)
    25102514        __(jo 1f)
    25112515        __(movl %imm0,%arg_z)
    2512         __(mark_as_node(%edx))
    25132516        __(ret)
    251425171:      __(unbox_fixnum(%arg_z,%eax))
     2518        __(mark_as_imm(%edx))
    25152519        __(unbox_fixnum(%arg_y,%edx))
    25162520        __(imul %edx)
     
    29152919_endsubp(aset3)
    29162920
     2921/* Prepend all but the first seven (6 words of code & other immediate data,
     2922/* plus inner fn) and last (lfbits) elements of %fn to the "arglist". */
    29172923_spentry(call_closure)
    2918         __(int $3)
     2924        new_local_labels()
     2925        __(vector_length(%fn,%imm0))
     2926        __(subl $8<<fixnumshift,%imm0)  /* imm0 = inherited arg count */
     2927        __(lea (%nargs,%imm0),%temp0)
     2928        __(cmpl $nargregs<<fixnumshift,%temp0)
     2929        __(jna local_label(regs_only))  /* either: 1 arg, 1 inherited, or */
     2930                                        /* no args, 2 inherited */
     2931        __(pop %rcontext:tcr.save0)             /* save return address */
     2932        __(cmpl $nargregs<<fixnumshift,%nargs)
     2933        __(jna local_label(no_insert))
     2934
     2935/* Some arguments have already been pushed.  Push %imm0's worth */
     2936/* of NILs, copy those arguments that have already been vpushed from */
     2937/* the old TOS to the new, then insert all of the inherited args */
     2938/* and go to the function. */
     2939
     2940        __(mov %imm0,%temp0)
     2941local_label(push_nil_loop):
     2942        __(push $nil_value)
     2943        __(sub $fixnumone,%temp0)
     2944        __(jne local_label(push_nil_loop))
     2945
     2946        __(int $3)
     2947/* Here if no args were pushed by the caller. */
     2948/* cases: */
     2949/* no args, more than two inherited args */
     2950/* a single arg in arg_z, more than one inherited arg */
     2951/* two args in arg_y and arg_z, some number of inherited args */
     2952
     2953/* Therefore, we're always going to have to push something (the sum of
     2954/* %nargs and %imm0 will always be greater than $nargregs), and */
     2955/* we will have to reserve space for a stack frame. */
     2956/* The 0 args, 2 inherited case and the 1 arg, 1 inherited case get */
     2957/* handled at local_label(regs_ony). */
     2958       
     2959local_label(no_insert):
     2960        /* Reserve space for a stack frame */
     2961        __(push $reserved_frame_marker)
     2962        __(push $reserved_frame_marker)
     2963        __(lea 7<<fixnumshift(%imm0),%temp0)    /* last inherited arg */
     2964        __(rcmpl(%nargs,$fixnumone))
     2965        __(je local_label(set_arg_y))
     2966        __(jb local_label(set_y_z))
     2967        /* %nargs = $nargregs (i.e., 2), vpush remaining inherited vars. */
     2968
     2969local_label(vpush_remaining):
     2970        __(movl $7<<fixnumshift,%temp0)
     2971local_label(vpush_remaining_loop):
     2972        __(push misc_data_offset(%fn,%temp0))
     2973        __(add $node_size,%temp0)
     2974        __(add $fixnumone,%nargs)
     2975        __(sub $node_size,%imm0)
     2976        __(jnz local_label(vpush_remaining_loop))
     2977        __(jmp local_label(go))
     2978       
     2979local_label(set_arg_y):
     2980        /* one arg in arg_z.  set arg_y and vpush remaining inherited args */
     2981        __(subl $node_size,%temp0)
     2982        __(movl misc_data_offset(%fn,%temp0),%arg_y)
     2983        __(addl $fixnumone,%nargs)
     2984        __(subl $fixnumone,%imm0)
     2985        __(jmp local_label(vpush_remaining))
     2986local_label(set_y_z):
     2987        __(subl $node_size,%temp0)
     2988        __(movl misc_data_offset(%fn,%temp0),%arg_z)
     2989        __(addl $fixnumone,%nargs)
     2990        __(subl $fixnumone,%imm0)
     2991        __(jmp local_label(set_arg_y))
     2992
     2993local_label(go):
     2994        __(movl misc_data_offset+(6*node_size)(%fn),%fn)
     2995        __(push %rcontext:tcr.save0)    /* restore return addr */
     2996        __(movapd %fpzero,%rcontext:tcr.save0)  /* clear out spill area */
     2997        __(jmp *%fn)
     2998local_label(regs_only):
     2999        __(lea 7<<fixnumshift(%imm0),%temp0)
     3000        __(test %nargs,%nargs)
     3001        __(jne local_label(one_arg))
     3002        /* no args passed, two inherited args */
     3003        __(movl misc_data_offset-node_size(%fn,%temp0),%arg_z)
     3004        __(cmpl $node_size,%imm0)
     3005        __(je local_label(rgo))
     3006        __(movl misc_data_offset-(node_size*2)(%fn,%temp0),%arg_y)
     3007local_label(rgo):
     3008        __(addl %imm0,%nargs)
     3009        __(jmp *misc_data_offset+(6*node_size)(%fn))
     3010local_label(one_arg):
     3011        /* one arg was passed, so there's one inherited arg */
     3012        __(movl misc_data_offset-node_size(%fn,%temp0),%arg_y)
     3013        __(jmp local_label(rgo))
    29193014_endsubp(call_closure)
    29203015
Note: See TracChangeset for help on using the changeset viewer.