X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fx86-assem.S;h=c16b3ef9f790ba34fdbe43b64a1720ee653af138;hb=d4d6c4b16a3655ce99a87d43f411391363531260;hp=a1b1385aa83641826618d91712dcf6b78e1cb932;hpb=8f07013fea8c3a6cae9819f1761340ae4c57e24c;p=sbcl.git diff --git a/src/runtime/x86-assem.S b/src/runtime/x86-assem.S index a1b1385..c16b3ef 100644 --- a/src/runtime/x86-assem.S +++ b/src/runtime/x86-assem.S @@ -14,8 +14,8 @@ */ #define LANGUAGE_ASSEMBLY -#include "validate.h" #include "sbcl.h" +#include "validate.h" #include "genesis/closure.h" #include "genesis/fdefn.h" #include "genesis/static-symbols.h" @@ -29,7 +29,7 @@ * turns out not to matter, perhaps it's just clutter we could get * rid of? -- WHN 2004-04-18) */ -#if defined __linux__ || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ +#if defined __linux__ || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined __sun #define GNAME(var) var #else #define GNAME(var) _##var @@ -44,7 +44,7 @@ * matter any more, perhaps it's just clutter we could get * rid of? -- WHN 2004-04-18) */ -#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) +#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__sun) #define align_4byte 4 #define align_8byte 8 #define align_16byte 16 @@ -178,8 +178,8 @@ Lstack: fnsave (%esp) # save and reset NPX movl (%esp),%eax # Load NPX control word. - andl $0xfffff3ff,%eax # Set rounding mode to nearest. - orl $0x00000300,%eax # Set precision to 64 bits. + andl $0xfffff2ff,%eax # Set rounding mode to nearest. + orl $0x00000200,%eax # Set precision to 64 bits. (53-bit mantissa) pushl %eax fldcw (%esp) # Recover modes. popl %eax @@ -286,6 +286,7 @@ GNAME(fpu_restore): .align align_4byte,0x90 .global GNAME(undefined_tramp) .type GNAME(undefined_tramp),@function + .byte 0, 0, 0, SIMPLE_FUN_HEADER_WIDETAG GNAME(undefined_tramp): int3 .byte trap_Error @@ -302,6 +303,7 @@ GNAME(undefined_tramp): .align align_4byte,0x90 .global GNAME(closure_tramp) .type GNAME(closure_tramp),@function + .byte 0, 0, 0, SIMPLE_FUN_HEADER_WIDETAG GNAME(closure_tramp): movl FDEFN_FUN_OFFSET(%eax),%eax /* FIXME: The '*' after "jmp" in the next line is from PVE's @@ -658,155 +660,153 @@ GNAME(alloc_16_to_edi): popl %eax ret .size GNAME(alloc_16_to_edi),.-GNAME(alloc_16_to_edi) - - - .align align_4byte,0x90 - .globl GNAME(post_signal_tramp) - .type GNAME(post_signal_tramp),@function -GNAME(post_signal_tramp): - /* this is notionally the second half of a function whose first half - * doesn't exist. This is where call_into_lisp returns when called - * using return_to_lisp_function */ - addl $12,%esp /* clear call_into_lisp args from stack */ - popa /* restore registers */ - popl %ebp - ret - .size GNAME(post_signal_tramp),.-GNAME(post_signal_tramp) - -#ifdef GENCGC_INLINE_ALLOC /* LISP_FEATURE_GENCGC */ - -/* These routines are called from Lisp when an inline allocation - * overflows. Every register except the result needs to be preserved. - * We depend on C to preserve ebx, esi, edi, and ebp. - * But where necessary must save eax, ecx, edx. */ - +/* Called from lisp when an inline allocation overflows. + Every register except the result needs to be preserved. + We depend on C to preserve ebx, esi, edi, and ebp. + But where necessary must save eax, ecx, edx. */ + +#ifdef LISP_FEATURE_SB_THREAD +#define START_REGION %fs:THREAD_ALLOC_REGION_OFFSET +#define DISPLACEMENT $7 +#else +#define START_REGION boxed_region +#define DISPLACEMENT $6 +#endif + /* This routine handles an overflow with eax=crfp+size. So the - * size=eax-crfp. */ - .align align_4byte - .globl GNAME(alloc_overflow_eax) - .type GNAME(alloc_overflow_eax),@function + size=eax-crfp. */ + .align align_4byte + .globl GNAME(alloc_overflow_eax) + .type GNAME(alloc_overflow_eax),@function GNAME(alloc_overflow_eax): - pushl %ecx # Save ecx - pushl %edx # Save edx - /* Calculate the size for the allocation. */ - subl GNAME(current_region_free_pointer),%eax - pushl %eax # Push the size - call GNAME(alloc) - addl $4,%esp # pop the size arg. - popl %edx # Restore edx. - popl %ecx # Restore ecx. - addl $6,(%esp) # Adjust the return address to skip the next inst. - ret - .size GNAME(alloc_overflow_eax),.-GNAME(alloc_overflow_eax) - -/* This routine handles an overflow with ecx=crfp+size. So the - * size=ecx-crfp. */ - .align align_4byte - .globl GNAME(alloc_overflow_ecx) - .type GNAME(alloc_overflow_ecx),@function + pushl %ecx # Save ecx + pushl %edx # Save edx + /* Calculate the size for the allocation. */ + subl START_REGION,%eax + pushl %eax # Push the size + call GNAME(alloc) + addl $4,%esp # pop the size arg. + popl %edx # Restore edx. + popl %ecx # Restore ecx. + addl DISPLACEMENT,(%esp) # Adjust the return address to skip the next inst. + ret + .size GNAME(alloc_overflow_eax),.-GNAME(alloc_overflow_eax) + + .align align_4byte + .globl GNAME(alloc_overflow_ecx) + .type GNAME(alloc_overflow_ecx),@function GNAME(alloc_overflow_ecx): - pushl %eax # Save eax - pushl %edx # Save edx - /* Calculate the size for the allocation. */ - subl GNAME(current_region_free_pointer),%ecx - pushl %ecx # Push the size - call GNAME(alloc) - addl $4,%esp # pop the size arg. - movl %eax,%ecx # setup the destination. - popl %edx # Restore edx. - popl %eax # Restore eax. - addl $6,(%esp) # Adjust the return address to skip the next inst. - ret - .size GNAME(alloc_overflow_ecx),.-GNAME(alloc_overflow_ecx) - -/* This routine handles an overflow with edx=crfp+size. So the - * size=edx-crfp. */ - .align align_4byte - .globl GNAME(alloc_overflow_edx) - .type GNAME(alloc_overflow_edx),@function + pushl %eax # Save eax + pushl %edx # Save edx + /* Calculate the size for the allocation. */ + subl START_REGION,%ecx + pushl %ecx # Push the size + call GNAME(alloc) + addl $4,%esp # pop the size arg. + movl %eax,%ecx # setup the destination. + popl %edx # Restore edx. + popl %eax # Restore eax. + addl DISPLACEMENT,(%esp) # Adjust the return address to skip the next inst. + ret + .size GNAME(alloc_overflow_ecx),.-GNAME(alloc_overflow_ecx) + + .align align_4byte + .globl GNAME(alloc_overflow_edx) + .type GNAME(alloc_overflow_edx),@function GNAME(alloc_overflow_edx): - pushl %eax # Save eax - pushl %ecx # Save ecx - /* Calculate the size for the allocation. */ - subl GNAME(current_region_free_pointer),%edx - pushl %edx # Push the size - call GNAME(alloc) - addl $4,%esp # pop the size arg. - movl %eax,%edx # setup the destination. - popl %ecx # Restore ecx. - popl %eax # Restore eax. - addl $6,(%esp) # Adjust the return address to skip the next inst. - ret - .size GNAME(alloc_overflow_edx),.-GNAME(alloc_overflow_edx) + pushl %eax # Save eax + pushl %ecx # Save ecx + /* Calculate the size for the allocation. */ + subl START_REGION,%edx + pushl %edx # Push the size + call GNAME(alloc) + addl $4,%esp # pop the size arg. + movl %eax,%edx # setup the destination. + popl %ecx # Restore ecx. + popl %eax # Restore eax. + addl DISPLACEMENT,(%esp) # Adjust the return address to skip the next inst. + ret + .size GNAME(alloc_overflow_edx),.-GNAME(alloc_overflow_edx) /* This routine handles an overflow with ebx=crfp+size. So the - * size=ebx-crfp. */ - .align align_4byte - .globl GNAME(alloc_overflow_ebx) - .type GNAME(alloc_overflow_ebx),@function + size=ebx-crfp. */ + .align align_4byte + .globl GNAME(alloc_overflow_ebx) + .type GNAME(alloc_overflow_ebx),@function GNAME(alloc_overflow_ebx): - pushl %eax # Save eax - pushl %ecx # Save ecx - pushl %edx # Save edx - /* Calculate the size for the allocation. */ - subl GNAME(current_region_free_pointer),%ebx - pushl %ebx # Push the size - call GNAME(alloc) - addl $4,%esp # pop the size arg. - movl %eax,%ebx # setup the destination. - popl %edx # Restore edx. - popl %ecx # Restore ecx. - popl %eax # Restore eax. - addl $6,(%esp) # Adjust the return address to skip the next inst. - ret - .size GNAME(alloc_overflow_ebx),.-GNAME(alloc_overflow_ebx) + pushl %eax # Save eax + pushl %ecx # Save ecx + pushl %edx # Save edx + /* Calculate the size for the allocation. */ + subl START_REGION,%ebx + pushl %ebx # Push the size + call GNAME(alloc) + addl $4,%esp # pop the size arg. + movl %eax,%ebx # setup the destination. + popl %edx # Restore edx. + popl %ecx # Restore ecx. + popl %eax # Restore eax. + addl DISPLACEMENT,(%esp) # Adjust the return address to skip the next inst. + ret + .size GNAME(alloc_overflow_ebx),.-GNAME(alloc_overflow_ebx) /* This routine handles an overflow with esi=crfp+size. So the - * size=esi-crfp. */ - .align align_4byte - .globl GNAME(alloc_overflow_esi) - .type GNAME(alloc_overflow_esi),@function + size=esi-crfp. */ + .align align_4byte + .globl GNAME(alloc_overflow_esi) + .type GNAME(alloc_overflow_esi),@function GNAME(alloc_overflow_esi): - pushl %eax # Save eax - pushl %ecx # Save ecx - pushl %edx # Save edx - /* Calculate the size for the allocation. */ - subl GNAME(current_region_free_pointer),%esi - pushl %esi # Push the size - call GNAME(alloc) - addl $4,%esp # pop the size arg. - movl %eax,%esi # setup the destination. - popl %edx # Restore edx. - popl %ecx # Restore ecx. - popl %eax # Restore eax. - addl $6,(%esp) # Adjust the return address to skip the next inst. - ret - .size GNAME(alloc_overflow_esi),.-GNAME(alloc_overflow_esi) - -/* This routine handles an overflow with edi=crfp+size. So the - * size=edi-crfp. */ - .align align_4byte - .globl GNAME(alloc_overflow_edi) - .type GNAME(alloc_overflow_edi),@function + pushl %eax # Save eax + pushl %ecx # Save ecx + pushl %edx # Save edx + /* Calculate the size for the allocation. */ + subl START_REGION,%esi + pushl %esi # Push the size + call GNAME(alloc) + addl $4,%esp # pop the size arg. + movl %eax,%esi # setup the destination. + popl %edx # Restore edx. + popl %ecx # Restore ecx. + popl %eax # Restore eax. + addl DISPLACEMENT,(%esp) # Adjust the return address to skip the next inst. + ret + .size GNAME(alloc_overflow_esi),.-GNAME(alloc_overflow_esi) + + .align align_4byte + .globl GNAME(alloc_overflow_edi) + .type GNAME(alloc_overflow_edi),@function GNAME(alloc_overflow_edi): - pushl %eax # Save eax - pushl %ecx # Save ecx - pushl %edx # Save edx - /* Calculate the size for the allocation. */ - subl GNAME(current_region_free_pointer),%edi - pushl %edi # Push the size - call GNAME(alloc) - addl $4,%esp # pop the size arg. - movl %eax,%edi # setup the destination. - popl %edx # Restore edx. - popl %ecx # Restore ecx. - popl %eax # Restore eax. - addl $6,(%esp) # Adjust the return address to skip the next inst. - ret - .size GNAME(alloc_overflow_edi),.-GNAME(alloc_overflow_edi) + pushl %eax # Save eax + pushl %ecx # Save ecx + pushl %edx # Save edx + /* Calculate the size for the allocation. */ + subl START_REGION,%edi + pushl %edi # Push the size + call GNAME(alloc) + addl $4,%esp # pop the size arg. + movl %eax,%edi # setup the destination. + popl %edx # Restore edx. + popl %ecx # Restore ecx. + popl %eax # Restore eax. + addl DISPLACEMENT,(%esp) # Adjust the return address to skip the next inst. + ret + .size GNAME(alloc_overflow_edi),.-GNAME(alloc_overflow_edi) -#endif + .align align_4byte,0x90 + .globl GNAME(post_signal_tramp) + .type GNAME(post_signal_tramp),@function +GNAME(post_signal_tramp): + /* this is notionally the second half of a function whose first half + * doesn't exist. This is where call_into_lisp returns when called + * using return_to_lisp_function */ + addl $12,%esp /* clear call_into_lisp args from stack */ + popal /* restore registers */ + popfl + leave + ret + .size GNAME(post_signal_tramp),.-GNAME(post_signal_tramp) + .end