From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18169 invoked by alias); 22 May 2009 17:59:45 -0000 Received: (qmail 18140 invoked by uid 22791); 22 May 2009 17:59:44 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-ew0-f163.google.com (HELO mail-ew0-f163.google.com) (209.85.219.163) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 22 May 2009 17:59:38 +0000 Received: by ewy7 with SMTP id 7so2072339ewy.24 for ; Fri, 22 May 2009 10:59:35 -0700 (PDT) Received: by 10.210.34.5 with SMTP id h5mr348169ebh.48.1243015175433; Fri, 22 May 2009 10:59:35 -0700 (PDT) Received: from ?192.168.2.99? (cpc2-cmbg8-0-0-cust61.cmbg.cable.ntl.com [82.6.108.62]) by mx.google.com with ESMTPS id 5sm4480098eyh.20.2009.05.22.10.59.34 (version=SSLv3 cipher=RC4-MD5); Fri, 22 May 2009 10:59:35 -0700 (PDT) Message-ID: <4A16EABF.8050406@gmail.com> Date: Fri, 22 May 2009 17:59:00 -0000 From: Dave Korn User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: java-patches@gcc.gnu.org, GCC Patches CC: libffi-discuss@sourceware.org Subject: [committed] Add _ffi_closure_STDCALL to win32 libffi Content-Type: multipart/mixed; boundary="------------040805070803020201090409" Mailing-List: contact libffi-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libffi-discuss-owner@sourceware.org X-SW-Source: 2009/txt/msg00061.txt.bz2 This is a multi-part message in MIME format. --------------040805070803020201090409 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-length: 561 Pre-approved by Andrew in a separate thread, and applied to gcc SVN. This brings all relevant changes from the upstream libffi/x86/win32.S across to GCC; it still needs merging back in the opposite direction, but that can now be done simply by a wholesale replacement. libffi/ChangeLog: * src/x86/win32.S (_ffi_closure_STDCALL): New function. (.eh_frame): Add FDE for it. Rebuilt and retested the library; no problems - not that any of the testcases will be referring to it, anyway, but just to ensure nothing got broken. cheers, DaveK --------------040805070803020201090409 Content-Type: text/x-c; name="libffi-win32-add-closure-stdcall.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="libffi-win32-add-closure-stdcall.diff" Content-length: 2790 Index: src/x86/win32.S =================================================================== --- src/x86/win32.S (revision 147800) +++ src/x86/win32.S (working copy) @@ -390,6 +390,70 @@ #endif /* !FFI_NO_RAW_API */ + # This assumes we are using gas. + .balign 16 + .globl _ffi_closure_STDCALL + .def _ffi_closure_STDCALL; .scl 2; .type 32; .endef +_ffi_closure_STDCALL: +.LFB5: + pushl %ebp +.LCFI9: + movl %esp, %ebp +.LCFI10: + subl $40, %esp + leal -24(%ebp), %edx + movl %edx, -12(%ebp) /* resp */ + leal 12(%ebp), %edx /* account for stub return address on stack */ + movl %edx, 4(%esp) /* args */ + leal -12(%ebp), %edx + movl %edx, (%esp) /* &resp */ + call _ffi_closure_SYSV_inner + movl -12(%ebp), %ecx + /* It would be nice to just share this code with the + duplicate sequence in _ffi_closure_SYSV, if only + there were some way to represent that in the EH info. */ + cmpl $FFI_TYPE_INT, %eax + je .Lscls_retint + cmpl $FFI_TYPE_FLOAT, %eax + je .Lscls_retfloat + cmpl $FFI_TYPE_DOUBLE, %eax + je .Lscls_retdouble + cmpl $FFI_TYPE_LONGDOUBLE, %eax + je .Lscls_retldouble + cmpl $FFI_TYPE_SINT64, %eax + je .Lscls_retllong + cmpl $FFI_TYPE_SINT8, %eax /* 1-byte struct */ + je .Lscls_retstruct1 + cmpl $FFI_TYPE_SINT16, %eax /* 2-bytes struct */ + je .Lscls_retstruct2 +.Lscls_epilogue: + movl %ebp, %esp + popl %ebp + ret +.Lscls_retint: + movl (%ecx), %eax + jmp .Lscls_epilogue +.Lscls_retfloat: + flds (%ecx) + jmp .Lscls_epilogue +.Lscls_retdouble: + fldl (%ecx) + jmp .Lscls_epilogue +.Lscls_retldouble: + fldt (%ecx) + jmp .Lscls_epilogue +.Lscls_retllong: + movl (%ecx), %eax + movl 4(%ecx), %edx + jmp .Lscls_epilogue +.Lscls_retstruct1: + movsbl (%ecx), %eax + jmp .Lscls_epilogue +.Lscls_retstruct2: + movswl (%ecx), %eax + jmp .Lscls_epilogue +.ffi_closure_STDCALL_end: +.LFE5: .section .eh_frame,"w" .Lframe1: @@ -552,3 +616,34 @@ .LEFDE4: #endif /* !FFI_NO_RAW_API */ + +.LSFDE5: + .long .LEFDE5-.LASFDE5 /* FDE Length */ +.LASFDE5: + .long .LASFDE5-.Lframe1 /* FDE CIE offset */ +#if defined __PIC__ && defined HAVE_AS_X86_PCREL + .long .LFB5-. /* FDE initial location */ +#else + .long .LFB5 +#endif + .long .LFE5-.LFB5 /* FDE address range */ +#ifdef __PIC__ + .byte 0x0 /* .uleb128 0x0; Augmentation size */ +#endif + /* DW_CFA_xxx CFI instructions go here. */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI9-.LFB5 + .byte 0xe /* DW_CFA_def_cfa_offset CFA = r4 + 8 = 8(%esp) */ + .byte 0x8 /* .uleb128 0x8 */ + .byte 0x85 /* DW_CFA_offset, column 0x5 %ebp at CFA + 2 * -4 */ + .byte 0x2 /* .uleb128 0x2 */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI10-.LCFI9 + .byte 0xd /* DW_CFA_def_cfa_register CFA = r5 = %ebp */ + .byte 0x5 /* .uleb128 0x5 */ + + /* End of DW_CFA_xxx CFI instructions. */ + .align 4 +.LEFDE5: --------------040805070803020201090409--