Changeset 5010
- Timestamp:
- Aug 22, 2006, 1:06:42 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/ccl/lisp-kernel/x86-spentry64.s (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/lisp-kernel/x86-spentry64.s
r4949 r5010 3961 3961 3962 3962 _spentry(ffcall) 3963 /* Unbox %arg_z. It's either a fixnum or macptr (or bignum) ; 3964 if not a fixnum, get the first word */ 3965 __(unbox_fixnum(%arg_z,%imm0)) 3966 __(testb $fixnummask,%arg_z_b) 3967 __(je 0f) 3968 __(movq macptr.address(%arg_z),%imm0) 3969 0: 3963 3970 /* Save lisp registers */ 3964 3971 __(push %temp0) … … 3982 3989 __(movq $TCR_STATE_FOREIGN,%rcontext:tcr.valence) 3983 3990 __(emms) 3991 __(ldmxcsr %rcontext:tcr.foreign_mxcsr) 3984 3992 __(movq (%rsp),%rbp) 3985 __(ldmxcsr %rcontext:tcr.foreign_mxcsr) 3993 __ifdef([DARWIN_GS_HACK]) 3994 /* At this point, %imm0=%rax is live (contains 3995 the entrypoint); the lisp registers are 3996 all saved, and the foreign arguments are 3997 on the foreign stack (about to be popped 3998 off). Save the linear TCR address in %save0/%r15 3999 so that we can restore it later, and preserve 4000 the entrypoint somewhere where C won't bash it. 4001 Note that dereferencing the entrypoint from 4002 foreign code has never been safe (unless it's 4003 a fixnum */ 4004 __(save_tcr_linear(%save0)) 4005 __(movq %imm0,%save1) 4006 __(set_foreign_gs_base()) 4007 __(movq %save1,%imm0) 4008 __endif 3986 4009 __(addq $2*node_size,%rsp) 3987 __(unbox_fixnum(%arg_z,%r11))3988 __(testb $fixnummask,%arg_z_b)3989 __(movq %arg_z,%r10)3990 4010 __(pop %rdi) 3991 4011 __(pop %rsi) 3992 4012 __(pop %rdx) 3993 __(je 0f)3994 __(mov macptr.address(%r10),%r11)3995 0:3996 4013 __(pop %rcx) 3997 4014 __(pop %r8) 3998 4015 __(pop %r9) 3999 __(call *%r 11)4016 __(call *%rax) 4000 4017 __(movq %rbp,%rsp) 4018 __ifdef([DARWIN_GS_HACK]) 4019 /* %rax/%rdx contains the return value (maybe), %save0 still 4020 contains the linear tcr address. Preserve %rax/%rdx here. */ 4021 __(movq %rax,%save1) 4022 __(movq %rdx,%save2) 4023 __(set_gs_base(%save0)) 4024 __(movq %save1,%rax) 4025 __(movq %save2,%rdx) 4026 __endif 4001 4027 __(movq %rsp,%rcontext:tcr.foreign_sp) 4002 4028 __(clr %save3) … … 4064 4090 __(pop %r9) 4065 4091 __(syscall) 4066 __ifdef([ FREEBSD])4067 __(jnc 0f)4068 __(negq %rax)4092 __ifdef([SYSCALL_SETS_CARRY_ON_ERROR]) 4093 __(jnc 0f) 4094 __(negq %rax) 4069 4095 0: 4070 4096 __endif … … 4214 4240 __(movq %r12,%r11) 4215 4241 __(call *%rax) 4242 __ifdef([DARWIN_GS_HACK]) 4243 /* linear TCR address in now in %rax; callback index was 4244 saved in %r12 a moment ago. */ 4245 __(set_gs_base(%rax)) 4246 __(movq %r12,%r11) 4247 __endif 4216 4248 1: /* Align foreign stack for lisp */ 4217 4249 __(subq $node_size,%rsp) … … 4255 4287 __(addq $node_size,%rsp) 4256 4288 __(ldmxcsr %rcontext:tcr.foreign_mxcsr) 4289 __ifdef([DARWIN_GS_HACK]) 4290 /* Lucky us; nothing is live here */ 4291 __(set_foreign_gs_base()) 4292 __endif 4257 4293 __(pop %rbp) 4258 4294 __(pop %rbx)
Note:
See TracChangeset
for help on using the changeset viewer.
